Automating Debug
(gdb) break <anything>
(gdb) commands
<any automate commands>
...
continue
end
(gdb)(gdb) break example.c:11
Breakpoint 1 at 0x890: file example.c, line 11.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>p input[i]
>p i
>continue
>end
(gdb) r
Starting program: /home/bankde/Desktop/tmp/example.o
Put string to split: hello world
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
11 if (input[i] == ' ') {
$1 = 104 'h'
$2 = 0
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
11 if (input[i] == ' ') {
$3 = 101 'e'
$4 = 1
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
11 if (input[i] == ' ') {
$5 = 108 'l'
$6 = 2
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
11 if (input[i] == ' ') {
$7 = 108 'l'
$8 = 3
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
---Type <return> to continue, or q <return> to quit---
11 if (input[i] == ' ') {
$9 = 111 'o'
$10 = 4
Breakpoint 1, split (input=0x7fffffffdf40 "hello world\n") at example.c:11
11 if (input[i] == ' ') {
$11 = 32 ' '
$12 = 5
First str: Hello
Second str: WorldLast updated