Debugging with GDB (February 2008)

Table Of Contents
172 Debugging with GDB
(gdb) run
Starting program: ./address_error
Breakpoint 1, main () at ./address_error.c:41
41 fun (count, count*1.1);
(gdb) p fun(10, 1.1)
Program received signal SIGBUS, Bus error
si_code: 0 - BUS_UNKNOWN - Unknown Error.
0x2c38 in fun (i=10, f=0) at ./address_error.c:37
37 count = *p;
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (fun) will be abandoned.
(gdb) bt
#0 0x2c38 in fun (i=10, f=0) at ../address_error.c:37
#1 0x1920 in _sr4export+0x8 ()
#2 <function called from gdb>
#3 0x2c74 in main () at ./address_error.c:40
(gdb) abort
Abort gdb command line call? (y or n) y
#0 main () at ./address_error.c:41
41 fun (count, count*1.1);
(gdb) bt
#0 main () at ./address_error.c:41
(gdb) quit
The program is running. Exit anyway? (y or n) y
14.18 Instruction Level Stepping
During instruction level stepping with nexti and stepi, WDB prints the assembly
instruction along with the next source line.
(gdb) stepi 0x101530:0 st4 [r9]=r34 1337 args.argc = argc;
It also prints DOC line information, which includes actual line number and the column
number, when debugging a binary with -g -O.
(gdb) stepi ;;; [8, 1] 0x4000820:1 nop.m 0x0
GDB cannot step into a function with no debug information. GDB cannot do a next
over a line when there is not debug information. However, the continue command
works in such situations.
14.19 Enhanced support for watchpoints and breakpoints