PDB does not allow jumping to first statement?

rocky.bernstein at gmail.com rocky.bernstein at gmail.com
Thu Mar 29 08:37:31 EDT 2007


On Mar 28, 6:05 pm, "Chris Lasher" <chris.las... at gmail.com> wrote:
> I have submitted this as a bug via SourceForge:
> <https://sourceforge.net/tracker/?
> func=detail&atid=105470&aid=1689458&group_id=5470>
> or if munged
> <http://tinyurl.com/2nwxsf>
>
> ThePythonfolks would like a test case and/or a patch. This is well
> beyond my ken as a humblePythonuser. Could anybody more
> knowledgeable please contribute one or both? Duncan or Rocky, would
> you be able to spare time and effort?
>
> Chris

First and foremost, thanks for submitting the bug report!

Alas, I don't use Python much anymore in day-to-day activities. Ruby
rules! However some weekend (when I'm not doing work) I'll try to find
time to conjure up an example.

But here's a sketch of how I think a small test case would work. One
would use sys.settrace() to set up the mechanism to get the current
frame after each statement gets run. In the function, say bugcheck(),
which used as the hook given to sys.settrace(), if the caller's
f_lineno is not the first statement, one would set it to the first
statement noting that the reassignment has happened so we don't loop
indefinitely. Then one would return from the function which will let
the program do a step and check what value of f_lineno appears in the
subsequent calls of bugcheck().

Alternatively one could write a .pdbrc which basically issues the
"step" and "jump" commands and prints out the line number. (In pydb or
gdb the command to print the current line would be  "info line"; in
pdb I'm not sure what the best command is - "list"?, "bt?




More information about the Python-list mailing list