From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29623 invoked by alias); 23 May 2010 21:40:27 -0000 Received: (qmail 29613 invoked by uid 22791); 23 May 2010 21:40:26 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 23 May 2010 21:40:21 +0000 Received: (qmail 4279 invoked from network); 23 May 2010 21:40:20 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 May 2010 21:40:20 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch 1/3] Clear stale specific locs, not whole bpts [rediff] Date: Mon, 24 May 2010 12:18:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-21-generic; KDE/4.3.2; x86_64; ; ) Cc: Jan Kratochvil References: <20100503200201.GB30386@host0.dyn.jankratochvil.net> <20100517212243.GA25843@host0.dyn.jankratochvil.net> In-Reply-To: <20100517212243.GA25843@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201005232240.17414.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2010-05/txt/msg00544.txt.bz2 On Monday 17 May 2010 22:22:43, Jan Kratochvil wrote: > static void free_bp_location (struct bp_location *loc) > { > + /* Be sure no bpstat's are pointing at it after it's been freed. */ > + /* FIXME, how can we find all bpstat's? > + We just check stop_bpstat for now. Note that we cannot just > + remove bpstats pointing at bpt from the stop_bpstat list > + entirely, as breakpoint commands are associated with the bpstat; > + if we remove it here, then the later call to > + bpstat_do_actions (&stop_bpstat); > + in event-top.c won't do anything, and temporary breakpoints > + with commands won't work. */ > + > + iterate_over_threads (bpstat_remove_bp_location_callback, loc); > + I think this isn't the best place for this, considering moribund breakpoint locations --- it's too late. When you delete a breakpoint in non-stop/always-inserted modes, you'll delete the breakpoint, but deleting the bp_location itself is deferred. This means that in that case, the thread's bpstat chains may still contain references to bp_locations that are now in the moribund list (those will be still valid objects, not xfree'd yet), but their owner breakpoint is gone, meaning bpstat walks can still dereference those now invalid bp_location->owner pointers. Instead, can you move this to within in the `if (!found_object)' branch of update_global_location_list? That is, move it close to where we detected we had unlinked the bp_location from the global location list? -- Pedro Alves