This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: gcc4: throwing exception from signal handler
- From: VÃclav Haisman <v dot haisman at sh dot cvut dot cz>
- To: Don Ward <don2387ward at sprynet dot com>
- Cc: <cygwin at cygwin dot com>
- Date: Thu, 08 Jul 2010 15:27:00 +0200
- Subject: Re: gcc4: throwing exception from signal handler
- References: <346D8CF793D04BC99A972949F9555CC3@amber>
- Reply-to: cygwin at cygwin dot com
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