diff options
author | Christian Tismer <tismer@stackless.com> | 2002-05-28 08:04:00 (GMT) |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2002-05-28 08:04:00 (GMT) |
commit | 313a7513b0c5771042d850d70782a2448d1cdcb7 (patch) | |
tree | c6ef8a458900ef778d90da931b769aaa35fe7dbb /Lib | |
parent | 72de9c7a9c06bfe498c04ef134f510c51a5aef98 (diff) | |
download | cpython-313a7513b0c5771042d850d70782a2448d1cdcb7.zip cpython-313a7513b0c5771042d850d70782a2448d1cdcb7.tar.gz cpython-313a7513b0c5771042d850d70782a2448d1cdcb7.tar.bz2 |
This is a Python 2.1 and 2.2 bugfix candidate:
(or how do I "mark" something to be a candidate?)
fixed an old buglet that caused bdb to be unable to
continue in the botframe, after a breakpoint was set.
the key idea is not to set botframe to the bottom level frame,
but its f_back, which actually might be None.
Additional changes: migrated old exception trick to use
sys._getframe(), which exists both in 2.1 and 2.2 .
Note: I believe Mark Hammond needs to look over his code now.
F5 correctly starts up in the debugger, but later on doesn't stop at a given
breakpoint any longer.
kind regards - chris
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/bdb.py | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -65,7 +65,7 @@ class Bdb: # XXX 'arg' is no longer used if self.botframe is None: # First call of dispatch since reset() - self.botframe = frame + self.botframe = frame.f_back # (CT) Note that this may also be None! return self.trace_dispatch if not (self.stop_here(frame) or self.break_anywhere(frame)): # No need to trace this function @@ -91,8 +91,8 @@ class Bdb: # definition of stopping and breakpoints. def stop_here(self, frame): - if self.stopframe is None: - return True + # (CT) stopframe may now also be None, see dispatch_call. + # (CT) the former test for None is therefore removed from here. if frame is self.stopframe: return True while frame is not None and frame is not self.stopframe: @@ -169,10 +169,7 @@ class Bdb: def set_trace(self): """Start debugging from here.""" - try: - raise Exception - except: - frame = sys.exc_info()[2].tb_frame.f_back + frame = sys._getframe().f_back self.reset() while frame: frame.f_trace = self.trace_dispatch @@ -189,10 +186,7 @@ class Bdb: if not self.breaks: # no breakpoints; run without debugger overhead sys.settrace(None) - try: - raise Exception - except: - frame = sys.exc_info()[2].tb_frame.f_back + frame = sys._getframe().f_back while frame and frame is not self.botframe: del frame.f_trace frame = frame.f_back |