Seg Fault

Simon Marlow simonmar@microsoft.com
Wed, 28 Aug 2002 17:27:52 +0100


> Here's what options.h has to say:
>=20
>   /* In a plain Hugs system, most signals (SIGBUS, SIGTERM,=20
> etc) indicate
>    * some kind of error in Hugs - or maybe a stack overflow. =20
> Rather than
>    * just crash, Hugs catches these errors and returns to the=20
> main loop.
>    * It does this by calling a function "panic" which=20
> longjmp's back to the
>    * main loop.
>    * If you're developing a GreenCard library, this may not=20
> 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
>=20
> 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