Here's what options.h has to say:
/* In a plain Hugs system, most signals (SIGBUS, SIGTERM, etc) indicate * some kind of error in Hugs - or maybe a stack overflow. Rather than * just crash, Hugs catches these errors and returns to the main loop. * It does this by calling a function "panic" which longjmp's back to the * main loop. * If you're developing a GreenCard library, this may not be the right * behaviour - it's better if Hugs leaves them for your debugger to * catch rather than trapping them and "panicing". */ #define DONT_PANIC 0
Most people out there are not using a C debugger to debug Hugs or C code they are calling from Hugs using the ffi so this ought to be turned off by default and only turned on by the few brave and hardy souls who indulge.
Gdb lets you catch signals even if the application has installed handlers for them: see 'help handle' in gdb. I'd just keep DONT_PANIC turned off - but something should probably be done to detect an infinite loop if Hugs immediately seg faults again (maybe it is, I haven't checked the code). Cheers, Simon
Gdb lets you catch signals even if the application has installed handlers for them: see 'help handle' in gdb.
It was Conal Elliott who asked me to add the flag (hmmmm, must have been about 5 years ago now) - he was probably using Visual Studio. Checking the sources, I also noticed that we turn on DONT_PANIC when configured with pthreads turned on. I've no idea why we do this but imagine there's a good reason :-)
I'd just keep DONT_PANIC turned off - but something should probably be done to detect an infinite loop if Hugs immediately seg faults again (maybe it is, I haven't checked the code).
I don't think there is a second check. I think we get away with it because Hugs tends to segfault only during execution of Haskell code (stack overflow or calling a foreign library using the ffi) which tends to leave the interpreter in an ok state. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
participants (2)
-
Alastair Reid -
Simon Marlow