diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2015-11-01 22:53:17 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-11-01 22:53:18 +0100 |
commit | 9fe5497e26902139522b19be81d36ad178a6d611 (patch) | |
tree | 4a7523a64aa5f865a3cd9f5b175a5094f72041dd /rts/RtsMessages.c | |
parent | f46f32b922d7ecbee2829937295521f5db1d7997 (diff) | |
download | haskell-9fe5497e26902139522b19be81d36ad178a6d611.tar.gz |
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
Diffstat (limited to 'rts/RtsMessages.c')
-rw-r--r-- | rts/RtsMessages.c | 12 |
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"); |