summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-11-10 22:27:35 (GMT)
committerGuido van Rossum <guido@python.org>1994-11-10 22:27:35 (GMT)
commita558e37eb4a17540cc6277c4cd571e88d6e60b9d (patch)
treec1259befcf4840ac47eb6b4a93dee31f7de50541 /Lib/pdb.py
parente23b62f28854a9f12412b34a5b971297ad3caf6d (diff)
downloadcpython-a558e37eb4a17540cc6277c4cd571e88d6e60b9d.zip
cpython-a558e37eb4a17540cc6277c4cd571e88d6e60b9d.tar.gz
cpython-a558e37eb4a17540cc6277c4cd571e88d6e60b9d.tar.bz2
improved prompt format
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index a77dd29..30b1477 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -10,6 +10,13 @@ import bdb
import repr
+# Interaction prompt line will separate file and call info from code
+# text using value of line_prefix string. A newline and arrow may
+# be to your liking. You can set it once pdb is imported using the
+# command "pdb.line_prefix = '\n% '".
+# line_prefix = ': ' # Use this to get the old situation back
+line_prefix = '\n-> ' # Probably a better default
+
class Pdb(bdb.Bdb, cmd.Cmd):
def __init__(self):
@@ -55,7 +62,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
def interaction(self, frame, traceback):
self.setup(frame, traceback)
- self.print_stack_entry(self.stack[self.curindex])
+ self.print_stack_entry(self.stack[self.curindex],
+ line_prefix)
self.cmdloop()
self.forget()
@@ -280,13 +288,13 @@ class Pdb(bdb.Bdb, cmd.Cmd):
except KeyboardInterrupt:
pass
- def print_stack_entry(self, frame_lineno):
+ def print_stack_entry(self, frame_lineno, prompt_prefix=''):
frame, lineno = frame_lineno
if frame is self.curframe:
print '>',
else:
print ' ',
- print self.format_stack_entry(frame_lineno)
+ print self.format_stack_entry(frame_lineno, prompt_prefix)
# Help methods (derived from pdb.doc)