1:安装调试工具,请参考
https://blog.csdn.net/github_40094105/article/details/81287572
注意用的python版本,debuginfo选择合适的版本包
另外libpython.py也下载对应的版本
2:调试的时候确认自己用的python的版本及路径,venv尤其注意
gdb python路径 -p pid
3:如果出现
python-gdb error: Python Exception <class 'RuntimeError'> Type does not have a target
修改libpython.py
fields = gdb.lookup_type('PyUnicodeObject').target().fields()
to
fields = gdb.lookup_type('PyUnicodeObject').fields()
重新在gdb中source 一下libpython.py 文件
参考:
https://www.cnblogs.com/sting2me/p/7745551.html
https://zhuanlan.zhihu.com/p/353555224
https://www.slideshare.net/amd4ever/debugging-python-with-gdb
https://stackoverflow.com/questions/53084290/python-gdb-error-python-exception-class-runtimeerror-type-does-not-have-a-t