gdb 调试 python
gdb 版本 >7 的 对python调试有特别支持,参考:
https://docs.python.org/devguide/gdb.html?highlight=gdb
https://blog.csdn.net/BaishanCloud/article/details/76422782
可用命令有:
py-bt
py-list
...
示例:
centos7, default python2.7, 自自安装 python3.5,需要在gdb中加载3.5的 libpython.py,本机路径为 /home/cl/python/Python-3.5.3/Tools/gdb
https://stackoverflow.com/questions/14885328/what-is-needed-to-use-gdb-7s-support-for-debugging-python-programs
(gdb) python
>import sys
>sys.path.insert(0, "/home/cl/python/Python-3.5.3/Tools/gdb")
>import libpython
>
end
(gdb) py-bt
...
Notes:
gdb中运行发生死锁、阻塞等情况,导致无法暂停的,可以在外部运行,然后 gdb attach pid
posted on 2017-12-06 09:15 squirrel2300 阅读(271) 评论(0) 编辑 收藏 举报