![](/img/trans.png)
[英]What's the best way to sort class definitions in a python source file?
[英]What's the best way to work with core file in python?
我正在处理一些崩溃报告代码,并且需要从核心转储文件中提取stacktrace。
目前,我正在使用子流程调用:
'gdb -q -batch -nx -x /path/to/executable /path/to/coredump'
并将其内容传递给命令文件:
thread apply all bt full
quit
这工作正常,但我必须解析输出,这似乎有点容易出错。
一种替代方法是使用pygdb2软件包,但是我不确定它是否解决了我感兴趣的问题,因为该软件包的说明中提到了从调试的python进程控制gdb。 https://bitbucket.org/antocuni/pygdb2/
有什么建议吗?
谢谢! 马修
gdb支持运行python命令: https : //sourceware.org/gdb/onlinedocs/gdb/Python-API.html#Python-API
解决方案是仍然将gdb作为子进程运行,但是在cmd文件中,运行python脚本,该脚本将堆栈转储到json文件中。 这比原始文本更容易解析。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.