Message ID | 20140519154822.GA20315@blade.nx |
---|---|
State | Superseded |
Headers |
Return-Path: <x14314964@homiemail-mx22.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 9BC72360098 for <siddhesh@wilcox.dreamhost.com>; Mon, 19 May 2014 08:48:35 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id 490C05B75C33; Mon, 19 May 2014 08:48:35 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 0FCD45B75C2B for <gdb@patchwork.siddhesh.in>; Mon, 19 May 2014 08:48:35 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=wGvf syUMRdF5fugukFZc6JxULmT7g5v/Mpq8CIWH7kLG4E18OR+RKSuN5qIK4tBaEbMt vJWuSJ+2baMq1yWieEOxdS3Yo/LuFhthazyFyXPBIGUC4qchCUBbMSZAnXvMyfQn 2MeeMGEdb5DrZv933HPAmjIVHR2tvEkjMZpcNfE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=EDaBmXesyz 27vn4Ac25x0Gyx2co=; b=JXhET8vcXTgoc+EL0Z8DqGZNw0s4Yolyad2I16aPel Da3LU5eWel6ycrMgiMuyVYq/WaYGaDflHfKVSKvS38f2ISrxLota6/tJOw014izJ 4I8wtKDVJO0d8vjgZFVjunJlYYbJhiTBlhJTeF8VzC9WzDhwFGHmWlarZ1uomSin I= Received: (qmail 25689 invoked by alias); 19 May 2014 15:48:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-gdb=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 25676 invoked by uid 89); 19 May 2014 15:48:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 May 2014 15:48:31 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4JFmPUL002983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 May 2014 11:48:25 -0400 Received: from blade.nx (ovpn-116-75.ams2.redhat.com [10.36.116.75]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4JFmNs6000481; Mon, 19 May 2014 11:48:24 -0400 Received: by blade.nx (Postfix, from userid 1000) id 21E0A26240E; Mon, 19 May 2014 16:48:23 +0100 (BST) Date: Mon, 19 May 2014 16:48:23 +0100 From: Gary Benson <gbenson@redhat.com> To: Eli Zaretskii <eliz@gnu.org> Cc: gdb-patches@sourceware.org, aburgess@broadcom.com, xdje42@gmail.com, fw@deneb.enyo.de, mark.kettenis@xs4all.nl, palves@redhat.com, tromey@redhat.com Subject: Re: [PATCH 2/2 v2] Demangler crash handler Message-ID: <20140519154822.GA20315@blade.nx> References: <20140519114801.GA31140@blade.nx> <83iop1dd8e.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83iop1dd8e.fsf@gnu.org> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in |
Commit Message
Gary Benson
May 19, 2014, 3:48 p.m. UTC
Eli Zaretskii wrote: > > Date: Mon, 19 May 2014 12:48:02 +0100 > > From: Gary Benson <gbenson@redhat.com> > > Cc: Andrew Burgess <aburgess@broadcom.com>, Doug Evans <xdje42@gmail.com>, > > Eli Zaretskii <eliz@gnu.org>, Florian Weimer <fw@deneb.enyo.de>, > > Mark Kettenis <mark.kettenis@xs4all.nl>, > > Pedro Alves <palves@redhat.com>, Tom Tromey <tromey@redhat.com> > > > > The main change I have made is to cause the crash handler to be > > disabled by default. The user must explicitly enable the handler > > with "maint set catch-demangler-crashes on". This will simplify > > triage of bugs such as PR 16957 [2], a new demangler crash that > > was reported on Friday. The user did not supply enough > > information to see the offending symbol, and I don't have the > > necessary compiler or libraries to reproduce the bug locally. > > With this patch we can instruct the user to enter "maint set > > catch-demangler-crashes on" and repeat whatever they did to cause > > the crash in the first place. We can then easily obtain the first > > offending symbol GDB encountered. > > Can't say this option makes sense to me. Isn't there a way to > display the necessary information in a message, even though you > catch the signal? To clarify, the current situation in GDB is that crashes in the demangler are not caught: (gdb) set lang c++ (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu Segmentation fault (core dumped) With the patch, that is also the default situation. But with the patch, with "maint set catch-demangler-crashes on", a signal handler is installed across calls to the demangler, so that if the demangler crashes you get something like this: (gdb) set lang c++ (gdb) maint set catch-demangler-crashes on (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) y Aborted (core dumped) > > maint set catch-demangler-crashes (on|off) > > maint show catch-demangler-crashes > > Control whether the debugger should attempt to catch crashes in the > > symbol name demangler. The default is not to attempt to catch > > crashes. The first time a crash is caught the offending symbol is > > displayed and the user is presented with options to terminate the > > current session and/or to create a core file. > > Given this description, it sounds like all the necessary information > is already displayed when the crash is caught. So why would we need > an option? Did my above explanation answer this question? > > gdb/doc/ > > 2014-05-19 Gary Benson <gbenson@redhat.com> > > > > * gdb.texinfo (Maintenance Commands): Document new > > "maint set/show catch-demangler-crashes" option. > > This part of the patch was absent from what you sent. My apologies. And the whole reason I Cc'd you was because the patch contained documentation changes :) I've inlined that part at the end of this mail. > > +#ifdef SIGSEGV > > AFAIK, SIGSEGV is an ANSI-standard signal, so I don't think you need a > preprocessor conditional here. Ok, I can remove this. > > + add_setshow_boolean_cmd ("catch-demangler-crashes", class_maintenance, > > + &catch_demangler_crashes, _("\ > > +Set whether to attempt to catch demangler crashes."), _("\ > > +Show whether GDB will attempt to catch demangler crashes."), _("\ > > The "Set" and "Show" lines should be identical except for the > initial word. Ok, I will change the second to: +Show whether to attempt to catch demangler crashes."), _("\ Thanks, Gary --
Comments
> Date: Mon, 19 May 2014 16:48:23 +0100 > From: Gary Benson <gbenson@redhat.com> > Cc: gdb-patches@sourceware.org, aburgess@broadcom.com, xdje42@gmail.com, > fw@deneb.enyo.de, mark.kettenis@xs4all.nl, palves@redhat.com, > tromey@redhat.com > > > Can't say this option makes sense to me. Isn't there a way to > > display the necessary information in a message, even though you > > catch the signal? > > To clarify, the current situation in GDB is that crashes in the > demangler are not caught: > > (gdb) set lang c++ > (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu > Segmentation fault (core dumped) > > With the patch, that is also the default situation. But with the > patch, with "maint set catch-demangler-crashes on", a signal handler > is installed across calls to the demangler, so that if the demangler > crashes you get something like this: > > (gdb) set lang c++ > (gdb) maint set catch-demangler-crashes on > (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu > /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) > A problem internal to GDB has been detected, > further debugging may prove unreliable. > Quit this debugging session? (y or n) y > > /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) > A problem internal to GDB has been detected, > further debugging may prove unreliable. > Create a core file of GDB? (y or n) y > Aborted (core dumped) Yes, I knew all that (because I've read all the deliberations here about this feature). I'm asking why do we need this option, instead of having its ON effect by default? > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -33142,6 +33142,16 @@ Expand symbol tables. > If @var{regexp} is specified, only expand symbol tables for file > names matching @var{regexp}. > > +@kindex maint set catch-demangler-crashes > +@kindex maint show catch-demangler-crashes Please add here @cindex demangler crashes Otherwise, this part is OK. Thanks.
Eli Zaretskii wrote: > > Date: Mon, 19 May 2014 16:48:23 +0100 > > From: Gary Benson <gbenson@redhat.com> > > Cc: gdb-patches@sourceware.org, aburgess@broadcom.com, xdje42@gmail.com, > > fw@deneb.enyo.de, mark.kettenis@xs4all.nl, palves@redhat.com, > > tromey@redhat.com > > > > > Can't say this option makes sense to me. Isn't there a way to > > > display the necessary information in a message, even though you > > > catch the signal? > > > > To clarify, the current situation in GDB is that crashes in the > > demangler are not caught: > > > > (gdb) set lang c++ > > (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu > > Segmentation fault (core dumped) > > > > With the patch, that is also the default situation. But with the > > patch, with "maint set catch-demangler-crashes on", a signal > > handler is installed across calls to the demangler, so that if the > > demangler crashes you get something like this: > > > > (gdb) set lang c++ > > (gdb) maint set catch-demangler-crashes on > > (gdb) maint demangle _Z1-Av23*;cG~Wo2Vu > > /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) > > A problem internal to GDB has been detected, > > further debugging may prove unreliable. > > Quit this debugging session? (y or n) y > > > > /home/gary/work/archer/demangle-crashcatcher/src/gdb/cp-support.c:1590: internal-warning: unable to demangle '_Z1-Av23*;cG~Wo2Vu' (demangler failed with signal 11) > > A problem internal to GDB has been detected, > > further debugging may prove unreliable. > > Create a core file of GDB? (y or n) y > > Aborted (core dumped) > > Yes, I knew all that (because I've read all the deliberations here > about this feature). I'm asking why do we need this option, instead > of having its ON effect by default? Ah, my apologies. On by default is my preference--it seems to work, and it doesn't rob performance--but I don't think that will to be accepted because there's no way to do this without (sig)longjmp, and that isn't safe to call from a signal handler. A disabled-by-default catcher is at least somewhat helpful in triaging all these demangler bugs that are coming in now people are starting to use C++11 features. > > --- a/gdb/doc/gdb.texinfo > > +++ b/gdb/doc/gdb.texinfo > > @@ -33142,6 +33142,16 @@ Expand symbol tables. > > If @var{regexp} is specified, only expand symbol tables for file > > names matching @var{regexp}. > > > > +@kindex maint set catch-demangler-crashes > > +@kindex maint show catch-demangler-crashes > > Please add here > > @cindex demangler crashes > > Otherwise, this part is OK. Thanks. Thank you. Gary
Wouldn't a new "set debug demangle on" option, that would make GDB output: (gdb) bt / whatever-gdb-command-that-triggers-demangling demangling _ZN2CV1mEi ... CV::m(int) demangling _Zwhatever ... <NULL> be just as helpful, and, even potentially be helpful to debug scenarios where GDB/libiberty might get the demangling wrong, but not cause a crash? Seems like a natural and easy sell to me.
> Date: Mon, 19 May 2014 21:41:37 +0100 > From: Pedro Alves <palves@redhat.com> > CC: gdb-patches@sourceware.org, aburgess@broadcom.com, xdje42@gmail.com, > fw@deneb.enyo.de, mark.kettenis@xs4all.nl, tromey@redhat.com > > Wouldn't a new "set debug demangle on" option, that would make > GDB output: > > (gdb) bt / whatever-gdb-command-that-triggers-demangling > demangling _ZN2CV1mEi ... CV::m(int) > demangling _Zwhatever ... <NULL> > > be just as helpful, and, even potentially be helpful to debug > scenarios where GDB/libiberty might get the demangling wrong, > but not cause a crash? > > Seems like a natural and easy sell to me. Yes, I agree.
Pedro Alves wrote: > Wouldn't a new "set debug demangle on" option, that would make > GDB output: > > (gdb) bt / whatever-gdb-command-that-triggers-demangling > demangling _ZN2CV1mEi ... CV::m(int) > demangling _Zwhatever ... <NULL> > > be just as helpful, and, even potentially be helpful to debug > scenarios where GDB/libiberty might get the demangling wrong, > but not cause a crash? It would be as helpful for obtaining the symbol, although you would get a lot more output (hundreds of thousands/millions of lines vs one line). It would not help the user to debug their program because GDB would still crash. Thanks, Gary -- http://gbenson.net/
* Pedro Alves: > Wouldn't a new "set debug demangle on" option, that would make > GDB output: > > (gdb) bt / whatever-gdb-command-that-triggers-demangling > demangling _ZN2CV1mEi ... CV::m(int) > demangling _Zwhatever ... <NULL> > > be just as helpful, and, even potentially be helpful to debug > scenarios where GDB/libiberty might get the demangling wrong, > but not cause a crash? Here's another idea: You could strcpy the input string to a mapped file (say, ~/.config/gdb/demangler) and read that on startup, printing it and adding the offending symbol to a blacklist (say, ~/.config/gdb/demangler.blacklist).
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a6bde12..32f33a9 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -33142,6 +33142,16 @@ Expand symbol tables. If @var{regexp} is specified, only expand symbol tables for file names matching @var{regexp}. +@kindex maint set catch-demangler-crashes +@kindex maint show catch-demangler-crashes +@item maint set catch-demangler-crashes [on|off] +@itemx maint show catch-demangler-crashes +Control whether @value{GDBN} should attempt to catch crashes in the +symbol name demangler. The default is not to attempt to catch +crashes. If enabled, the first time a crash is caught the offending +symbol is displayed and the user is presented with options to +terminate the current session and to create a core file. + @kindex maint cplus first_component @item maint cplus first_component @var{name} Print the first C@t{++} class/namespace component of @var{name}.