Skip to content

Instantly share code, notes, and snippets.

@classmember
Created March 30, 2019 01:04
Show Gist options
  • Save classmember/a4c907379faf51f4dac502f56ecae139 to your computer and use it in GitHub Desktop.
Save classmember/a4c907379faf51f4dac502f56ecae139 to your computer and use it in GitHub Desktop.
'''
dive
open a gdb session targeting a python compiled with gdb debugging enabled
alias dive='gdb -iex '\''add-auto-load-safe-path .'\'' /opt/cpython/python'
in gdb:
b 1
r
s
other gdb commands:
help
b 1 (breakpoint at line 1)
up
down
next
ctrl+x ctrl+a (enable/disable TUI)
s (step)
list
refresh
i (info)
i r
frame -- Select and print a stack frame
py-bt -- Display the current python frame and all the frames within its call stack (if any)
py-bt-full -- Display the current python frame and all the frames within its call stack (if any)
py-down -- Select and print the python stack frame called by this one (if any)
py-up -- Select and print the python stack frame that called this one (if any)
return -- Make selected stack frame return to its caller
select-frame -- Select a stack frame without printing anything
up -- Select and print stack frame that called this one
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment