[Python-Dev] pdbtrack.el - alt approach to emacs-based python debugging

Ken Manheimer klm@digicool.com
Tue, 18 Jul 2000 02:16:07 -0400 (EDT)


You emacs inhabitants out there may be interested in pdbtrack.el, a
little alternative for source-file python debugging in emacs:

  http://www.zope.org/Wikis/klm/PDBTrack

With pdbtrack, whenever you run pdb, emacs tracks (*) the current
source file line, centered in another emacs window.  It keys on the
process output, cuing on the stack trace format and the pdb prompt, so
it's pretty unlikely to misfire.

That's all it does - it lacks a lot of GUD features, like putting
highlighting glyphs on the current line, providing debugging commands
from inside the source file buffer, etc.  On the other hand, it's also
very trim, code-lines-wise - a total of 122 lines, without any GUD
connection, and that includes 59 lines that are only for working
around a bug in mainline emacs' make-local-hook.  (Incorporating the
GUD-style features may not be too hard - since it touches the buffer
where the debugging was started, as well as the source file buffers,
it could set up the necessary state and bindings per session.  But i'm
not particularly driven to pursue that - tracking the current line in
the source file seems to be most of what i need...)

The fundamental difference between pdbtrack and GUD/pdb.el is that
pdbtrack doesn't require you to launch the debugging session from a
particular buffer - it tracks from any comint buffers where you run
python.  This fits the way i tend to use the debugger - generally, i
do more-or-less elaborate interactions with my application *before* i
go into the debugger, to set up the context and/or explore my way to
the debugging start point.  With GUD i have to start the session
directly in the debugger.  And then, when i finish a GUD session, (i
believe) the context is lost.  When debugging in a regular shell
buffer (and the python-mode py-shell, etc), i drop back into python,
wander around, and often launch back into the debugger, with the
accumulated state.  pdbtrack tracks wherever and whenver you're
running pdb in emacs.

(I posted more description yesterday to the python and the zope lists: 

  http://www.python.org/pipermail/python-list/2000-July/108654.html )

If this proves to be of general interest and acceptance, i'd love to
see it considered for inclusion with python-mode...

Ken
klm@digicool.com

((*) "whenever you run *pdb*, emacs *tracks*" - that's why i almost
called it "zip":->)