On Mon, 2004-03-01 at 10:09, Skip Montanaro wrote: > >> So, how can I figure out where in the Python source the function call > >> is coming from using gdb? I'm sure it involves "print" and some > >> casts.. I couldn't find a howto on python.org > > Jeremy> First, make sure that the code from Misc/gdbinit is in your > Jeremy> .gdbinit file. Get the stack trace in gdb and move up/down > Jeremy> until you get to an eval_frame() frame. Then call the function > Jeremy> pyframe. It will print the filename, function name, and line > Jeremy> number of the current frame. The lineno usually points to the > Jeremy> first line of the function. > > I have this in my .gdbinit file: > > define ppystack > 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 That's nice! I never learned how to write real programs in gdb. You should add a copy to gdbinit. Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4