RE: Seg Fault

"Simon Marlow" <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <9584A4A864BD8548932F2F88EB30D1C60A29060D@TVP-MSG-01.europe.corp.microsoft.com>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.