[Chandler-dev] "pystack" in gdb for Python 2.5

Grant Baillie grant at osafoundation.org
Thu Jan 18 18:12:46 PST 2007

Yesterday, I was trying to get the Python gdb macros to work in  
Chandler's python, and finding that the very handy "pystack" command  
wasn't working at all.

Anyway, I figured out a tweak to the "pystack" macro that got things  
to work for me. The patch is below for anyone else who needs it; I'm  
not sure if it fixes a typo, or if the bug is a result of symbols  
shifting around in the python 2.5 binary. I'll probably follow up on  
the python IRC channel at some point.


--- external/python/Python-2.5/Misc/gdbinit 2005-09-05  
09:16:49.000000000 -0700
+++ /Users/grant/.gdbinit       2007-01-17 18:08:03.000000000 -0800
@@ -120,7 +120,7 @@
# print the entire Python call stack
define pystack
      while $pc < Py_Main || $pc > Py_GetArgcArgv
-        if $pc > PyEval_EvalFrame && $pc < PyEval_EvalCodeEx
+        if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx
          up-silently 1

More information about the chandler-dev mailing list