Using gdb, the Gnu Debugger

Here are some more useful commands.

run
starts running the program. This will run to the first breakpoint. You can pass arguments to the run command; this passes arguments to your program. For example
r arg1 arg2
print
displays the value of a variable or expression
step
steps through the program a line at a time, stepping into functions.
next
steps through the program a line at a time, stepping over functions
continue
runs to the next breakpoint
list
shows the source code
quit
terminates the debugger
help
gets more information