--- /usr/lib/python2.6/pdb.py 2010年04月16日 06:59:14.000000000 -0700 +++ pdb_new.py 2010年06月24日 07:30:05.840547179 -0700 @@ -605,23 +605,45 @@ do_bt = do_where def do_up(self, arg): - if self.curindex == 0: - print>>self.stdout, '*** Oldest frame' - else: - self.curindex = self.curindex - 1 + nup = 1 + if arg: + try: + nup = int(arg) + if nup < 0: + nup = self.curindex + except: + pass + + for _ignore in xrange(nup): + if self.curindex is 0: + print>>self.stdout, '*** Oldest frame' + break + self.curindex -= 1 self.curframe = self.stack[self.curindex][0] - self.print_stack_entry(self.stack[self.curindex]) self.lineno = None + self.print_stack_entry(self.stack[self.curindex]) + do_u = do_up def do_down(self, arg): - if self.curindex + 1 == len(self.stack): - print>>self.stdout, '*** Newest frame' - else: - self.curindex = self.curindex + 1 + ndown = 1 + if arg: + try: + ndown = int(arg) + if ndown < 0: + ndown = len(self.stack) - self.curindex + except: + pass + + for _ignore in xrange(ndown): + if self.curindex + 1 is len(self.stack): + print>>self.stdout, '*** Newest frame' + break + self.curindex += 1 self.curframe = self.stack[self.curindex][0] - self.print_stack_entry(self.stack[self.curindex]) self.lineno = None + self.print_stack_entry(self.stack[self.curindex]) + do_d = do_down def do_until(self, arg): @@ -898,17 +920,17 @@ self.help_d() def help_d(self): - print>>self.stdout, """d(own) -Move the current frame one level down in the stack trace -(to a newer frame).""" + print>>self.stdout, """d(own) [#steps] +Move the current frame #steps levels (default 1) down (towards newer frames) +in the stack trace. If #steps is -1, move to bottom of trace.""" def help_up(self): self.help_u() def help_u(self): - print>>self.stdout, """u(p) -Move the current frame one level up in the stack trace -(to an older frame).""" + print>>self.stdout, """u(p) [#steps] +Move the current frame #steps levels (default 1) up (towards older frames) +in the stack trace. If #steps is -1, move to top of trace.""" def help_break(self): self.help_b()

AltStyle によって変換されたページ (->オリジナル) /