how to generate a stack trace from a core dump file in C, without invoking an external tool such as gdb

南笙酒味 提交于 2019-12-12 02:21:07

问题


I am looking for a simple way to pull the stack trace out of a Linux core dump file programmatically, without having to invoke gdb. Anybody has an idea?

To avoid confusion: I am not looking for a way to get my own back trace from inside a process. I am looking for a way to get a backtrace out of a completely independent core dump file I have.


回答1:


If you really can't invoke gdb, but want a backtrace like the ones it provides, you could just copy the bits of gdb's source that are needed for that into your project. Obviously just invoking gdb will be easier, more maintainable, and less eyebrow-raising, so maybe you should just do that.



来源:https://stackoverflow.com/questions/7944768/how-to-generate-a-stack-trace-from-a-core-dump-file-in-c-without-invoking-an-ex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!