geting stack trace from signal handlers

Timothee Cour thelastmammoth at gmail.com
Wed Jun 5 14:05:40 PDT 2013


how do i get a stacktrace inside handleTermination?

If not currently possible, could we have a compile flag that would enable
this kind of feature? (making code slower would be OK, its an opt in
feature)
Ideally we'd also be able to walk up or down the stack trace (kind of what
gdb would do, but I'd like to be able to do that without resorting to gdb,
using a language/library solution)

----

import core.sys.posix.signal;
import std.c.stdlib;
import std.stdio;

void main(string[] args)
{
        bsd_signal(SIGINT, &handleTermination);

        while (true)
        {

        }
}

extern(C) void handleTermination(int signal)
{
        writefln("Caught signal: %s", signal);
        exit(signal);
}

-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130605/0e722d68/attachment.html>


More information about the Digitalmars-d-learn mailing list