ANN: (slightly) extended Python debugger

R

R. Bernstein

I've put out the first release of an expanded version of the Python
debugger. For now it is under the bashdb project on sourceforge:
http://sourceforge.net/project/showfiles.php?group_id=61395

I've tried this only on 3 machines and each had a different version of
Python: OSX using python version 2.3.5, Fedora Core 4/5 using version
2.4.2 and cygwin using 2.4.1. I am not a Python expert and less so
when it comes to understanding what was added in what release. If this
works before 2.3.5, let me know and all reduce the requirement check
warning on configuration.

In this debugger, largely we're trying to follow gdb's command set
unless there's good reason. So new or modified command names generally
refer to the function they have in gdb.

Changes from pdb.py:

- Add run (restart)

- Add Perl's "examine" to show info about a symbol. For functions,
methods, classes and modules the documentation string if any is printed.
For functions, we also show the argument list. More work is needed here
to recurse fields of an arbitrary object and show that.

- add gdb's "frame" command

- Add some "set"/"show" commands:
args, listsize, version (no set here), dialect

- Add some "info" commands:
args, break, line, locals, source

- up/down can take a number of frames to move.

- Stepping skips over "def" statements.

For now, there are two slight dialects of debugger command set: python
and gdb

For the gdb dialect, stack traces look more like they do in gdb and
so does frame numbering, "up" and "down" function as gdb's does. In
the python mode, stack traces should be the same.

In the gdb dialect, some commands have been removed:

- "return": this is reserved for a gdb-style return and it's short
name "r" can be confused with "run". The gdb equivalent is "finish"

- "args": the gdb equivalent is "info args" and the short name "a"
has been removed.

Aliases could be added in one's .pydbrc for these.

Coexistence:

For now, we try not to conflict with pdb.py. After all, Python
developers made provision of multiple debuggers so we'll make use of
that!

So whereever there was a pdb, use pydb. Where Pdb use Pydb. So, as
hinted above, the debugger initialization script is .pydbrc for this
debugger rather than .pdbrc for the one that comes with Python.

Future:

There is much that could be improved and this is just a glimpse of
what might be done. (But even if it stops here, I'll still be using
it ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top