diff options
author | Skip Montanaro <skip@pobox.com> | 2004-11-17 16:04:15 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2004-11-17 16:04:15 (GMT) |
commit | 0bb2a65dbdbad6731dfc6a942220e4438e393b85 (patch) | |
tree | 3da8de7f787eb7a304e283e9e844db6a79a58c57 /Misc | |
parent | 03562a5e629992676acacc1a241fd5738e2d9496 (diff) | |
download | cpython-0bb2a65dbdbad6731dfc6a942220e4438e393b85.zip cpython-0bb2a65dbdbad6731dfc6a942220e4438e393b85.tar.gz cpython-0bb2a65dbdbad6731dfc6a942220e4438e393b85.tar.bz2 |
split functionality into pystack and pystackv commands. The former will
work with core dumps because it avoids calling any Python API routines. The
latter prints all the local variable values as well as the stack frames but
won't work with core dumps because it relies on _PyObject_Dump to print
variables.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/gdbinit | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Misc/gdbinit b/Misc/gdbinit index 145cc3a..51370e2 100644 --- a/Misc/gdbinit +++ b/Misc/gdbinit @@ -43,12 +43,16 @@ define pylocals end end -# print the current frame +# print the current frame - verbose +define pyframev + pyframe + pylocals +end + define pyframe - set $__fn = PyString_AsString(co->co_filename) - set $__n = PyString_AsString(co->co_name) + set $__fn = (char *)((PyStringObject *)co->co_filename)->ob_sval + set $__n = (char *)((PyStringObject *)co->co_name)->ob_sval printf "%s (%d): %s\n", $__fn, f->f_lineno, $__n - pylocals end # Here's a somewhat fragile way to print the entire Python stack from gdb. @@ -72,3 +76,14 @@ define pystack end select-frame 0 end + +# print the entire Python call stack - verbose mode +define pystackv + while $pc < Py_Main || $pc > Py_GetArgcArgv + if $pc > PyEval_EvalFrame && $pc < PyEval_EvalCodeEx + pyframev + end + up-silently 1 + end + select-frame 0 +end |