[pypy-commit] pypy default: a somewhat hacky Pdb+ command "findv" to find variables of certain names
cfbolz
noreply at buildbot.pypy.org
Wed Aug 20 17:13:29 CEST 2014
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r72933:7373380c07d3
Date: 2014-08-20 17:10 +0200
http://bitbucket.org/pypy/pypy/changeset/7373380c07d3/
Log: a somewhat hacky Pdb+ command "findv" to find variables of certain
names (default is "graph")
diff --git a/rpython/translator/tool/pdbplus.py b/rpython/translator/tool/pdbplus.py
--- a/rpython/translator/tool/pdbplus.py
+++ b/rpython/translator/tool/pdbplus.py
@@ -196,6 +196,30 @@
return
self._show(page)
+ def do_findv(self, varname):
+ """ findv [varname]
+find a stack frame that has a certain variable (the default is "graph")
+"""
+ if not varname:
+ varname = "graph"
+ printfr = self.print_stack_entry
+ self.print_stack_entry = lambda *args: None
+ try:
+ num = 0
+ while self.curindex:
+ frame = self.curframe
+ if varname in frame.f_locals:
+ printfr(self.stack[self.curindex])
+ print "%s = %s" % (varname, frame.f_locals[varname])
+ return
+ num += 1
+ self.do_up(None)
+ print "no %s found" % (varname, )
+ for i in range(num):
+ self.do_down(None)
+ finally:
+ del self.print_stack_entry
+
def _attrs(self, arg, pr):
arg, expr = self._parse_modif(arg, 'match')
if expr == '_':
More information about the pypy-commit
mailing list