summaryrefslogtreecommitdiff
path: root/ghc/runtime/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/runtime/hooks')
-rw-r--r--ghc/runtime/hooks/ErrorHdr.lc10
-rw-r--r--ghc/runtime/hooks/OutOfHeap.lc13
-rw-r--r--ghc/runtime/hooks/OutOfStk.lc10
-rw-r--r--ghc/runtime/hooks/OutOfVM.lc10
-rw-r--r--ghc/runtime/hooks/PatErrorHdr.lc10
-rw-r--r--ghc/runtime/hooks/TraceHooks.lc17
6 files changed, 70 insertions, 0 deletions
diff --git a/ghc/runtime/hooks/ErrorHdr.lc b/ghc/runtime/hooks/ErrorHdr.lc
new file mode 100644
index 0000000000..87435f9901
--- /dev/null
+++ b/ghc/runtime/hooks/ErrorHdr.lc
@@ -0,0 +1,10 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+ErrorHdrHook (where)
+ FILE *where;
+{
+ fprintf(where, "\nFail: ");
+}
+\end{code}
diff --git a/ghc/runtime/hooks/OutOfHeap.lc b/ghc/runtime/hooks/OutOfHeap.lc
new file mode 100644
index 0000000000..22d2b4a4e4
--- /dev/null
+++ b/ghc/runtime/hooks/OutOfHeap.lc
@@ -0,0 +1,13 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+OutOfHeapHook (request_size, heap_size)
+ W_ request_size; /* in bytes */
+ W_ heap_size; /* in bytes */
+{
+ fprintf(stderr, "Heap exhausted;\nwhile trying to allocate %lu bytes in a %lu-byte heap;\nuse `+RTS -H<size>' to increase the total heap size.\n",
+ request_size,
+ heap_size);
+}
+\end{code}
diff --git a/ghc/runtime/hooks/OutOfStk.lc b/ghc/runtime/hooks/OutOfStk.lc
new file mode 100644
index 0000000000..470562117a
--- /dev/null
+++ b/ghc/runtime/hooks/OutOfStk.lc
@@ -0,0 +1,10 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+StackOverflowHook (stack_size)
+ I_ stack_size; /* in bytes */
+{
+ fprintf(stderr, "Stack space overflow: current size %ld bytes.\nUse `+RTS -Ksize' to increase it.\n", stack_size);
+}
+\end{code}
diff --git a/ghc/runtime/hooks/OutOfVM.lc b/ghc/runtime/hooks/OutOfVM.lc
new file mode 100644
index 0000000000..9a33cec8ad
--- /dev/null
+++ b/ghc/runtime/hooks/OutOfVM.lc
@@ -0,0 +1,10 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+MallocFailHook (request_size)
+ I_ request_size; /* in bytes */
+{
+ fprintf(stderr, "malloc: failed on request for %lu bytes\n", request_size);
+}
+\end{code}
diff --git a/ghc/runtime/hooks/PatErrorHdr.lc b/ghc/runtime/hooks/PatErrorHdr.lc
new file mode 100644
index 0000000000..17062fb2db
--- /dev/null
+++ b/ghc/runtime/hooks/PatErrorHdr.lc
@@ -0,0 +1,10 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+PatErrorHdrHook (where)
+ FILE *where;
+{
+ fprintf(where, "\nFail: ");
+}
+\end{code}
diff --git a/ghc/runtime/hooks/TraceHooks.lc b/ghc/runtime/hooks/TraceHooks.lc
new file mode 100644
index 0000000000..a64f9cfe61
--- /dev/null
+++ b/ghc/runtime/hooks/TraceHooks.lc
@@ -0,0 +1,17 @@
+\begin{code}
+#include "rtsdefs.h"
+
+void
+PreTraceHook (where)
+ FILE *where;
+{
+ fprintf(where, "Trace On:\n");
+}
+
+void
+PostTraceHook (where)
+ FILE *where;
+{
+ fprintf(where, "\nTrace Off.\n");
+}
+\end{code}