Merged revisions 72324 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72324 | georg.brandl | 2009-05-05 11:06:02 +0200 (Di, 05 Mai 2009) | 1 line Fix overlong lines. ........
This commit is contained in:
parent
243ad66ba6
commit
3078df0a25
38
Lib/pdb.py
38
Lib/pdb.py
|
@ -158,10 +158,14 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
self.interaction(frame, None)
|
self.interaction(frame, None)
|
||||||
|
|
||||||
def bp_commands(self,frame):
|
def bp_commands(self,frame):
|
||||||
""" Call every command that was set for the current active breakpoint (if there is one)
|
"""Call every command that was set for the current active breakpoint
|
||||||
Returns True if the normal interaction function must be called, False otherwise """
|
(if there is one).
|
||||||
#self.currentbp is set in bdb.py in bdb.break_here if a breakpoint was hit
|
|
||||||
if getattr(self,"currentbp",False) and self.currentbp in self.commands:
|
Returns True if the normal interaction function must be called,
|
||||||
|
False otherwise."""
|
||||||
|
# self.currentbp is set in bdb in Bdb.break_here if a breakpoint was hit
|
||||||
|
if getattr(self, "currentbp", False) and \
|
||||||
|
self.currentbp in self.commands:
|
||||||
currentbp = self.currentbp
|
currentbp = self.currentbp
|
||||||
self.currentbp = 0
|
self.currentbp = 0
|
||||||
lastcmd_back = self.lastcmd
|
lastcmd_back = self.lastcmd
|
||||||
|
@ -287,7 +291,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
func = getattr(self, 'do_' + cmd)
|
func = getattr(self, 'do_' + cmd)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
func = self.default
|
func = self.default
|
||||||
if func.__name__ in self.commands_resuming : # one of the resuming commands.
|
# one of the resuming commands
|
||||||
|
if func.__name__ in self.commands_resuming:
|
||||||
self.commands_doprompt[self.commands_bnum] = False
|
self.commands_doprompt[self.commands_bnum] = False
|
||||||
self.cmdqueue = []
|
self.cmdqueue = []
|
||||||
return 1
|
return 1
|
||||||
|
@ -300,15 +305,18 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
do_h = cmd.Cmd.do_help
|
do_h = cmd.Cmd.do_help
|
||||||
|
|
||||||
def do_commands(self, arg):
|
def do_commands(self, arg):
|
||||||
"""Defines a list of commands associated to a breakpoint
|
"""Defines a list of commands associated to a breakpoint.
|
||||||
Those commands will be executed whenever the breakpoint causes the program to stop execution."""
|
|
||||||
|
Those commands will be executed whenever the breakpoint causes
|
||||||
|
the program to stop execution."""
|
||||||
if not arg:
|
if not arg:
|
||||||
bnum = len(bdb.Breakpoint.bpbynumber)-1
|
bnum = len(bdb.Breakpoint.bpbynumber)-1
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
bnum = int(arg)
|
bnum = int(arg)
|
||||||
except:
|
except:
|
||||||
print("Usage : commands [bnum]\n ...\n end", file=self.stdout)
|
print("Usage : commands [bnum]\n ...\n end",
|
||||||
|
file=self.stdout)
|
||||||
return
|
return
|
||||||
self.commands_bnum = bnum
|
self.commands_bnum = bnum
|
||||||
self.commands[bnum] = []
|
self.commands[bnum] = []
|
||||||
|
@ -646,8 +654,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
do_n = do_next
|
do_n = do_next
|
||||||
|
|
||||||
def do_run(self, arg):
|
def do_run(self, arg):
|
||||||
"""Restart program by raising an exception to be caught in the main debugger
|
"""Restart program by raising an exception to be caught in the main
|
||||||
loop. If arguments were given, set them in sys.argv."""
|
debugger loop. If arguments were given, set them in sys.argv."""
|
||||||
if arg:
|
if arg:
|
||||||
import shlex
|
import shlex
|
||||||
argv0 = sys.argv[0:1]
|
argv0 = sys.argv[0:1]
|
||||||
|
@ -785,7 +793,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
breaklist = self.get_file_breaks(filename)
|
breaklist = self.get_file_breaks(filename)
|
||||||
try:
|
try:
|
||||||
for lineno in range(first, last+1):
|
for lineno in range(first, last+1):
|
||||||
line = linecache.getline(filename, lineno, self.curframe.f_globals)
|
line = linecache.getline(filename, lineno,
|
||||||
|
self.curframe.f_globals)
|
||||||
if not line:
|
if not line:
|
||||||
print('[EOF]', file=self.stdout)
|
print('[EOF]', file=self.stdout)
|
||||||
break
|
break
|
||||||
|
@ -1279,8 +1288,8 @@ def main():
|
||||||
|
|
||||||
# Note on saving/restoring sys.argv: it's a good idea when sys.argv was
|
# Note on saving/restoring sys.argv: it's a good idea when sys.argv was
|
||||||
# modified by the script being debugged. It's a bad idea when it was
|
# modified by the script being debugged. It's a bad idea when it was
|
||||||
# changed by the user from the command line. There is a "restart" command which
|
# changed by the user from the command line. There is a "restart" command
|
||||||
# allows explicit specification of command line arguments.
|
# which allows explicit specification of command line arguments.
|
||||||
pdb = Pdb()
|
pdb = Pdb()
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
|
@ -1301,7 +1310,8 @@ def main():
|
||||||
print("Running 'cont' or 'step' will restart the program")
|
print("Running 'cont' or 'step' will restart the program")
|
||||||
t = sys.exc_info()[2]
|
t = sys.exc_info()[2]
|
||||||
pdb.interaction(None, t)
|
pdb.interaction(None, t)
|
||||||
print("Post mortem debugger finished. The "+mainpyfile+" will be restarted")
|
print("Post mortem debugger finished. The " + mainpyfile +
|
||||||
|
" will be restarted")
|
||||||
|
|
||||||
|
|
||||||
# When invoked as main program, invoke the debugger on a script
|
# When invoked as main program, invoke the debugger on a script
|
||||||
|
|
Loading…
Reference in New Issue