!!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] | run the program
| kill | stop program from running
| quit | exit debugger
| help |
| ^C | stop / interrupt the program
| continue | continue execution
| list | show program code
| next | go over next line
| step | go into next line
| print x | print value of x
| backtrace | show stack
| frame n | change to stack frame n
| info frame |
| info locals |
| info args |
!Breakpoints
| break file.c:45 | set breakpoint at line 45 of file.c
| break myfun | set breakpoint at beginning of myfun()
| info breakpoints | list breakpoints
| disable 2 | disable breakpoint 2
| clear XXXX | delete breakpoint