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

前端 未结 5 1701
[愿得一人]
[愿得一人] 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:06

    on POSIX systems like Linux, you can use good old GDB, see

    • https://t37.net/debug-a-running-python-process-without-printf.html and
    • https://wiki.python.org/moin/DebuggingWithGdb

    There's also the excellent PyCharm IDE (free community version available) that can attach to a running Python process right from within the IDE, using Pdb 4 under the hood, see this blog entry:

    • http://blog.jetbrains.com/pycharm/2015/02/feature-spotlight-python-debugger-and-attach-to-process/

提交回复
热议问题