From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20255 invoked by alias); 13 Apr 2006 22:13:51 -0000 Received: (qmail 20247 invoked by uid 22791); 13 Apr 2006 22:13:50 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Apr 2006 22:13:48 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k3DMDfqc005693; Fri, 14 Apr 2006 00:13:41 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6) with ESMTP id k3DMDe2X000766; Fri, 14 Apr 2006 00:13:40 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6/Submit) id k3DMDeBX026776; Fri, 14 Apr 2006 00:13:40 +0200 (CEST) Date: Thu, 13 Apr 2006 22:13:00 -0000 Message-Id: <200604132213.k3DMDeBX026776@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: eliz@gnu.org CC: gdb-patches@sourceware.org In-reply-to: (message from Eli Zaretskii on Thu, 13 Apr 2006 11:12:36 +0300) 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> 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/msg00174.txt.bz2 > Date: Thu, 13 Apr 2006 11:12:36 +0300 > From: Eli Zaretskii > > > Date: Wed, 12 Apr 2006 14:47:17 -0400 > > From: Daniel Jacobowitz > > Cc: gdb-patches@sourceware.org > > > > > 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? It's a minor effort compared to all the brain cycles spent understanding a more obfuscated interface. > > 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. But we're talking specifically about the interface for software breakpoints here aren't we? Or are we redesigning the target breakpoint interface here? If we are, I think we should try to come up with a design of some sort before rushing to implement it. > FWIW, I agree with Daniel: it is better to pass a struct than its > individual members, especially if we expect different targets to use > different members of that struct. In other words, passing a struct > eases future maintenance pains. And it obfuscates the interface. Unnecessary layers of abstraction make software difficult to understand and therefore difficult to maintain. So unless someone can make a reasonable case why we need a more general interface, I'm against it. Mark