Commit 9fe5497e authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

rts: Produce stack trace on fatal error

Test Plan: Validate

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: simonmar, thomie, scpmw

Differential Revision: https://phabricator.haskell.org/D1418
parent f46f32b9
......@@ -11,6 +11,10 @@
#include "eventlog/EventLog.h"
#if USE_LIBDW
#include <Libdw.h>
#endif
#include <stdio.h>
#include <string.h>
#include <errno.h>
......@@ -157,6 +161,14 @@ rtsFatalInternalErrorFn(const char *s, va_list ap)
fprintf(stderr, "internal error: ");
}
vfprintf(stderr, s, ap);
#if USE_LIBDW
fprintf(stderr, "\n");
fprintf(stderr, "Stack trace:");
LibdwSession *session = libdwInit();
Backtrace *bt = libdwGetBacktrace(session);
libdwPrintBacktrace(session, stderr, bt);
libdwFree(session);
#endif
fprintf(stderr, "\n");
fprintf(stderr, " (GHC version %s for %s)\n", ProjectVersion, xstr(HostPlatform_TYPE));
fprintf(stderr, " Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment