PDB does not allow jumping to first statement?

Chris Lasher chris.lasher at gmail.com
Tue Mar 27 15:50:37 EDT 2007


On Mar 27, 5:59 am, "rocky.bernst... at gmail.com"
<rocky.bernst... at gmail.com> wrote:
> I tried on GNU/Linux and Python versions 2.4 and 2.5 and get the same
> behavior. Best as I can tell, it looks like a bug in Python. pdb,
> pydb, rpdb2 all handle the "jump" command by changing the frame
> f_lineno value. When the corresponding code pointer has offset 0 (or
> equivalently and more simlply as you put it, is the first statement)
> this doesn't seem to work properly. But this also implies that all you
> need to do is add something as the first statement. A docstring
> comment, e.g.
> "this is what my program does..."
> comes to mind :-)

I started implementing this, but it's a hack. Looks like it's time for
me to file a bug report!

> Lastly, I'll mention that I what most folks want to do is not jump to
> the beginning of the program but rather *restart* it. The difference
> here as applied to your example is seen in the way variables (e.g. a,
> b, and c) are handled. In a "restart", those names would go back to
> being undefined and referring to them before assigning to them would
> cause a NameError exception. With "jump", they retain their existing
> values.

In the case I was working with, I really did want to "jump" and retain
the values, rather than restart and clear those values.

Just as an aside, Rocky, I really like your ShowMeDo on pydb. Thanks
for making that. (For those who haven't seen it, check out the
"Introducing the pydb Debugger" at <http://showmedo.com/videos/Python>)




More information about the Python-list mailing list