]> granicus.if.org Git - python/commitdiff
A helper to dump info about the current frame,
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 3 Oct 2003 20:56:15 +0000 (20:56 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 3 Oct 2003 20:56:15 +0000 (20:56 +0000)
assuming it is the variable f.

Misc/gdbinit

index ae333b2686f163e4e1dd9fcef998fd35b37b0c93..05f6a9151c59313e3cd30ce8653f0edc0008ebe1 100644 (file)
@@ -25,3 +25,12 @@ end
 define pyg
 print _PyGC_Dump($arg0)
 end
+
+# If you are in an eval_frame() function, calling pyframe with no
+# arguments will print the filename, function name, and line number.
+# It assumes that f is the name of the current frame.
+define pyframe
+x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval
+x/s ((PyStringObject*)f->f_code->co_name)->ob_sval
+p f->f_lineno
+end