Software Development under LinuxThe gdb DebuggerBasic gdb Commands

5.1. Basic gdb Commands

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

Written by Shlomi Fish