summaryrefslogtreecommitdiff
path: root/rts/hooks/StackOverflow.c
diff options
context:
space:
mode:
authorJavran Cheng <Javran.c@gmail.com>2015-04-17 10:52:00 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2015-04-17 12:06:54 +1000
commit51af102e5c6c56e0987432aa5a21fe10e24090e9 (patch)
tree5e8a94af428f03b981d51e67c050b816f8e5b239 /rts/hooks/StackOverflow.c
parent3b90d8c8cfb4f56cec3eb5e1ede12c22a9e28d79 (diff)
downloadhaskell-51af102e5c6c56e0987432aa5a21fe10e24090e9.tar.gz
Better hints when RTS options not available (Trac #9579)
This patch provides user with a better hint when most RTS options are not available (not compiled with `-rtsopts`). A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to tell the availablity of RTS options. Some concerns: * Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc", "RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply derives Enum instance and reads as of type "CInt". * There are other ways to change RTS options (e.g. `-with-rtsopts`), but it might be too verbose to mention. Test Plan: validate Reviewers: austin, hvr, thomie, simonmar Reviewed By: thomie Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D767 GHC Trac Issues: #9579
Diffstat (limited to 'rts/hooks/StackOverflow.c')
-rw-r--r--rts/hooks/StackOverflow.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/rts/hooks/StackOverflow.c b/rts/hooks/StackOverflow.c
index 1095b1b81d..1ae8603eec 100644
--- a/rts/hooks/StackOverflow.c
+++ b/rts/hooks/StackOverflow.c
@@ -7,11 +7,19 @@
#include "PosixSource.h"
#include "Rts.h"
#include "Hooks.h"
+#include "RtsFlags.h"
#include <stdio.h>
void
StackOverflowHook (W_ stack_size) /* in bytes */
{
- fprintf(stderr, "Stack space overflow: current size %" FMT_Word " bytes.\nUse `+RTS -Ksize -RTS' to increase it.\n", stack_size);
+ fprintf(stderr,
+ "Stack space overflow: current size %" FMT_Word " bytes.\n"
+ "%s `+RTS -Ksize -RTS' to increase it.\n",
+ stack_size,
+ ((rtsConfig.rts_opts_enabled == RtsOptsAll)
+ ? "Use"
+ : "Relink with -rtsopts and use")
+ );
}