From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8610 invoked by alias); 4 Jun 2014 18:34:11 -0000 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 Received: (qmail 8600 invoked by uid 89); 4 Jun 2014 18:34:11 -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; Wed, 04 Jun 2014 18:34:10 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s54IY2FM012716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Jun 2014 14:34:02 -0400 Received: from blade.nx (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s54IY1Hh015703; Wed, 4 Jun 2014 14:34:02 -0400 Received: by blade.nx (Postfix, from userid 1000) id 0F6DA26243C; Wed, 4 Jun 2014 19:34:01 +0100 (BST) Date: Wed, 04 Jun 2014 18:34:00 -0000 From: Gary Benson To: Doug Evans Cc: gdb-patches@sourceware.org, Andrew Burgess , Eli Zaretskii , Florian Weimer , Mark Kettenis , Pedro Alves , Tom Tromey Subject: Re: [PATCH 2/2 v3] Demangler crash handler Message-ID: <20140604183400.GB14897@blade.nx> References: <20140604100755.GA7570@blade.nx> <20140604100957.GC7570@blade.nx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00205.txt.bz2 Doug Evans wrote: > Gary Benson writes: > > +static void > > +gdb_demangle_signal_handler (int signo) > > +{ > > + static int core_dumped = 0; > > + > > + if (!core_dumped) > > + { > > + if (fork () == 0) > > + dump_core (); > > IIUC you're skipping the can_dump_core() check. > If the user has set ulimit -c 0, I think that needs to be obeyed. > I realize can_dump_core may call fprintf which we can't do here, > but you could still IMO call getrlimit. > IWBN to still call can_dump_core (or whatever) so that the > implementation of the check is still tucked away in a function. Ah, I saw can_dump_core but didn't get what it was doing. I'll refactor it so that the check is performed once, before the signal handler is installed, and the message is printed outside the signal handler if a crash is caught. > > + if (crash_signal != 0) > > + { > > + static int error_reported = 0; > > + > > + if (!error_reported) > > For myself as a user I'd like the warning for every demangle failure. > [I'd throttle it by unique symbols though.] My reasoning here was that any subsequent failures could be caused by the first, by memory corruption or some leftover state, so they could be bogus and lead us into wild goose chases. I can certainly put together a patch with throttled warnings as you describe if you prefer. Let me know :) Thanks, Gary -- http://gbenson.net/