geting stack trace from signal handlers

nazriel spam at dzfl.pl
Fri Jun 7 00:39:06 PDT 2013


On Thursday, 6 June 2013 at 21:50:58 UTC, Timothee Cour wrote:
> Great!
> two issues (on OSX at least):
>
> A)
> it seems the top-most element of the call stack gets chopped 
> off; eg in
> your code, the main_module.main symbol will not appear in the 
> stack trace.
> Any idea why or how to fix that?
> Is that some inlining issue ? I tried with dmd -g, or -gs or 
> -gc.
> This can be annoying when the top-most function is a large 
> function and
> it's not at all clear where the code stopped.
>
I haven't got Mac OSX to test it out but I fixed it a little bit 
so it is less hacky:

http://dpaste.dzfl.pl/241c6fb5

Compiler switches you may want to consider are:
-gc -L--export-dynamic -O0

> B)
> there are no line numbers. I did a complex workaround by 
> launching a
> process and calling atos to get those, but isn't there a better 
> way?
>
Yeah, it is a complex issue. There are 2 ways to fix it from what 
I know.
1) pipe addresses to addr2line - easier
2) use libdwarf - more complex but also more out-of-box solution
>


More information about the Digitalmars-d-learn mailing list