From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18492 invoked by alias); 30 Sep 2010 17:04:15 -0000 Received: (qmail 18474 invoked by uid 22791); 30 Sep 2010 17:04:13 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Sep 2010 17:04:08 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8UH3x31015973 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 30 Sep 2010 13:04:00 -0400 Received: from localhost.localdomain.redhat.com (ovpn-113-74.phx2.redhat.com [10.3.113.74]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8UH3uYo007037; Thu, 30 Sep 2010 13:03:58 -0400 From: Phil Muldoon To: Pedro Alves Cc: gdb-patches@sourceware.org, dan@codesourcery.com Subject: Re: [patch] Add visible flag to breakpoints. References: <20100930144132.GA15652@caradoc.them.org> <201009301741.32379.pedro@codesourcery.com> Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Thu, 30 Sep 2010 18:12:00 -0000 In-Reply-To: <201009301741.32379.pedro@codesourcery.com> (Pedro Alves's message of "Thu, 30 Sep 2010 17:41:32 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-09/txt/msg00517.txt.bz2 Pedro Alves writes: > On Thursday 30 September 2010 17:18:15, Phil Muldoon wrote: >> The original patch I wrote did use negative numbers for bp_breakpoint >> type (in fact that patch is a commit in the archer branch: >> archer-pmuldoon-python-breakpoints). But normal bp_breakpoints with a >> negative number are still displayed with 'info breakpoints'. Currently >> the visibility of breakpoints is not decided on their number but their >> type. >> breakpoint_1 tests for these in user_settable_breakpoint. > > I think that's just cruft and can be replaced by a b->number < 0 check? Ah, there is the crux. I presumed (from the code) that there was a scenario where negative numbered breakpoints were valid to be printed. But looks like not. We can use negative numbers if the < 0 printing check is ok and do away with the visible flag. > I'm not sure what large effort you're thinking this entails. > You've carried the "visible" flag as argument all the way down to > create_breakpoint_sal already. So instead of: > > @@ -6961,6 +6973,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch, > b->enable_state = enabled ? bp_enabled : bp_disabled; > b->disposition = disposition; > b->pspace = sals.sals[0].pspace; > + b->visible = visible; > > You change this: > > b = set_raw_breakpoint (gdbarch, sal, type); > set_breakpoint_count (breakpoint_count + 1); > b->number = breakpoint_count; > > to: > > b = set_raw_breakpoint (gdbarch, sal, type); > if (visible /* or some other name, user? !internal? */) > { > set_breakpoint_count (breakpoint_count + 1); > b->number = breakpoint_count; > } > else > { > b->number = internal_breakpoint_number--; > } > > and you're golden. What am I missing? I have a patch in my archer branch that does just this. The original patch I wrote did this ;) There is some work to be done on the Python bookkeeping side as breakpoint references are stored via breakpoint number (in a vector), so the negative numbers would be painful there. Luckily in the aforementioned patch I already changed this bookkeeping over to a single linked-list. Looks like my first intentions were best then. I'll reconstitute the patch from previous commits and resubmit (happily this is super easy with git) Cheers Phil