diff -r 48bd7ec44bbc Lib/pdb.py --- a/Lib/pdb.py Fri Jan 03 16:15:45 2014 -0500 +++ b/Lib/pdb.py Fri Jan 03 20:12:31 2014 -0800 @@ -181,6 +181,10 @@ self.commands_bnum = None # The breakpoint number for which we are # defining a list + # one-time-only breakpoint set with "continue", cleared when prompt + # appears again whether breakpoint is hit or not + self.cont_bp = None + def sigint_handler(self, signum, frame): if self.allow_kbdint: raise KeyboardInterrupt @@ -337,6 +341,10 @@ (expr, newvalue, oldvalue)) def interaction(self, frame, traceback): + if self.cont_bp: + self.cont_bp.deleteMe() + self._prune_breaks(self.cont_bp.file, self.cont_bp.line) + self.cont_bp = None if self.setup(frame, traceback): # no interaction desired at this time (happens if .pdbrc contains # a command like "continue") @@ -1032,9 +1040,19 @@ do_r = do_return def do_continue(self, arg): - """c(ont(inue)) + """c(ont(inue)) [ ([filename:]lineno | function) [, condition] ] Continue execution, only stop when a breakpoint is encountered. + Optionally insert a one-time-only breakpoint at the specified + position. """ + if arg: + nbreaks_before = len(bdb.Breakpoint.bpbynumber) + self.do_break(arg) + if len(bdb.Breakpoint.bpbynumber) > nbreaks_before: + self.cont_bp = self.get_bpbynumber(-1) + else: + # setting breakpoint failed, don't continue + return if not self.nosigint: try: self._previous_sigint_handler = \