#set print address off define pyp if PyObject_Repr ($arg0) print PyString_AsString(PyObject_Repr($arg0)) end end define pystackreallyold 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) set $__l = PyCode_Addr2Line(f->f_code, f->f_lasti) printf "%s (%d): %s\n", $__fn, $__l, $__n end up-silently 1 end select-frame 0 end define pystackold while $pc < Py_Main || $pc > Py_GetArgcArgv if $pc > PyEval_EvalFrame && $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 define py_printframe set $__f = (PyFrameObject*)$arg0 set $__fn = PyString_AsString($__f->f_code->co_filename) set $__n = PyString_AsString($__f->f_code->co_name) set $__l = PyCode_Addr2Line($__f->f_code, $__f->f_lasti) printf "%s (%d): %s\n", $__fn, $__l, $__n end define pystack set $frame = (PyFrameObject*)PyEval_GetFrame() while $frame py_printframe $frame set $frame = $frame->f_back end end