Index: [thread] [date] [subject] [author]
  From: Ville Hallik <ville@tartu.cyber.ee>
  To  : ggi-develop@eskimo.com
  Date: Wed, 14 Jul 1999 09:19:02 +0300 (EEST)

Re: hacking methods to find out bugs

On Tue, 13 Jul 1999, Steve Cheng wrote:

> On Tue, 13 Jul 1999, Christoph Egger wrote:
> 
> > > void crash( int sig ) {
> > >   fprintf( stderr, "SIGSEGV received\n" );
> 
> I just thought of this: C library functions are NOT guaranteed to be
> reentrant, and according to ANSI C signal() is the only library function
> that you may call in a signal handler.  
> 
> You can get away with it with GNU libc or even most Unix libcs, but it's
> just something to be aware of in portable code.

Of course, it's not a good idea to do anything except setting some atomic
variables in signal handler. Unfortunately, this wont work for handling
SIGSEGV and friends because You can't return to the main loop to test
these variables. Anyway, it's a good idea to do all required cleanups
before using fprintf() to print a diagnostic message about crash.

-- 

Ville Hallik   +372-52-77891
http://home.cyber.ee/~ville/

Index: [thread] [date] [subject] [author]