C++ debugger for python/scintilla?
Charles G Waldman
cgw at alum.mit.edu
Wed Nov 28 00:07:15 CET 2001
Ken Seehof writes:
> Any know how I might go about implementing a C/C++ debugger in
> python for debugging python extensions? Is such a project being
> worked on?
> The main features that I need are:
> 1. place a breakpoint in a python extension source code file
> 2. invoke a python callback when a breakpoint (or exception) is hit
> 3. step through extension source code
> 4. access the symbol table
> Is anyone using PyGDB? Is it what I'm looking for? At first
> glance, it appears to be inside-out compared to what I want. PyGDB
> apparently is a python script that uses gdb to debug python code,
> rather than a python module that debugs extensions (in other words,
> PyGDB set breakpoints in python code, but I want to set breakpoints
> in C++ code inside extensions). Perhaps I can use gdb.py directly
> as a module?
PyGDB has two modes - C mode and Python mode. In C mode, you can
print out values of C expressions, or put breakpoints at any line in
any C file - it plays just like GDB. In Python mode, you print Python
expressions and place breakpoints on any Python line. It's really a
hack, the Python breakpoint feature works by putting a break inside
ceval, where the "SET_LINENO" opcode is handled - every time this
breakpoint is hit, PyGDB checks the Python line number and file to
check if they are in the list of Python breakpoints.
The bad news: thanks to the current job situation, I'm no longer doing
full-time Python work and currently have very little time to hack
Python (although I would dearly love to change this). PyGDB is in a
state where it kinda works, but it's very fragile (it doesn't always
track GDB state perfectly) and hackish at this point. I'd like to see
it turn into something more real... if anybody wants to work with me
on this, I will try to help... at least you can take the current PyGDB
as a starting point.
More information about the Python-list