gdb
- 下载libpython.py文件到服务器目录,比如:/root/utils/libpython.py
- 进入gdb命令,加载好libpython
(gdb) python
>import sys
>sys.path.insert(0,"/root/utils")
>import libpython
>end
(gdb) py
py-bt py-down py-locals py-up python-interactive
py-bt-full py-list py-print python
- 这样就可以使用py-xx命令查看python进程数据了
- [https://github.com/python/cpython/blob/3.9/Tools/gdb/libpython.py](https://github.com/python/cpython/blob/3.9/Tools/gdb/libpython.py}
- https://wiki.python.org/moin/DebuggingWithGdb
- https://blog.csdn.net/Once_day/article/details/129721541
- https://blog.csdn.net/le0chang/article/details/130106894
- https://www.cnblogs.com/vincenshen/articles/8470617.html
tracemalloc
pyrasite
- pyrasite可往python进程注入脚本,不过很容易把目标进程搞挂了
- pyrasite-shell可以进入python进程,然后打印程序中全局变量等信息
- https://blog.csdn.net/qq_37264095/article/details/136305067
- https://blog.csdn.net/le0chang/article/details/130106894
objgraph
- 可以把引用关系生成.dot文件,然后用pygraphviz进行可视化
objgraph.show_backrefs(objgraph.by_type('类型名称')[0], max_depth = 10, filename = '文件名称.dot')
pygraphviz
- 可以用来可视化.dot文件
import pygraphviz as pgv
G = pgv.AGraph("文件名称.dot")
G.draw("文件名称.svg", prog="dot")
guppy3
-https://blog.csdn.net/qq_37264095/article/details/136305067
pympler
psutil
meliae
- 最新版只支持到python3.8
- https://blog.csdn.net/le0chang/article/details/130106894