Check what a running process is doing: print stack trace of an uninstrumented Python program

前端 未结 5 1688
[愿得一人]
[愿得一人] 2021-02-07 02:07

Is there a way on Linux to check what a running Python daemon process is doing? That is, without instrumenting the code and without terminating it? Preferably I\'d like to get t

5条回答
  •  醉话见心
    2021-02-07 03:12

    You can use madbg (by me). It is a python debugger that allows you to attach to a running python program and debug it in your current terminal. It is similar to pyrasite and pyringe, but newer, doesn't require gdb, and uses IPython for the debugger (which means colors and autocomplete).

    To see the stack trace of a running program, you could run:

    madbg attach 
    

    And in the debugger shell, enter: bt

提交回复
热议问题