Debugging with GDB (September 2007)

166 Debugging with GDB
printf("Value of b greater than 0\n");
if (c)
printf("Value of c greater than 0\n");
printf("All condition checking done\n");
return 0;
}
Sample Debugging Session:
$cc +pathtrace -g execpath.c
$gdb a.out
HP gdb ...
Type "show warranty" for warranty/support.
...
(gdb) b main
Breakpoint 1 at 0x4000a60:0: file execpath.c, line 7 from a.out.
(gdb) r
Starting program: a.out
Breakpoint 1, main () at execpath.c:7
7 int a = 3, b = 0, c = 4;
(gdb) n
9 if (a)
(gdb) i ep
Local execution path table for main():
empty
(gdb) i gep
Global execution path table:
empty
(gdb) n
10 printf("Value of a greater than 0\n");
(gdb) n
Value of a greater than 0
12 if (b)
(gdb) i ep
Local execution path table for main():
0 0x4000a80:2 (execpath.c:10)
(gdb) i gep
Global execution path table:
G0 0x4000a80:2 main (execpath.c:10)
(gdb) n
15 if (c)
(gdb) i ep
Local execution path table for main():
0 0x4000a80:2 (execpath.c:10)