delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/08/09:27:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Spam-Score: -1.001
To: Don Ward <don2387ward AT sprynet DOT com>
Subject: Re: gcc4: throwing exception from signal handler
MIME-Version: 1.0
Date: Thu, 08 Jul 2010 15:27:00 +0200
From: =?UTF-8?Q?V=C3=A1clav_Haisman?= <v DOT haisman AT sh DOT cvut DOT cz>
Cc: <cygwin AT cygwin DOT com>
In-Reply-To: <346D8CF793D04BC99A972949F9555CC3@amber>
References: <346D8CF793D04BC99A972949F9555CC3 AT amber>
Message-ID: <7e6495952c8c6ba0be89f784d7fcfe1e@shell.sh.cvut.cz>
X-Sender: v DOT haisman AT sh DOT cvut DOT cz
User-Agent: RoundCube Webmail/0.4-beta
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019