Program Debugging
Print this page

Important commands of gdb :

  • break [ file : ] function : Set a breakpoint at the beginning of function (in file ) .
  • break [file:] #n : Set a breakpoint at line #n (in file ) .
  • run [arglist] : Start your program (with command line arglist , if any).
  • next : Execute next line of the program (after stopping). That is, executes next line completely, including function calls (if any). It is called step over any function calls in the line.
  • c : Continue executing the program (after stopping) till next breakpoint, if any.
  • print expr : Display the value of an expression.
  • list [ file : ] function : Type the text of the program in the vicinity of where it is presently stopped.
  • step : Execute next program line (after stopping). It there is any function call present in the next program line, it goes into 1 st line of that function. It is called step into any function calls in the line.
  • quit : Exit from GDB.
  • q : Exit from GDB.
  • help : Show information about GDB commands.
  • help [name] : Show information about GDB command name .
Prev