From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29714 invoked by alias); 25 Nov 2010 04:54:32 -0000 Received: (qmail 29691 invoked by uid 22791); 25 Nov 2010 04:54:25 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Nov 2010 04:53:55 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAP4rLYE015683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Nov 2010 23:53:21 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAP4rFgH014260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 23:53:19 -0500 Received: from host0.dyn.jankratochvil.net (localhost.localdomain [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id oAP4rDcp005108; Thu, 25 Nov 2010 05:53:13 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id oAP4r6jB005084; Thu, 25 Nov 2010 05:53:06 +0100 Date: Thu, 25 Nov 2010 04:54:00 -0000 From: Jan Kratochvil To: Daniel Jacobowitz Cc: Pedro Alves , gdb-patches@sourceware.org, tromey@redhat.com, Joel Brobecker Subject: Re: RFC: next/finish/etc -vs- exceptions Message-ID: <20101125045306.GA2549@host0.dyn.jankratochvil.net> References: <20090610161204.GB25703@adacore.com> <200906101806.31977.pedro@codesourcery.com> <20090610171328.GA32661@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <20090610171328.GA32661@caradoc.them.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00423.txt.bz2 On Wed, 10 Jun 2009 19:13:28 +0200, Daniel Jacobowitz wrote: [...] > exceptions can be thrown through > signal handlers on many platforms; so yes, they might switch stack. On Fedora 14 x86_64 getting instead of a caught exception-from-sighandler: terminate called after throwing an instance of 'int' from the testcase below and ISO C++ says: The common subset of the C and C++ languages consists of all declarations, definitions, and expressions that may appear in a well formed C++ program and also in a conforming C program. A POF (“plain old function”) is a function that uses only features from this common subset, and that does not directly or indirectly use any function that is not a POF, except that it may use functions defined in Clause 29 that are not member functions. All signal handlers shall have C linkage. A POF that could be used as a signal handler in a conforming C program does not produce undefined behavior when used as a signal handler in a C++ program. The behavior of any other function used as a signal handler in a C++ program is implementation-defined.228 228) In particular, a signal handler using exception handling is very ------------------------------------------------- likely to have problems. Also, invoking std::exit may cause ----------------------- destruction of objects, including those of the standard library implementation, which, in general, yields undefined behavior in a signal handler (see 1.9). If this really does not have to work it means for GDB the sigaltstack case is unrelated to this "next/finish/etc -vs- exceptions" patch. Thanks, Jan #include #include #include using namespace std; static void handler (int signo) { throw 1; } int main (void) { sighandler_t sigvar; sigvar = signal (SIGUSR1, handler); assert (sigvar == SIG_DFL); try { int i; i = raise (SIGUSR1); assert (i == 0); } catch (...) { cout << "caught" << endl; } cout << "done" << endl; }