[commit: ghc] master: rts: Produce stack trace on fatal error (9fe5497)
git at git.haskell.org
git at git.haskell.org
Sun Nov 1 21:53:29 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9fe5497e26902139522b19be81d36ad178a6d611/ghc
>---------------------------------------------------------------
commit 9fe5497e26902139522b19be81d36ad178a6d611
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Sun Nov 1 22:53:17 2015 +0100
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
>---------------------------------------------------------------
9fe5497e26902139522b19be81d36ad178a6d611
rts/RtsMessages.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c
index c74e338..0440669 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");
More information about the ghc-commits
mailing list