From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23023 invoked by alias); 4 Jun 2014 14:54:07 -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 23005 invoked by uid 89); 4 Jun 2014 14:54:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-gw2-out.broadcom.com Received: from mail-gw2-out.broadcom.com (HELO mail-gw2-out.broadcom.com) (216.31.210.63) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jun 2014 14:54:05 +0000 Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw2-out.broadcom.com with ESMTP; 04 Jun 2014 07:56:29 -0700 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 4 Jun 2014 07:53:54 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.3.174.1; Wed, 4 Jun 2014 07:53:54 -0700 Received: from [10.177.73.41] (unknown [10.177.73.41]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 2838F9F9F7; Wed, 4 Jun 2014 07:53:53 -0700 (PDT) Message-ID: <538F3300.6010700@broadcom.com> Date: Wed, 04 Jun 2014 14:54:00 -0000 From: Andrew Burgess User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Gary Benson , Mark Kettenis CC: , , , , , Subject: Re: [PATCH 0/2 v3] Demangler crash handler References: <20140604100755.GA7570@blade.nx> <201406041027.s54ARXYL017073@glazunov.sibelius.xs4all.nl> <20140604133413.GA10121@blade.nx> In-Reply-To: <20140604133413.GA10121@blade.nx> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00170.txt.bz2 On 04/06/2014 2:34 PM, Gary Benson wrote: > Mark Kettenis wrote: >>> From: Gary Benson >>> Is this ok to commit? >> >> Not for me. You're running too much code between entering the >> SIGSEGV handler and dumping core for my taste. > > I don't understand. This is the signal handler: > > static void > gdb_demangle_signal_handler (int signo) > { > static int core_dumped = 0; > > if (!core_dumped) > { > if (fork () == 0) > dump_core (); > > core_dumped = 1; > } > > SIGLONGJMP (gdb_demangle_jmp_buf, signo); > } > > and this is dump_core: > > void > dump_core (void) > { > #ifdef HAVE_SETRLIMIT > struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY }; > > setrlimit (RLIMIT_CORE, &rlim); > #endif /* HAVE_SETRLIMIT */ > > abort (); /* NOTE: GDB has only three calls to abort(). */ > } > > This is what happens: > > 1. the signal handler is entered > 2. fork > 3. setrlimit > 4. abort > > I could remove the setrlimit but presumably somebody added that to > make a successful core dump more likely. > > Would you accept this patch if I changed the dump_core to abort > in gdb_demangle_signal_handler? (and updated all the comments > about having only three calls to abort)? > >> I still very much agree with Pedro; this should not be necessary. > > "Should" is the operative word here. It *should* not be necessary > because the demangler *should* never crash. But this isn't utopia. > The demangler is code, and code has bugs. People make mistakes. > Things are valid now that may not be valid in the future. And GDB > should not just crash if some symbol in the inferior isn't handled > or doesn't make sense or whatever. By this logic should / would we not extend the SIGSEGV handler to cover all gdb code? If the target is running in synchronous mode we'd install our SEGV handler when the target stops and remove it when the target restarts (asynchronous mode would need more thought), then any bugs in gdb that cause a SEGV would result in a core dump ... I'm just not sure why the demangler should get special treatment. Thanks, Andrew