| Table 1 Transcript of a typical gdb session
|
| What the user enters
|
What happens on the serial port gdb sends...
|
target responds with...
|
| host>gdb myprogram
|
|
|
| gdb> target remote
|
+$Hc1#09
|
+$OK#9a
|
| /dev/ttyS0
|
+$qOffsets#4b
|
+$Text=0;Data=0;Bss=0#04
|
|
|
+$?#3f
|
+$S05#b8
|
|
|
+$g#67
|
+$00001a00ffff81b200000020...
|
| gdb> load
|
$M401054,10:004020240040
|
+$OK#
|
|
|
20240040202400402024#72
|
|
|
|
... [lots more M messages]
|
|
| gdb> breakpoint main
|
[nothing gdb physically sets the breakpoint
|
|
|
|
immediately before the continue command is sent]"
|
|
| gdb> continue
|
+$M4015cc,2:c320#6d
|
+$OK#9a
|
|
|
+$c#63
|
+
|
|
|
[gdb places a
breakpoint
opcode at main()]"
|
|
|
|
[program runs until it reaches main()]"
|
|
|
|
|
$T050:00401400;1:00404850
|
|
|
|
;2:00000001;3:00000030;
|
|
|
|
4:ffffffff;5:00000000;6:00000
|
|
|
|
010;7:00000010;8:0040161c;
|
|
|
|
9:00002070;a:00404068;b:
|
|
|
|
004015bc;c:ffffffff;d:ffffffef;
|
|
|
|
e:00404840;f:00404840;10:
|
|
|
|
004015cc;11:004015cc;12:
|
|
|
|
d04001e2;13:00401000;14:
|
|
|
|
00000000;15:00ffffff;16:0000
|
|
|
|
00f0;#d1
|
|
|
|
[target stopped at main(),
address 0x4015cc]"
|
| gdb> display foo
|
+$m4015bc,2#5a
|
+$2f86#06
|
|
|
|
[foo is at address 0x4015bc;
its value is 0x2f86]"
|
| gdb> stepi
|
$s#73
|
+
|
|
|
|
[target executes one instruction]
|
|
|
|
$T050:00401400;1:00404840
|
|
|
|
;2:00000001;3:00000030;4:ff
|
|
|
|
ffffff;5:00000000;6:00000010
|
|
|
|
;7:00000010;8:0040161c;9:0
|
|
|
|
0002070;a:00404068;b:0040
|
|
|
|
15bc;c:ffffffff;d:ffffffef;e:0040
|
|
|
|
4840;f:00404840;10:004015c
|
|
|
|
e;11:004015cc;12:d04001e2;
|
|
|
|
13:00401000;14:00000000;
|
|
|
|
15:00ffffff;16:000000f0;#d2
|
|
|
|
[PC is now 0x4015ce]
|
|
|
|
|
| gdb> quit
|
$k#6b
|
+
|