Skip to content

Instantly share code, notes, and snippets.

@danielkrizian
Last active March 2, 2019 21:24
Show Gist options
  • Save danielkrizian/eb32fe3b5540a50cdb4fc25321c38fd0 to your computer and use it in GitHub Desktop.
Save danielkrizian/eb32fe3b5540a50cdb4fc25321c38fd0 to your computer and use it in GitHub Desktop.
gdb cheatsheet

Breakpoints

keydescription
b funName
d 1deletes breakpoint
disable 1 enable 1disable/enable breakpoint
d.deletes all breakpoints
-----------------------------------------------
r runstart program (with args)
-----------------------------------------------
list list 1, 6show source code (between two comma-separated line numbers )
whereshow stack trace, with line number where each function in stack was
bt backtracebacktrace; print out current stack
----------------------------------------------------------------------
p a print a
p (char) acasts to char befoe print
print f(123)executes function f with args 123 and prints its return value
x 0xfaf47prints content of memory address
display xprint out the value of~x~ whenever program stops
---------------------------------------------
stepexecute line by line, entering any function calls
nextexecute line by line, skipping over functon calls
continueresumes normal execution until breakpoint
finishresumes normal execution until end of proc or breakpoint
kill
quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment