python/dist/src/Misc gdbinit,1.3,1.4

Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28338/Misc Modified Files: gdbinit Log Message: Add pystack definition to Misc/gdbinit with some explanation of its behavior and add flag comments to ceval.c and main.c alerting people to the coupling between pystack and the layout of those files. Index: gdbinit =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/gdbinit,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gdbinit 3 Oct 2003 20:56:15 -0000 1.3 --- gdbinit 1 Mar 2004 15:44:05 -0000 1.4 *************** *** 35,36 **** --- 35,59 ---- p f->f_lineno end + + # Here's a somewhat fragile way to print the entire Python stack from gdb. + # It's fragile because the tests for the value of $pc depend on the layout + # of specific functions in the C source code. + + # Explanation of while and if tests: We want to pop up the stack until we + # land in Py_Main (this is probably an incorrect assumption in an embedded + # interpreter, but the test can be extended by an interested party). If + # Py_Main <= $pc <= Py_GetArgcArv is true $pc is in Py_Main(), so the while + # tests succeeds as long as it's not true. In a similar fashion the if + # statement tests to see if we are in eval_frame(). + + define pystack + while $pc < Py_Main || $pc > Py_GetArgcArgv + if $pc > eval_frame && $pc < PyEval_EvalCodeEx + set $__fn = PyString_AsString(co->co_filename) + set $__n = PyString_AsString(co->co_name) + printf "%s (%d): %s\n", $__fn, f->f_lineno, $__n + end + up-silently 1 + end + select-frame 0 + end
participants (1)
-
montanaroļ¼ users.sourceforge.net