[IPython-dev] Patches to use pydb instead of pdb for debugging

R. Bernstein rocky at panix.com
Fri Oct 6 05:19:21 CDT 2006


The diffs are against svn, current as of Oct 6th at revision 1809. 

Some small things I just noticed and throw out for general comment.

1. Command Completion
===================
pydb adds command completion for debugger commands and
subcommands. (Subcommands are things like "info ...", "set ..." or
"show ..."). It also adds the gdb "command" command which will return
a list of completion tokens.

I've checked and (not surprisingly) the "command" command does work
under ipython. However it would be nice to hook that in so it does the
right thing when one enters "tab" (or whatever the completion key is)
and likewise when running inside Emacs. It looks like some sort of
completion is provided in both cases, although the code for this is
different (if not also providing different results).

The code inside ipython-complete() of ipython.el looks pretty
complicated; also I'm not sure where the right place to hook this in
for the non-Emacs shell would be. Suggestions and advice?

2. ? and ??
===================
Although pydb adds an "examine" command for objects (similar to Perl's
debugger), it might be nice to extend pydb so that it hooks into the
same mechanism used by ipython. (I'm referring the ?object and
??object here). This could either be done inside pydb code, but maybe
it would be neater to do inside ipython since it looks like there are
routines already for decorating debugger commands. Suggestions on
where to look to hook into '?' and '??'?

3. list command
===================
And finally, speaking of extending the debugger commands, I see that
"list" is one of the extended commands (without help docstring). But
pydb's/gdb's list command is a bit more flexible: one use as a target
module/function/methods names as well as file/line positions. Also
pydb/gdb allows '-' to indicate listing backwards, and one can change
the list size window (via "set listsize").

At least for pydb this can currently be done by decorating the
function rather than copying it since pydb is better than pdb with
respect to allowing for output redirection. As pydb currently stands,
this would be done by saving the self.msg_nocr method, changing it and
restoring it before returning. However if folks think it is better for
pydb to provide a "list" command that returns a list of strings
instead, that could easily be done in a future pydb release. For
example, if folks think that doing the above is sufficiently ugly and
think there will be other applications like ipython that might want to
embed a debugger, changing pydb may make sense. So here too, comments
and suggestions are welcome.

Fernando Perez writes:
 > On 10/6/06, R. Bernstein <rocky at panix.com> wrote:
 > > One more file to be patched, the Emacs interface, ipython.el, since I
 > > changed the debugger prompt when using pydb:
 > 
 > Many thanks, I'll try to integrate these soon.
 > 
 > Are these diffs against current SVN?  If not, could you please resend
 > them against SVN?  I haven't checked, so if they are, just ignore this
 > comment.
 > 
 > Regards,
 > 
 > f
 > 


More information about the IPython-dev mailing list