From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7182 invoked by alias); 17 Jan 2013 19:56:42 -0000 Received: (qmail 7170 invoked by uid 22791); 17 Jan 2013 19:56:41 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_EG 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, 17 Jan 2013 19:56:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0HJU0Rx026136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Jan 2013 14:30:00 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0HJTw3d003676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 17 Jan 2013 14:29:59 -0500 From: Tom Tromey To: "Pierre Muller" Cc: Subject: Re: catch SIGSEGV in the demangler References: <87fw23o70u.fsf@fleche.redhat.com> <19236.9665638127$1358374641@news.gmane.org> Date: Thu, 17 Jan 2013 19:56:00 -0000 In-Reply-To: <19236.9665638127$1358374641@news.gmane.org> (Pierre Muller's message of "Wed, 16 Jan 2013 23:16:34 +0100") Message-ID: <87622vd2vd.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2013-01/txt/msg00373.txt.bz2 >>>>> "Pierre" == Pierre Muller writes: Pierre> sigaction is not available everywhere and is tested by configure Pierre> see remote-sim.c:999 Pierre> I don't know the exact status of sigaltstack function, but Pierre> I would be surprised that it is supported on systems that Pierre> don't support sigaction... Yeah, thanks. Pierre> Also, sigaction can return the previous signal handler, Pierre> so why not use this previous handle instead of SIG_DFL? I don't mind changing this, but it seems like if this gives a result other than SIG_DFL, then we've done something weird. There should be only one handler installed. Pierre> Would it make sense to still throw an exception even if not inside the Pierre> demangler? I was thinking of perhaps expanding the scope somewhat. One idea I had was to introduce a new RETURN_SEGV to return_reason and *not* add this to RETURN_MASK_ALL. Then, have a special throw_segv that first looks to see if anything expects to catch it, and if not, reset the handler and re-raise the signal. This way we could let code handle SEGV when appropriate, without tying it to the demangler -- but also without catching all SEGVs that occur in gdb. I think we probably want to let some SEGVs through for the benefit of external crash-catchers like ABRT. But, maybe not -- I've also been wondering if a SEGV should be treated like internal_error instead. Maybe sometimes gdb could limp on after a SEGV. Pierre> I was also surprised by the fact that you called the new file Pierre> safe-demangle.c, why not simply name it gdb-demangle.c? I didn't want to confuse it with the existing demangle.c. Tom