Python’s Misc/gdbinit provides a helper to print the Python call stack. Because of some assumptions it makes, it won’t work for any thread except the main thread. This patch fixes that:
Index: gdbinit
===================================================================
--- gdbinit (revision 53403)
+++ gdbinit (working copy)
@@ -119,7 +119,7 @@
# print the entire Python call stack
define pystack
- while $pc < Py_Main || $pc > Py_GetArgcArgv
+ while ($pc < Py_Main || $pc > Py_GetArgcArgv) && ($pc < t_bootstrap || $pc > thread_PyThread_start_new_thread)
if $pc > PyEval_EvalFrame && $pc < PyEval_EvalCodeEx
pyframe
end
A similar change is required for pystackv.