Copyright © tutorialspoint.com

GDB Commands

previous next


Advertisements

There is a big list of GDB commands but following commands are among the more useful gdb commands:

  • b main - Put a breakpoint at the beginning of the program
  • b - Put a breakpoint at the current line
  • b N - Put a breakpoint at line N
  • b +N - Put a breakpoint N lines down from the current line
  • b fn - Put a breakpoint at the beginning of function "fn"
  • d N - delete breakpoint number N
  • info break - list breakpoints
  • r - Run the program until a breakpoint or error
  • c - continue running the program until the next breakpoint or error
  • f - Run until the current function is finished
  • s - run the next line of the program
  • s N - run the next N lines of the program
  • n - like s, but don't step into functions
  • u N - run until you get N lines in front of the current line
  • p var - print the current value of the variable "var"
  • bt - print a stack trace
  • u - go up a level in the stack
  • d - go down a level in the stack
  • q - Quit gdb

previous next

Copyright © tutorialspoint.com