From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29675 invoked by alias); 9 Aug 2008 12:20:06 -0000 Received: (qmail 29665 invoked by uid 22791); 9 Aug 2008 12:20:05 -0000 X-Spam-Check-By: sourceware.org Received: from mtaout2.012.net.il (HELO mtaout2.012.net.il) (84.95.2.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 09 Aug 2008 12:19:26 +0000 Received: from HOME-C4E4A596F7 ([84.229.211.50]) by i_mtaout2.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K5C00DJ828SY180@i_mtaout2.012.net.il> for gdb@sourceware.org; Sat, 09 Aug 2008 15:19:41 +0300 (IDT) Date: Tue, 12 Aug 2008 14:51:00 -0000 From: Eli Zaretskii Subject: Re: Problem with can_use_hw_breakpoint In-reply-to: <1218283386.2855.106.camel@thomas> X-012-Sender: halo1@inter.net.il To: jeremy.bennett@embecosm.com Cc: gdb@sourceware.org Reply-to: Eli Zaretskii Message-id: References: <200807312204.m6VM4JQM007611@tully.CS.Berkeley.EDU> <200808011054.24219.apoenitz@trolltech.com> <20080801125124.GA13594@caradoc.them.org> <20080801135920.GA17022@caradoc.them.org> <20080801152850.GA23431@caradoc.them.org> <1218283386.2855.106.camel@thomas> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00158.txt.bz2 > From: Jeremy Bennett > Date: Sat, 09 Aug 2008 13:03:06 +0100 > > This function is called in response to watch, rwatch, awatch or hbreak > commands. My architecture can support up to 4 hardware watchpoints. > Consider the sequence > > awatch a (watchpoint 1) > awatch b (watchpoint 2) > rwatch c (watchpoint 3) > rwatch d (watchpoint 4) > rwatch e > > rwatch e should fail (5th request), but all I know from the call to > can_use_hw_breakpoint() is that 3 of this type are requested and that > some other type of watchpoint (but not how many) has previously been > requested. You say above that your architecture supports up to 4 hardware watchpoints. Given that, isn't it enough to simply add 3+1 and compare that to 4? > Ideally I would like can_use_hw_breakpoint to supply me with an array > with the counts of all types of HW breakpoint/watchpoint requested, so I > could determine the total resource currently required. What are the exact limitations of your architecture? Do they depend on the types of the watchpoints, and if so, how? > In the absence of this, can anyone suggest a reasonably simple solution. Take a look at i386-nat.c: it maintains a mirror of the hardware watchpoints related resources, and consults them for both allowing multiple watchpoints that watch the same addresses, and for deciding when another watchpoint cannot be defined.