Public
Snippet $296 authored by Kirill Smelkov

pygdbinit (print python-level backtrace to program stdout from-under gdb)

pygdbinit
# print python-level backtrace to program stdout from-under gdb
define xpybt
    set $_gstate = PyGILState_Ensure()
    set $_unused_int  = PyRun_SimpleString("import traceback; f=open('/home/kirr/myfile.log', 'w'); traceback.print_stack(file=f); f.close()")
    set $_unused_void = PyGILState_Release($_gstate)
end

# vim: ft=gdb