From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4834 invoked by alias); 7 Feb 2008 06:38:39 -0000 Received: (qmail 4824 invoked by uid 22791); 7 Feb 2008 06:38:39 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 07 Feb 2008 06:38:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 0F5552AA651; Thu, 7 Feb 2008 01:38:20 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id x2q0dZrKio1V; Thu, 7 Feb 2008 01:38:20 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AB1EE2AA63D; Thu, 7 Feb 2008 01:38:19 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 69CDFE7ACB; Wed, 6 Feb 2008 22:38:17 -0800 (PST) Date: Thu, 07 Feb 2008 06:38:00 -0000 From: Joel Brobecker To: Nick Roberts , ghost@cs.msu.su Cc: gdb-patches@sourceware.org Subject: Re: (gdb-6.8) Discard breakpoint address if shared library is unloaded Message-ID: <20080207063817.GA3907@adacore.com> References: <20080204214226.GF20922@adacore.com> <18343.35253.667689.989145@kahikatea.snap.net.nz> <20080205001213.GJ21614@adacore.com> <18343.45995.719252.980359@kahikatea.snap.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18343.45995.719252.980359@kahikatea.snap.net.nz> User-Agent: Mutt/1.4.2.2i 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: 2008-02/txt/msg00129.txt.bz2 Vladimir, I could use a little help with your feedback. I think I'm getting it, but I think you might know more about this part of the code. > Yes. It was in my original patch but I seem to have lost it somehow in the > intervening period. I attach the updated patch. Oh, good. > 2008-02-05 Nick Roberts > > * breakpoint.c (print_one_breakpoint_location): Revert Enb field > to old format. Discard breakpoint address if shared library is > unloaded. I think we're still not there, unfortunately. > state -- it will be apparent from the locations. */ > if (header_of_multiple) > pending = 0; > ! ui_out_field_fmt (uiout, "enabled", "%c", > ! bpenables[(int) b->enable_state]); > } The following code above "ui_out_field_fmt" can be deleted now: int pending = (b->loc == NULL || b->loc->shlib_disabled); /* For header of multiple, there's no point showing pending state -- it will be apparent from the locations. */ if (header_of_multiple) pending = 0; That means that the curly braces can go too. We also need to restore the spacing after the enable state. We end up with: annotate_field (3); if (part_of_multiple) ui_out_field_string (uiout, "enabled", loc->enabled ? "y" : "n"); else ui_out_field_fmt (uiout, "enabled", "%c", bpenables[(int) b->enable_state]); ui_out_spaces (uiout, 2); > ui_out_field_string (uiout, "addr", ""); > else if (header_of_multiple) > ui_out_field_string (uiout, "addr", ""); > + else if (loc->shlib_disabled) > + ui_out_field_string (uiout, "addr", ""); > else > ui_out_field_core_addr (uiout, "addr", loc->address); > } I understand what Vladimir said, but I think that the following should work too: @@ -3552,10 +3552,10 @@ print_one_breakpoint_location (struct br if (addressprint) { annotate_field (4); - if (b->loc == NULL) - ui_out_field_string (uiout, "addr", ""); - else if (header_of_multiple) + if (header_of_multiple) ui_out_field_string (uiout, "addr", ""); + if (b->loc == NULL || loc->shlib_disabled) + ui_out_field_string (uiout, "addr", ""); else ui_out_field_core_addr (uiout, "addr", loc->address); } The idea is that you can't have header_of_multiple=1 and b->loc == NULL at the same time. So it's OK to move the check for header_of_multiple up. And that avoids the code duplication. -- Joel