user175104
user175104

Reputation: 3696

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

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.

Upvotes: 0

Views: 3361

Answers (1)

John Zwinck
John Zwinck

Reputation: 249592

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.

Upvotes: 1

Related Questions