[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye
report at bugs.python.org
Mon Apr 30 22:00:55 CEST 2012
Xavier de Gaye <xdegaye at gmail.com> added the comment:
Hi Senthil,
Thanks for your help with this issue.
self.frame_returning is both a flag to indicate that we are returning
from the current frame and a value (the current frame). We need both
as set_step() (the method invoked when the user runs the step command)
does not know the current frame and wether we are returning from the
current frame.
Here is a raw sketch of the call chain in the case where the user
types the step command on returning from the current frame (Pdb
subclasses both bdb.Bdb and cmd.Cmd):
Bdb::dispatch_return
Pdb::user_return (Bdb overriden method)
Pdb::interaction
Cmd::cmdloop
Cmd::onecmd
Pdb::do_step
Bdb::set_step
So self.frame_returning must be set to None after the call to
self.user_return() so that its value is not used in another later step
command, where we are not returning from this frame. Actually it is
more explicit and more robust to use a try-finally clause, such as:
def dispatch_return(self, frame, arg):
if self.stop_here(frame) or frame == self.returnframe:
try:
self.frame_returning = frame
self.user_return(frame, arg)
finally:
self.frame_returning = None
if self.quitting: raise BdbQuit
return self.trace_dispatch
Xavier
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13183>
_______________________________________
More information about the Python-bugs-list
mailing list