This article shares with you the use of GDBdebugging in a runningPythonProcessRelated content, come together to look at it, hope to learn Python to help you. preparatory workinstallationGdband thepython2.7-dbg: $ sudo apt-getInstallGDB python2.7-dbgSet/proc/sys/kernel/yama/ptrace_scope: $ sudo su# echo 0 >/proc/sys/kernel/yama/ptrace_scopeRuntest.py: $pythonTest.py& [1] 6489throughGDB python PIDto debug a running process: $ gdb Python 6489 GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 ... For Help,type"Help".Type"Apropos word" to Search forCommands related to"Word" ... Reading symbols fromPython... Reading symbols from/usr/lib/debug/.build-ID/90/d1300febaeb0a626baa2540d19df2416cd3361.debug...done. Done. ... Reading symbols from/lib/ld-linux.so.2 ... Reading symbols from/usr/lib/debug//lib/i386-linux-gnu/ld-2.23.so...done. Done.0xb778fc31inch__kernel_vsyscall () (GDB) Source: Huang Huang's Blog
Debugging a running Python process using GDB