Combining Embedded and Interactive Python in a Debugger: A Case Study
summary
LLDB embeds a full Python interpreter and a session dictionary per debugger to let users run interactive Python, attach breakpoint script commands, and call the LLDB API from Python via a SWIG-generated module. Implementation uses debugger-IDs, global-dictionary patching, and mutex/condition locking to simulate multiple interpreters in one process; access is serialized (no true parallel interpreters). Demo searches a large BST for "Romeo" (found path left left right right left) and locates the bug: uppercase R vs lowercase r. Works on macOS and Linux.
AI-written summary · about
chapters (25)
- 0:00Intro
- 0:46OUTLINE
- 3:54FRAMES & STACKS
- 5:31DESIRED GUI DEBUGGER BEHAVIOR
- 11:04WHY SCRIPTING IN A DEBUGGER?
- 15:52LLDB EXTENSIONS FOR PYTHON
- 17:37IMPLEMENTING INTERACTIVE PYTHON INTERPRETER
- 18:43IMPLEMENTING ONE- LINE SCRIPT COMMANDS
- 19:00HOW THE DICTIONARIES WORK (1)
- 19:42INVOKING ONE-LINE SCRIPT COMMANDS
- 20:20INVOKING INTERACTIVE SCRIPT INTERPRETER
- 22:45COMMANDS - CREATE
- 26:01PASSING POINTERS & C++ OBJECTS TO PYTHON
- 28:39GETTING A SINGLE OBJECT ACROSS THE DEBUGGER
- 30:14WHY A DEBUGGER- LEVEL DICTIONARY?
- 30:49INTERACTIVE INTERPRETER & ONE LINE COMMANDS
- 31:24BREAKPOINT COMMANDS: A PROBLEM
- 32:34DICTIONARY SET-UP
- 33:07DICTIONARY CLEAN-UP
- 34:08PY NEWINTERPRETER?
- 36:58GUI DEBUGGER PYTHON REQUIREMENTS
- 38:35THE PLAN Searching Tree Without Restarting Program
- 39:48USING THE INTERACTIVE INTERPRETER
- 41:43PYTHON BREAKPOINT COMMAND (At Decision to Follow Right Child)
- 43:58SUMMARY
related talks
06mImproving Debuggability with GDB's Python API
41mAdvanced Python Debugging Techniques Using GDB
32mA new safe external debugger interface for CPython
40mSo you think you can PDB?
50mHow I built a power debugger out of the standard library and things I found on the internet
34mDebugging python applications inside k8s environment
25mLive process manipulation with Python 3.14's zero overhead debugging interface
23mTrace functions: Building a tiny debugger
