pydb remote debugging/cmd.Cmd over socket?

R. Bernstein rocky at panix.com
Wed May 28 23:18:15 EDT 2008


"Diez B. Roggisch" <deets at nospam.web.de> writes:

> Hi,
>
> I'm fiddling around with pydb. Installation and usage are fine. What I
> especially like is the fact that you can attach a signal such that you drop
> into debugging mode on demand.
>
> But this is of limited use to me in situations where a server is written in
> python. According to the source, pydb's debugger class Gdb extends cmd.Cmd.
>
> It passes stdin/stdout-arguments that should be usable to replace the
> standard streams. But so far all my experiments simply dropped the process
> into debugging mode putting out and getting io over stdin/stdout - not my
> self-supplied streams.
>
> So I wonder (being a bit rusty on my UNIX-piping-skillz): how does one do
> that - essentially, create a remote python shell using cmd.Cmd? 
>
> Diez

As part of the 2006 Google Summer of Code project Matt Flemming
started working on remote debugging in pydb. Alas it wasn't completed
and I let the code fall through the cracks. 

Matt claimed it worked to some degree but I could never get it to work
for me. Most definitely the code has atrophied.

The user interface was loosely based or reminiscent of gdb. So
you'd run pydbserver either as a command inside the debugger or as an
option to pydb or call inside Python pdbserver after importing. 

There is a connection class (file pydb/connection.rb) which was to
allow different kinds of protocols, like a socket connection or 
a serial line connection, or maybe even two FIFO's so that you could
connect to a different process on the same computer.

And there were some commands on the user-interaction side
to attach or detach the Python program you want to debug.

If you look in pydb.py.in and gdb.py.in you'll see some code commented
out with double hashes which is part of this effort.

I invite you or others to try to resurrect this effort. However as I
look at the code now, it doesn't make much sense other than the broad
outline given above.

Another approach and possibly a much simpler one if you are looking
for a Python debugger which supports remote debugging is Winpdb
http://winpdb.org/ by Nir Aides.





More information about the Python-list mailing list