!!GDB - GNU debugger
gdb without any arguments automatically uses a.out
C programs should be compiled with -g
To make a program produce a core file for debugging with gdb after-the-fact do:
{{{ulimit -c unlimited}}}
{{{gdb myProgram [core]}}}
| run [[args] | r | run the program
| kill | k | stop program from running
| quit | q | exit debugger
| help | h |
| ^C | | stop / interrupt the program
| continue | c | continue execution
| list | l | show program code
| next | n | go over next line
| step | s | go into next line
| print x | p | print value of x
| backtrace | bt | show stack
| frame n | f | change to stack frame n
| info locals | i lo | display local variables
| info args | i ar | display command line arguments
| info frame | i f | stack frame information
!Breakpoints
| break file.c:45 | b | set breakpoint at line 45 of file.c
| break myfun | b | set breakpoint at beginning of myfun()
| info breakpoints | i br | list breakpoints
| disable 2 | | disable breakpoint 2
| clear XXXX | cl | delete breakpoint at location XXXX
| delete nnn | d | delete breakpoint number nnn