https://sumitkgaur.wordpress.com/2014/05/13/python-debugging/
sudo apt update
sudo apt install -y python3-dbg oython3-dev
more /usr/share/doc/python3-dbg/README.debug
Have the libraries run automatically:
### Note your python version might be different (like 3.5 or 3.8)
### just see what the package was installed at from above
zcat /usr/share/doc/python3.7/gdbinit >> ~/.gdbinit
gdb -p 455
Or run the libraries at load: (doesn't work)
gdb --args python3-dbg 455
Run on a script:
gdb ~/myscript.py
Process will most likely stop, so you can hit c to continue for a bit and ctrl-C to stop again
py-bt — Get stack trace of the python process
info threads — If one process has more than one thread, you can find the list of all threads executing.
py-list — Find out the code which the current thread is executing
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)
py-locals — Get all python local variables in the current frame
py-print — Look up the given python variable name
next
next
finish