2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
7 #if __GLASGOW_HASKELL__ >= 400
13 #if __GLASGOW_HASKELL__ >= 408
14 #include "../rts/RtsFlags.h"
21 #if __GLASGOW_HASKELL__ >= 408
22 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
24 #if __GLASGOW_HASKELL__ >= 411
25 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
26 RtsFlags.GcFlags.statsFile = stderr;
31 enableTimingStats( void ) /* called from the driver */
33 #if __GLASGOW_HASKELL__ >= 411
34 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
36 /* ignored when bootstrapping with an older GHC */
40 setHeapSize( HsInt size )
42 #if __GLASGOW_HASKELL__ >= 408
43 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
44 if (RtsFlags.GcFlags.heapSizeSuggestion >
45 RtsFlags.GcFlags.maxHeapSize) {
46 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
51 #if __GLASGOW_HASKELL__ >= 303
54 ErrorHdrHook (long fd)
61 PatErrorHdrHook (long fd)
63 const char msg[]="\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@haskell.org.\n\nFail:";
64 write(fd,msg,sizeof(msg)-1);
68 PreTraceHook (long fd)
70 const char msg[]="\n";
71 write(fd,msg,sizeof(msg)-1);
75 PostTraceHook (long fd)
78 const char msg[]="\n";
79 write(fd,msg,sizeof(msg)-1);
83 #else /* pre-3.03 GHC with old IO system */
86 ErrorHdrHook (FILE *where)
88 fprintf(where, "\n"); /* no "Fail: " */
92 PatErrorHdrHook (FILE *where)
94 fprintf(where, "\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@haskell.org.\n\nFail: ");
98 PreTraceHook (FILE *where)
100 fprintf(where, "\n"); /* not "Trace On" */
104 PostTraceHook (FILE *where)
106 fprintf(where, "\n"); /* not "Trace Off" */
111 #if __GLASGOW_HASKELL__ >= 400
113 OutOfHeapHook (unsigned long request_size, unsigned long heap_size)
116 fprintf(stderr, "GHC's heap exhausted;\nwhile trying to allocate %lu bytes in a %lu-byte heap;\nuse the `-H<size>' option to increase the total heap size.\n",
122 StackOverflowHook (unsigned long stack_size) /* in bytes */
124 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
127 #else /* GHC < 4.00 */
130 OutOfHeapHook (W_ request_size, W_ heap_size) /* both in bytes */
132 fprintf(stderr, "GHC's heap exhausted;\nwhile trying to allocate %lu bytes in a %lu-byte heap;\nuse the `-H<size>' option to increase the total heap size.\n",
138 StackOverflowHook (I_ stack_size) /* in bytes */
140 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);