Software Development on LinuxThe gdb DebuggerBasic gdb Commands

5.1. Basic gdb Commands

run Executes the program from the beginning. You can use: run < file_in > file_out to redirect I/O for the program being executed.
break Used to set breakpoints. Can be used in many ways:
break line_number
break function_name
break file_name:line_number
break class::method
next Proceed one command line while not entering function calls.
step Proceed one command line, step into function calls if necessary.
cont Continue until next breakpoint.
where Display call stack.
print Print a variable or an expression. Used print expression
up/down Move up and down in the call stack. Allows you to examine local variables of previous functions.

Written by Shlomi Fish