From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2134 invoked by alias); 1 Oct 2002 04:54:22 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1815 invoked from network); 1 Oct 2002 04:54:20 -0000 Received: from unknown (HELO is.elta.co.il) (199.203.121.2) by sources.redhat.com with SMTP; 1 Oct 2002 04:54:20 -0000 Received: from is (is [199.203.121.2]) by is.elta.co.il (8.9.3/8.8.8) with SMTP id GAA08036; Tue, 1 Oct 2002 06:51:25 +0200 (IST) Date: Mon, 30 Sep 2002 21:54:00 -0000 From: Eli Zaretskii X-Sender: eliz@is To: Andrew Cagney cc: gdb-patches@sources.redhat.com Subject: Re: [rfa:breakpoint] Correctly count watchpoints In-Reply-To: <3D98A393.6010801@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-09/txt/msg00795.txt.bz2 On Mon, 30 Sep 2002, Andrew Cagney wrote: > On the i386, one watch resource is two registers. Why two? Some expressions might need 3 registers. If you use this worst-case scenario, GDB will think it cannot watch more than a single expression, and that some data types, such as double's, and complex aggregates, such as struct's, cannot be watched at all. It's hardly a Good Thing to refuse to set watchpoints based on inaccurate decisions like this. > > But this is very hard or even impossible to do in practice. For > > example, on a i386, if there are two watchpoint that watch the same > > 4-byte aligned int variable, you need only one debug register to watch > > them both, so counting each one as taking one resource is incorrect. > > That is a bug. A further change would be to accumulate all the regions > and eliminate any overlap from the count. This requires a significant change in the high-level code of GDB: it needs to pass all the information about all the ``active'' watchpoints to the function that tells how many watchpoint resources are required for the next watchpoint. > For an architecture to try and optimally allocate watchpoint resources, > I don't think (cf opencore code) a list of ADDR:LEN pairs is sufficient. > Instead it should be provided with all the watchpoint expressions. So that means an architecture should know about GDB's expression-parsing code. In effect, we are going to have the arch-specific code be tightly coupled with arch-independent code in breakpoint.c and friends. > For instance, the hw_resources_used_count() function in my other patch > could be made part of the architecture vector so that architectures, > such as the i386, could override the default model using some other type > of allocation scheme. As I write above, overriding the default model is not enough, since the application-level code doesn't feed the architecture with enough info.