-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdb-init
88 lines (74 loc) · 1.86 KB
/
gdb-init
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
76
77
78
79
80
81
82
83
84
85
86
87
88
set pagination off
target remote localhost:4242
monitor halt
define get-breakpoints
update-breakpoints
end
define update-breakpoints
# generate hardcoded breakpoints
shell make gen-breakpoints
delete
source _breakpoints.txt
end
define wwindow
shell touch watch-window.txt
echo Watch Window: \n
echo --------------------------------\n
source watch-window.txt
end
document wwindow
Get pre-defined variable contents from watch-window.txt
end
define cheatsheet
shell make debug-with-cmd-help
end
define reload
dont-repeat
echo --------------------------------\n
echo +++ compiling code...\n
echo --------------------------------\n
shell make; echo "set \$retval = $?" > /tmp/gdb-retval
source /tmp/gdb-retval
if $retval > 0
echo --------------------------------\n
echo !!! compilation failed!\n
echo --------------------------------\n
else
echo --------------------------------\n
echo +++ flashing the binary...\n
echo --------------------------------\n
# for the application code
load ./build/ch.elf
# for the symbol table
file ./build/ch.elf
# put a temporary breakpoint to the main() function
echo ----------------------------------------\n
echo ... 'reload' when source code is changed\n
echo ... 'update-breakpoints' to update breakpoints from "// debugger" lines\n
echo ... 'cheatsheet' for cheatsheet\n
echo ----------------------------------------\n
update-breakpoints
tb main
cont
end
end
define reset
monitor halt
monitor reset
end
define exit
kill
quit
end
define curr
dont-repeat
# frame
# list
layout src
focus cmd
end
document curr
Show the code around currently hit breakpoint
end
# --- initialize ---
reload