Notes on debugging.

The GNU Project debugger, displays what is going on 'inside' a program while it executes - or what it was doing at the moment it crashed.

Commands

gdb ./program starts gdb
run executes the code
s steps to the next line
n jumps over the next function
c continues execution
l prints 5 lines above and below current statement
break sets a breakpoint either at line number of function name
watch stops the execution everytime a variable value changes
display prints a variable value on execution stops
info displays information on breakpoints and watchpoints
clear # removes the breakpoint at line #
condition 1 i == "test" breaks at breakpoint 1 when i is "test"

Links

incoming(1) | clang