diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/bdb.py | 33 | ||||
-rw-r--r-- | Lib/pdb.doc | 5 | ||||
-rwxr-xr-x | Lib/pdb.py | 13 |
3 files changed, 35 insertions, 16 deletions
diff --git a/Lib/bdb.py b/Lib/bdb.py index a5a3a19b9e..74870e3f51 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -37,9 +37,7 @@ class Bdb: import linecache linecache.checkcache() self.botframe = None - self.stopframe = None - self.returnframe = None - self.quitting = 0 + self._set_stopinfo(None, None) def trace_dispatch(self, frame, event, arg): if self.quitting: @@ -100,7 +98,7 @@ class Bdb: # (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 + return frame.f_lineno >= self.stoplineno while frame is not None and frame is not self.stopframe: if frame is self.botframe: return True @@ -157,26 +155,31 @@ class Bdb: but only if we are to stop at or just below this level.""" pass + def _set_stopinfo(self, stopframe, returnframe, stoplineno=-1): + self.stopframe = stopframe + self.returnframe = returnframe + self.quitting = 0 + self.stoplineno = stoplineno + # Derived classes and clients can call the following methods # to affect the stepping state. + def set_until(self, frame): #the name "until" is borrowed from gdb + """Stop when the line with the line no greater than the current one is + reached or when returning from current frame""" + self._set_stopinfo(frame, frame, frame.f_lineno+1) + def set_step(self): """Stop after one line of code.""" - self.stopframe = None - self.returnframe = None - self.quitting = 0 + self._set_stopinfo(None,None) def set_next(self, frame): """Stop on the next line in or below the given frame.""" - self.stopframe = frame - self.returnframe = None - self.quitting = 0 + self._set_stopinfo(frame, None) def set_return(self, frame): """Stop when returning from the given frame.""" - self.stopframe = frame.f_back - self.returnframe = frame - self.quitting = 0 + self._set_stopinfo(frame.f_back, frame) def set_trace(self, frame=None): """Start debugging from `frame`. @@ -195,9 +198,7 @@ class Bdb: def set_continue(self): # Don't stop except at breakpoints or when finished - self.stopframe = self.botframe - self.returnframe = None - self.quitting = 0 + self._set_stopinfo(self.botframe, None) if not self.breaks: # no breakpoints; run without debugger overhead sys.settrace(None) diff --git a/Lib/pdb.doc b/Lib/pdb.doc index c5139548b9..1cd2f192cd 100644 --- a/Lib/pdb.doc +++ b/Lib/pdb.doc @@ -128,6 +128,11 @@ n(ext) Continue execution until the next line in the current function is reached or it returns. +unt(il) + Continue execution until the line with a number greater than the + current one is reached or until the current frame returns + + r(eturn) Continue execution until the current function returns. diff --git a/Lib/pdb.py b/Lib/pdb.py index 10303c8c97..86162025f8 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -612,6 +612,11 @@ class Pdb(bdb.Bdb, cmd.Cmd): self.lineno = None do_d = do_down + def do_until(self, arg): + self.set_until(self.curframe) + return 1 + do_unt = do_until + def do_step(self, arg): self.set_step() return 1 @@ -962,6 +967,14 @@ i.e., the breakpoint is made unconditional.""" Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function).""" + def help_until(self): + self.help_unt() + + def help_unt(self): + print """unt(il) +Continue execution until the line with a number greater than the current +one is reached or until the current frame returns""" + def help_next(self): self.help_n() |