summaryrefslogtreecommitdiff
path: root/rts/RtsMessages.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/RtsMessages.c')
-rw-r--r--rts/RtsMessages.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c
index c74e3387f1..0440669986 100644
--- a/rts/RtsMessages.c
+++ b/rts/RtsMessages.c
@@ -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");