This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc4: throwing exception from signal handler


VÃclav Haismam wrote:

On Thu, 8 Jul 2010 09:01:41 -0400, "Don Ward" wrote:
I would like to be able to catch certain signals (SIGSEGV and SIGSYS)
and
throw a C++ exception (to be caught in a try/catch construct).  As a
simple
example:
[...]
Am I misunderstanding how this should work or doing something wrong?  Or
is
this a problem with Cygwin or gcc?
I do not think that handling SIGSEGV with an exception is a good idea.

I agree, in general.


Unless you get SIGSEGV as a result of some well thought through memory
management games

But that is what I am doing. I also want to catch SIGSYS to determine whether shmat() is available when we don't know in advance whether cygserver is running. In either case, if the signal is generated I want to catch it and try something else. In these contexts I want to treat SIGSEGV and SIGSYS as non-fatal error returns.


. . .
I am not sure but I do not think that throwing exceptions from signal
handlers is generally supported.

It appears that is what the -fnon-call-exceptions is for. From the gcc-4.3.5 manual:


"-fnon-call-exceptions: Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime support that does not exist everywhere."

I guess one question is whether the runtime support exists in Cygwin 1.7 with gcc 4.3.4.

-- Don W.


-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]