From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16832 invoked by alias); 18 Jan 2013 18:09:08 -0000 Received: (qmail 16821 invoked by uid 22791); 18 Jan 2013 18:09:07 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Fri, 18 Jan 2013 18:08:59 +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.14.4/8.14.4) with ESMTP id r0II8kMI007739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jan 2013 13:08:46 -0500 Received: from barimba (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 r0II8jBN006695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 18 Jan 2013 13:08:45 -0500 From: Tom Tromey To: Pedro Alves Cc: Pierre Muller , gdb-patches@sourceware.org Subject: Re: catch SIGSEGV in the demangler References: <87fw23o70u.fsf@fleche.redhat.com> <19236.9665638127$1358374641@news.gmane.org> <87622vd2vd.fsf@fleche.redhat.com> <50F93081.1090905@redhat.com> <87pq12a62h.fsf@fleche.redhat.com> <50F96D16.3030502@redhat.com> <87y5fq8odh.fsf@fleche.redhat.com> <50F98CD9.5000600@redhat.com> Date: Fri, 18 Jan 2013 18:09:00 -0000 In-Reply-To: <50F98CD9.5000600@redhat.com> (Pedro Alves's message of "Fri, 18 Jan 2013 17:56:41 +0000") Message-ID: <87bocm749e.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/msg00445.txt.bz2 Tom> I'm primarily interested in opinions on whether this is even a good Tom> idea. I'm on the fence about it myself. Pedro> Me too. I'd rather all bugs in the demangler were fixed. :-) Yeah. But there will be future crashes too. Tom> It's far from clear that it is safe to call throw_exception from a Tom> signal handler. Pedro> Yeah. It's risky. It uses the heap (malloc/free), so Pedro> if the wrapped code crashes within malloc or free (e.g., Pedro> corrupted heap), then the handler may e.g., deadlock Pedro> (the handler crashing wouldn't be that bad, since we're Pedro> already crashing). It also calls clear_sigint_flag, Pedro> which with python enabled is probably not very reentrant or Pedro> async signal safe either, as it calls into python, which I can Pedro> imagine to be a problem is you wrap all SEGVs throughtout Pedro> GDB's execution, instead of just over the demangler, which Pedro> won't normally call into python. I think Python isn't an issue. PyOS_InterruptOccurred is reasonably unobjectionable. It is a low-level thing, part of Python's own signal-handling code. We probably shouldn't call clear_quit_flag in there at all. It wouldn't be hard to avoid this in the SEGV case at least. That way a SEGV wouldn't obscure a QUIT. Tom