From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25754 invoked by alias); 22 Jul 2009 20:15:10 -0000 Received: (qmail 25735 invoked by uid 22791); 22 Jul 2009 20:15:08 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Jul 2009 20:15:00 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6MKEuur027670; Wed, 22 Jul 2009 16:14:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6MKEtnF025735; Wed, 22 Jul 2009 16:14:56 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6MKEsli018005; Wed, 22 Jul 2009 16:14:55 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 422033782E3; Wed, 22 Jul 2009 13:07:25 -0600 (MDT) To: "Ulrich Weigand" Cc: gdb-patches@sourceware.org, Jan Kratochvil Subject: Re: [rfc] Infrastructure to disable breakpoints during inferior startup References: <200907221701.n6MH1l1C001297@d12av02.megacenter.de.ibm.com> From: Tom Tromey Reply-To: tromey@redhat.com Date: Wed, 22 Jul 2009 20:32:00 -0000 In-Reply-To: <200907221701.n6MH1l1C001297@d12av02.megacenter.de.ibm.com> (Ulrich Weigand's message of "Wed\, 22 Jul 2009 19\:01\:47 +0200 \(CEST\)") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-07/txt/msg00569.txt.bz2 >>>>> "Ulrich" == Ulrich Weigand writes: Ulrich> The following patch attempts to address this by temporarily Ulrich> disabling all user-installed breakpoints during the inferior Ulrich> startup phase, using a mechanism similar to Ulrich> disable_watchpoints_before_interactive_call_start. FWIW, I took a look at the PIE patch from the Fedora SRPM. It has almost identical functions disable_breakpoints_before_startup and re_enable_breakpoints_at_startup. There are some differences, but I don't know whether they are relevant or not. The Fedora disable_breakpoints_before_startup has a check like this: + if (((b->type == bp_breakpoint) || + (b->type == bp_hardware_breakpoint)) && + b->enable_state == bp_enabled && + !b->loc->duplicate) This differs from yours because it checks `loc->duplicate'. The Fedora re_enable_breakpoints_at_startup does this: + /* Do not reenable the breakpoint if the shared library + is still not mapped in. */ + if (target_read_memory (b->loc->address, buf, 1) == 0) + { + /*printf ("enabling breakpoint at 0x%s\n", paddr_nz(b->loc->address));*/ + b->enable_state = bp_enabled; + } I have no idea about this either. Perhaps it is something specific to PIE on Linux. Maybe Jan can follow up when he gets back. Ulrich> +/* Are we executing startup code? */ Ulrich> +static int executing_startup; This seems like it should be a field in struct inferior. I seem to say that a lot :-). I don't actually know .. should we be doing this sort of thing now, or are we waiting for Pedro's multi-inferior patches to land first? Ulrich> + bp_startup_disabled,/* The eventpoint has been disabled during inferior I think a new bp_ constant probably needs an entry in the array in print_one_breakpoint_location. Otherwise if something funny happens, and we try to print one, gdb will get an internal error. Tom