Gdb mode for rpdb2

21 views
Skip to first unread message

LRN

unread,
Apr 23, 2011, 6:07:28 AM4/23/11
to win...@googlegroups.com
The attached patch adds a 'gdb' command to rpdb. It enables gdb mode.
Well, maybe 'gdb' is not a good name, but since my motivation was to
make rpdb2 more gdb-like, it will do for now.
Changes in this mode:
1) pressing 'Enter' (entering empty line) will repeat last command
(actually, this is default behaviour for cmd module, i have no idea why
rpdb2 disables it)
2) whenever the debugger breaks it will print current line. That happens
after 'n' and 's' commands, when 'g' ends on a breakpoint, etc. The
presentation is not handled very well, because rpdb2 won't wait for this
to happen and will display another prompt, which will then be overridden
by the line being printed, if the break didn't happen immediately, and
the command the user will be entering next will start at a new (empty)
line (or, if you're unlucky, the line will be printed in the middle of
whatever you've been typing). But in practice this shouldn't be much of
a problem (and fixing that might require cmd module hacking, which is
not a good thing, so i'd let it be).

The patch is tested on Windows with Python 3.2.

rpdb2.py.gdbmode.patch

Nir Aides

unread,
Apr 23, 2011, 1:03:19 PM4/23/11
to win...@googlegroups.com
Hi LRN,

Thanks for the patch.

Winpdb should be compatible with Python 2.5 as minimum, preferably with Python 2.4 (I occasionally hack a centos machine with Python 2.4); scanning through the code I see a potential problem with string formatting.

Nir




--
You received this message because you are subscribed to the Google Groups "Winpdb" group.
To post to this group, send email to win...@googlegroups.com.
To unsubscribe from this group, send email to winpdb+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/winpdb?hl=en.


LRN

unread,
Apr 24, 2011, 6:05:15 AM4/24/11
to Winpdb
On Apr 23, 9:03 pm, Nir Aides <n...@winpdb.org> wrote:
> On Sat, Apr 23, 2011 at 1:07 PM, LRN <lrn1...@gmail.com> wrote:
> > The attached patch adds a 'gdb' command to rpdb. It enables gdb mode.
> > Well, maybe 'gdb' is not a good name, but since my motivation was to make
> > rpdb2 more gdb-like, it will do for now.
> > Changes in this mode:
> > 1) pressing 'Enter' (entering empty line) will repeat last command
> > (actually, this is default behaviour for cmd module, i have no idea why
> > rpdb2 disables it)
> > 2) whenever the debugger breaks it will print current line. That happens
> > after 'n' and 's' commands, when 'g' ends on a breakpoint, etc. The
> > presentation is not handled very well, because rpdb2 won't wait for this to
> > happen and will display another prompt, which will then be overridden by the
> > line being printed, if the break didn't happen immediately, and the command
> > the user will be entering next will start at a new (empty) line (or, if
> > you're unlucky, the line will be printed in the middle of whatever you've
> > been typing). But in practice this shouldn't be much of a problem (and
> > fixing that might require cmd module hacking, which is not a good thing, so
> > i'd let it be).
>
> > The patch is tested on Windows with Python 3.2.
>
> Hi LRN,
>
> Thanks for the patch.
>
> Winpdb should be compatible with Python 2.5 as minimum, preferably with
> Python 2.4 (I occasionally hack a centos machine with Python 2.4); scanning
> through the code I see a potential problem with string formatting.
>
> Nir
I originally wrote it with 3.2 "".format()-style formatting, but later
(seeing that winpdb still maintains 2.x compatibility) changed the
patch to use 2.x "" % {}-style formatting instead. Unfortunately, as
i've learned later, the change was not complete - it says "{gdb_mode}"
instead of "(gdb_mode)".
But otherwise it should work with 2.x (unless there are some 2.6/2.7-
only things that are so commonplace that i didn't notice adding them).
Reply all
Reply to author
Forward
0 new messages