Gdb

From miki
Revision as of 10:52, 22 July 2011 by Mip (talk | contribs) (Created page with '== References == * [http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html 7.2 Example Debugging Session: Segmentation Fault Example] * == Compile with debug symbols == * Opti…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

References

Compile with debug symbols

  • Option -g:
gcc -g program.c           # -g : debug symbols

GDB commands

help
Get help on commands
run [ARGS]
Start debugged program. Arguments may include wildcards (*) and redirections (<, <<...)
backtrace [COUNT]
bt [COUNT]
where [COUNT]
Print backtrace of all stack frames, or innermost (outermost) COUNT frames if COUNT>0 (COUNT<0)
frame [FRAME]
Select and print stack frame
print VAR
Print value of variable VAR
kill
Kill current program
break FILELINE
Insert a breakpoint at file FILE, line LINE
next
Step to next instruction