[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

python pystack gdb macro

Filed under: Python — Thomas @ 17:06

2010-10-17
17:06

As mentioned before, I ended up getting a working pystack macro again for use in gdb. Someone commented I should make it public so here it is:


# THOMAS: the test for between Py_Main and Py_GetArgcArgv is because
# code is in that order in the C file; see Modules/main.c and its comment
# print the entire Python call stack
# same for eval in Python/ceval.c

# in 2.6, PyEval_EvalFrame is only bw compatible, and code now calls
# PyEval_EvalFrameEx
define pystack
set $__lastpc = $pc
set $__same = -1

while 1 == 1
# select the highest frame with the same $pc
# this will automatically terminate if we reach the top
while $pc == $__lastpc
up-silently
end
down-silently

if $pc > PyEval_EvalFrameEx && $pc < PyEval_EvalCodeEx pyframe else # frame end up-silently 1 set $__lastpc = $pc end select-frame 0 end

I also posted it in the upstream bug but I doubt that's going to achieve much in this case...

1 Comment »

  1. You may like this:

    https://fedoraproject.org/wiki/Features/EasierPythonDebugging

    Comment by Tom Tromey — 2010-10-19 @ 19:32

RSS feed for comments on this post. TrackBack URL

Leave a comment

picture