Debugger sheet for gdb
Debugger sheet for gdb
break f
b f
o Set a breakpoint at the start of main:
break main
b main
• Displaying variables
o Show the contents of a variable “x” whenever the program stops:
display x
d x
o Show the contents of the element at position “i” of string (or vector, or array) “s”
whenever the program stops:
display s[i]
d s[i]
o Show the contents of variable “x” right now (and not when the program stops again)
print x
run
r
o Continue the program from its current position to the next breakpoint, or the end of the
program
continue
c
o Go to the next line of the current function (skipping over any function calls on the current
line)
next
n
o Go to the next line that will be executed (entering a function call if there is one on the
current line):
step
s
• Quitting the debugger:
quit
q