[Python-checkins] python/dist/src/Misc gdbinit,1.7,1.8

montanaro at users.sourceforge.net montanaro at users.sourceforge.net
Wed Nov 17 17:04:19 CET 2004


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15720

Modified Files:
	gdbinit 
Log Message:
split functionality into pystack and pystackv commands.  The former will
work with core dumps because it avoids calling any Python API routines.  The
latter prints all the local variable values as well as the stack frames but
won't work with core dumps because it relies on _PyObject_Dump to print
variables.



Index: gdbinit
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/gdbinit,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gdbinit	7 Aug 2004 20:11:22 -0000	1.7
+++ gdbinit	17 Nov 2004 16:04:15 -0000	1.8
@@ -43,12 +43,16 @@
     end
 end
 
-# print the current frame
+# print the current frame - verbose
+define pyframev
+    pyframe
+    pylocals
+end
+
 define pyframe
-    set $__fn = PyString_AsString(co->co_filename)
-    set $__n = PyString_AsString(co->co_name)
+    set $__fn = (char *)((PyStringObject *)co->co_filename)->ob_sval
+    set $__n = (char *)((PyStringObject *)co->co_name)->ob_sval
     printf "%s (%d): %s\n",  $__fn, f->f_lineno, $__n
-    pylocals
 end
 
 # Here's a somewhat fragile way to print the entire Python stack from gdb.
@@ -72,3 +76,14 @@
     end
     select-frame 0
 end
+
+# print the entire Python call stack - verbose mode
+define pystackv
+    while $pc < Py_Main || $pc > Py_GetArgcArgv
+        if $pc > PyEval_EvalFrame && $pc < PyEval_EvalCodeEx
+	    pyframev
+        end
+        up-silently 1
+    end
+    select-frame 0
+end



More information about the Python-checkins mailing list