Throwing C++ exceptions from signal handlers

Andrew Haley aph@redhat.com
Thu Jun 10 09:28:00 GMT 2004


Yuval Kfir writes:
 > >  > is it possible to somehow convince gcc to properly throw an exception
 > from a
 > >  > signal handler context?
 > >
 > > Yes, but only with synchronous exceptions like SIGSEGV and SIGFPE.
 > 
 > That's good news - but how? How should I modify the sample program so that
 > it won't abort with gcc? Or should I use different flags?

  -fnon-call-exceptions       Support synchronous non-call exceptions

This doesn't work on all architectures, and you might also need to do
some special work in the signal handlers.  Look at libjava/include for
guidance.

Andrew.



More information about the Gcc mailing list