-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathgdbinit.in
75 lines (63 loc) · 2.03 KB
/
gdbinit.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (c) 2023, Niklas Hauser
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------
# Do not ask for confirmation when using Ctrl-D or the quit command
define hook-quit
set confirm off
end
# Create a coredump.txt file in CrashDebug format
define modm_coredump
set pagination off
set style enabled off
set logging file coredump.txt
set logging overwrite on
set logging enabled on
# Dump all volatile memories
%% for ram in all_rams
set var $ptr = 0x{{ "%08x" % ram.start }}
while $ptr < 0x{{ "%08x" % (ram.start + ram.size) }}
x/4wx $ptr
set var $ptr += 16
end
%% endfor
# Dump all CPU/FPU registers
info all-registers
set logging enabled off
set logging overwrite off
set logging file gdb.txt
set style enabled on
end
# Print the modm::build_id() content only from the firmware
define modm_build_id
# We want to do a coredump without an ELF file, since you may not have it at
# hand, so we locate it manually: it is the first entry after the vector table
set var $__build_id = 0x08000000 + {{ vector_table_size }}
# We want to do `__build_id.data[__build_id.namesz]` but `ElfNoteSection_t`
# may not even be in the ELF file, so we need to do this manually
set var $start = (const unsigned char*)$__build_id + 12 + *(const unsigned int*)$__build_id
set var $end = $start + 20
# Print the 20 bytes of the signatures as hexadecimal
printf "build_id = "
while $start < $end
printf "%02X", *$start
set var $start += 1
end
printf "\n"
end
define modm_setup_tui
compare-sections
b main
end
# note: reset command is monitor specific
define rerun
reset
continue
end
set print pretty
set print asm-demangle on
set mem inaccessible-by-default off