Advanced Python Debugging Techniques Using GDB
summary
Shows how to attach gdb to a Python PID and use the cpython python-gdb support (python gdb.py) and gcore to inspect live or core-dumped interpreters, requiring debug symbols. Demonstrates concrete fixes: a 40,000-job thread pool stalls because requests has no default timeout; a custom work-queue races by checking empty then get under 10 threads; a ctypes wrapper dereferences NULL when key is None causing a segfault; a readers/writers deadlock arises when an exception leaves a lock unreleased.
AI-written summary · about
chapters (11)
- 0:00Introduction to GDB
- 1:00The necessity of GDB
- 2:53GDB integration and setup
- 4:48Preparing production servers
- 7:10Debugging remote processes
- 9:58Core GDB commands
- 13:06Example 1: Network deadlock
- 22:29Example 2: Queue race condition
- 29:36Example 3: CTypes segmentation
- 34:08Example 4: Reader-writer deadlock
- 39:58Conclusion and Q&A
related talks
50mExtending GDB debugger capabilities with Python
06mImproving Debuggability with GDB's Python API
12mDebugging Python in Production: Practical Techniques Beyond Print Statements
40mSo you think you can PDB?
34mDebugging python applications inside k8s environment
29mPython's Infamous GIL
39mDebugging python applications inside k8s environment
52mCombining Embedded and Interactive Python in a Debugger: A Case Study
