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


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.
Unless you get SIGSEGV as a result of some well thought through memory
management games, at the point you get SIGSEGV your state is probably so
foobar'd that trying to execute more code can only make it worse. It is
pretty much unrecoverable condition. From diagnostic POV, getting a core
dump with the error state seems better than anything you could do with the
exception.

I am not sure but I do not think that throwing exceptions from signal
handlers is generally supported. Somebody will certainly correct me if I am
wrong.

--
VH


--
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]