Combining Embedded and Interactive Python in a Debugger: A Case Study
summary
LLDB embeds a full Python interpreter, exposes its C++ API via a SWIG-generated module, and provides interactive, one-line and breakpoint-script entry points. Each debugger session gets a persistent Python dictionary and session dictionary isolation is enforced by copying keys and by a custom mutex/cond lock that serializes access (no true concurrency). Breakpoint scripts receive frame and location objects; a real case study uses a Python DFS to find "romeo" in a BST and uncovers a case-conversion bug, proving the approach works.
AI-written summary · about
chapters (34)
- 0:00Intro
- 0:42OUTLINE
- 1:27WHAT IS LLDB?
- 2:18SOME USES OF THE LLDB LIBRARY
- 3:01TARGETS & PROCESSES
- 3:32BREAKPOINTS
- 3:54FRAMES & STACKS
- 5:31DESIRED GUI DEBUGGER BEHAVIOR
- 6:20DEBUGGERS IN LLDB
- 11:04WHY SCRIPTING IN A DEBUGGER?
- 15:52LLDB EXTENSIONS FOR PYTHON
- 17:38IMPLEMENTING 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
- 21:32MORE ABOUT LLOB BREAKPOINT SCRIPTS...
- 22:45COMMANDS - CREATE
- 23:44COMMANDS - CALL
- 24:52BUILDING THE LLOB PYTHON API MODULE
- 25:37PARTICULAR PROBLEMS & SOLUTIONS
- 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:08POSSIBLE APPROACHES
- 35:45WRITE OUR OWN!
- 37:36EXAMPLE: SIMPLE DICTIONARY PROGRAM Store and find words in Binary Search Tree
- 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
41mAdvanced Python Debugging Techniques Using GDB
06mImproving Debuggability with GDB's Python API
32mA new safe external debugger interface for CPython
40mSo you think you can PDB?
34mDebugging python applications inside k8s environment
28mWhat makes a Python debugger possible and how can we make it 100x faster
50mHow I built a power debugger out of the standard library and things I found on the internet
39mDebugging python applications inside k8s environment
