From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9977 invoked by alias); 13 Apr 2006 21:57:36 -0000 Received: (qmail 9967 invoked by uid 22791); 13 Apr 2006 21:57:35 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Apr 2006 21:57:33 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k3DLvUdm017592; Thu, 13 Apr 2006 17:57:30 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.11.6) with ESMTP id k3DLvTHs009330; Thu, 13 Apr 2006 17:57:29 -0400 Received: from [172.16.24.50] (bluegiant.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id k3DLvSTq010512; Thu, 13 Apr 2006 17:57:28 -0400 Message-ID: <443EC947.9060109@redhat.com> Date: Thu, 13 Apr 2006 21:57:00 -0000 From: Michael Snyder User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) MIME-Version: 1.0 To: Daniel Jacobowitz CC: Mark Kettenis , gdb-patches@sourceware.org Subject: Re: Save the length of inserted breakpoints References: <20060302221711.GB18830@nevyn.them.org> <200603022301.k22N1qEt008208@elgar.sibelius.xs4all.nl> <20060411214613.GA702@nevyn.them.org> <200604120943.k3C9hYJ8012016@elgar.sibelius.xs4all.nl> <20060412125712.GA22145@nevyn.them.org> <200604121837.k3CIbMwu004466@elgar.sibelius.xs4all.nl> <20060412184717.GA29980@nevyn.them.org> In-Reply-To: <20060412184717.GA29980@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00172.txt.bz2 Daniel Jacobowitz wrote: > On Wed, Apr 12, 2006 at 08:37:22PM +0200, Mark Kettenis wrote: > >>>Would a new "struct bp_target_info", defined and allocated centrally >>>for convenience, allay this concern? [Conveniently I can do the bulk >>>of the changes for that with sed :-)] >> >>Why hide things away if all you're going to need is a buffer and a >>length? I've tried really hard to see why one would need more than >>that, but failed completely. >> >>So I think we should have: >> >>int target_insert_breakpoint(CORE_ADDR addr, gdb_byte *buf, int *size); >>int target_remove_breakpoint(CORE_ADDR addr, gdb_byte *buf, int size); > > > And then if you come up with a reason, you're going to need to hand > edit every one of these targets again. It's not a bundle of fun. Is > that really necessary? > > You need an address because the address at which the breakpoint is > inserted may not match the requested address. This happens in several > different places in the breakpoint infrastructure (I believe I counted > three disjoint hooks for it), but I am particularly looking at > BREAKPOINT_FROM_PC, which takes the PC by reference. In the ARM case, > given 0x4001, it strips the low bit off and returns a two byte > breakpoint. If we don't allow the target to save the > actually-inserted-at address, then it has to call BREAKPOINT_FROM_PC > again. It feels much more robust to me to save this address when we > initially adjust it. Here's where we inserted the breakpoint, so > that's where we should remove it from. > > I can think of plenty of other places where another constant might > be useful. You might want to record which hardware breakpoint > registers were used, for instance, instead of digging around > to figure out which ones to clear. Adding a new member to > "struct bp_target" for that would be easy. I haven't followed this discussion closely, so forgive me if I'm recapitulating something that's already been said. What about something like "void *target_data" in the breakpoint struct? The target can add whatever it likes, and the core breakpoint code doesn't need to know what it is. If it's non-null when the bp is freed, then the target should be given an opportunity to delete it.