summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-25 20:50:32 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-25 20:50:32 (GMT)
commit46c86bbca9ba804cdf7478044de94461594e93d5 (patch)
tree0dda12404f833821d566a0e24b3236b5351bb529 /Lib/pdb.py
parentd151d34ebd9f2600b7f9fa5bcb2fa8a59ce7439d (diff)
downloadcpython-46c86bbca9ba804cdf7478044de94461594e93d5.zip
cpython-46c86bbca9ba804cdf7478044de94461594e93d5.tar.gz
cpython-46c86bbca9ba804cdf7478044de94461594e93d5.tar.bz2
A working version of the 'args' command (it prints the current values
of the variables known to hold arguments, but that's as close as I can get, and generally it's close enough).
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 0dc15a2..80aa54b 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -201,10 +201,17 @@ class Pdb(bdb.Bdb, cmd.Cmd):
do_q = do_quit
def do_args(self, arg):
- if self.curframe.f_locals.has_key('__args__'):
- print `self.curframe.f_locals['__args__']`
- else:
- print '*** No arguments?!'
+ f = self.curframe
+ co = f.f_code
+ dict = f.f_locals
+ n = co.co_argcount
+ if co.co_flags & 4: n = n+1
+ if co.co_flags & 8: n = n+1
+ for i in range(n):
+ name = co.co_varnames[i]
+ print name, '=',
+ if dict.has_key(name): print dict[name]
+ else: print "*** undefined ***"
do_a = do_args
def do_retval(self, arg):
@@ -432,7 +439,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
def help_a(self):
print """a(rgs)
- Print the argument list of the current function."""
+ Print the arguments of the current function."""
def help_p(self):
print """p expression