From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7337 invoked by alias); 9 Mar 2005 17:40:20 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7278 invoked from network); 9 Mar 2005 17:40:16 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 9 Mar 2005 17:40:16 -0000 Received: from drow by nevyn.them.org with local (Exim 4.44 #1 (Debian)) id 1D95AN-0004au-PY for ; Wed, 09 Mar 2005 12:40:15 -0500 Date: Wed, 09 Mar 2005 17:40:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [RFA] exceptions.h: Fix definition of TRY_CATCH Message-ID: <20050309174015.GA17510@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20050309164803.GN2839@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050309164803.GN2839@cygbert.vinschen.de> User-Agent: Mutt/1.5.6+20040907i X-SW-Source: 2005-03/txt/msg00147.txt.bz2 On Wed, Mar 09, 2005 at 05:48:03PM +0100, Corinna Vinschen wrote: > If you inspect it, you'll see that the first parameter `env' is evaluated > three times. Since the first parameter is a call to the function > exceptions_state_mc_init(), the result is that three new catcher structures > are created. But only one of them, the last one which has been created, > is correctly iniitialized by the call to exceptions_state_mc_action_iter(). > I guess you see what will happen at one point. A non-initialized catcher > is current when the function exceptions_state_mc_action_iter_1() is called > ==> internal_error. > > Note that this is *not* a flaw in newlib or Cygwin. It's perfectly fine > that setjmp and sigsetjmp are defined as macros as above, see > http://www.opengroup.org/onlinepubs/009695399/functions/setjmp.html and > http://www.opengroup.org/onlinepubs/009695399/functions/sigsetjmp.html, > so the usual macro expansion restrictions apply. > > Conclusion: The actual problem is that the sigjmp_buf is created in a > function call which is the first parameter to sigsetjmp. Nice catch! > Solution: Don't do it. :-) > > A patch is below. Tested on Cygwin and Linux. > > > Ok to check in? > > > Corinna > > > * exceptions.h (TRY_CATCH): Define setjmp/sigsetjmp macro save. Yes, this is OK (save -> safe in the changelog). -- Daniel Jacobowitz CodeSourcery, LLC