[Zope-dev] pdbtrack.el - track source file whenever runing pdb in an emacs buffer

Ken Manheimer klm@digicool.com
Sun, 16 Jul 2000 15:38:51 -0400 (EDT)


I've put together an alternative, pared down approach to doing python
debugging inside emacs - pdbtrack:

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

Once loaded, pdbtrack watches your (comint) process interaction
buffers for the pdb stacktrace.  When it sees it, and can find the
file containing the current stacktrace focus, it pops the file up in a
separate emacs buffer, centered on the current debug line.  This way
you continue to interact with pdb, stepping into and out of functions,
moving up and down stack frames, anything that changes focus - and
emacs displays the right place in the source in a companion buffer.

Of course, pdbtrack works just fine with the zope interactive debugger 
(reachable, for example, via:

  % cd $SOFTWARE_HOME/lib/python
  % python
  >>> import Zope; app = Zope.app()
  >>> Zope.debug('Zope.app().whatever', d=1)
  [debug...]

)

The big difference between pdbtrack.el and pdb.el is that you don't
need to start your debugging session in a GUD (Grand Unified Debugger)
buffer.  I often have to arrange a lot of state in the interpreter
before i can jump into debugging.  This generally defeats switching to
a GUD session, with its separate process - while pdbtrack just jumps
in whenever i go into the python debugger, within the accumulated
context. 

pdbtrack lacks a number of things that GUD does have.  It doesn't
highlight the current source line other than centering it in the
source buffer, and it doesn't provide nicities like stepping and
setting breakpoints from within the source buffer.

However, pdbtrack is much much more lightweight than gud - and it
might be interesting to see about providing some of the gud features,
like debug keybindings in the source file buffers involved in the
debug session, with this more open, decentralized model.

In the meanwhile, pdbtrack goes a long way towards doing what i want -
i hope it's useful to others.  I've submitted an entry for vaults of
parnassus, not sure how long it takes to show.  To repeat from above,
you can find it at:

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

Ken Manheimer
klm@digicool.com