summaryrefslogtreecommitdiff
path: root/rts/hooks/StackOverflow.c
blob: 34dd9f64abbf136a55c86575735d2f4236448add (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* -----------------------------------------------------------------------------
 *
 * User-overridable RTS hooks.
 *
 * ---------------------------------------------------------------------------*/

#include "rts/PosixSource.h"
#include "Rts.h"
#include "Hooks.h"
#include "RtsFlags.h"

#include <stdio.h>

void
StackOverflowHook (W_ stack_size)    /* in bytes */
{
    errorBelch("Stack space overflow: current size %" FMT_Word " bytes.",
               stack_size);

    if (rtsConfig.rts_opts_suggestions == true) {
        if (rtsConfig.rts_opts_enabled == RtsOptsAll) {
            errorBelch("Use `+RTS -Ksize -RTS' to increase it.");
        } else {
            errorBelch("Relink with -rtsopts and "
                       "use `+RTS -Ksize -RTS' to increase it.");
        }
    }
}