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 Subject: Re: gcc4: throwing exception from signal handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Date: Thu, 08 Jul 2010 15:27:00 +0200 From: =?UTF-8?Q?V=C3=A1clav_Haisman?= Cc: 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 Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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