Using ptrace to generate a stack dump

Posted by Gomez on Stack Overflow See other posts from Stack Overflow or by Gomez
Published on 2010-04-27T20:11:27Z Indexed on 2010/04/27 20:13 UTC
Read the original article Hit count: 492

Filed under:
|
|
|
|

Hello.

I am compiling C++ on *nix and I would like to generate a stack dump a) at an arbitrary point in the program, b) during any signal, particularly during SIGSEGV.

Google tells me that ptrace is probably the tool for the job, but I can't find any comprehensible examples of walking the stack. Getting the return address, yeah, but what about the NEXT return address? And what about extracting the symbolic name of the function at that point? Something to do with DWARF?

Many thanks if you can tell me where to go from here.

© Stack Overflow or respective owner

Related posts about c

    Related posts about unix