From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26648 invoked by alias); 12 Jul 2006 18:30:06 -0000 Received: (qmail 26639 invoked by uid 22791); 12 Jul 2006 18:30:04 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 12 Jul 2006 18:30:02 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1G0jTC-00079K-C7; Wed, 12 Jul 2006 14:29:58 -0400 Date: Wed, 12 Jul 2006 18:30:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: Wu Zhou , gdb-patches@sourceware.org Subject: Re: Fw: [ppc-linux-nat]: set access flag for h/w watchpoint even if it is only read or write (fwd) Message-ID: <20060712182958.GA27342@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , Wu Zhou , gdb-patches@sourceware.org References: <20060711110910.6298fq7oys0gwogw@imap.linux.ibm.com> <20060712173125.GC24622@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11+cvs20060403 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-07/txt/msg00120.txt.bz2 On Wed, Jul 12, 2006 at 09:15:48PM +0300, Eli Zaretskii wrote: > > Date: Wed, 12 Jul 2006 13:31:25 -0400 > > From: Daniel Jacobowitz > > Cc: eliz@gnu.org, gdb-patches@sourceware.org > > > > First, there's the question of targets which can't set true "read" > > watchpoints, but can set "access" watchpoints. Right now the x86 > > simply accepts a request to insert a read watchpoint, and generates an > > access watchpoint instead. How about if we changed it to refuse to > > insert read watchpoints, changed breakpoint.c to attempt an access > > watchpoint if inserting a read watchpoint fails, and then store in the > > breakpoint which type was inserted? > > Sorry, I don't understand your plan. How is it different from what > GDB does now (silently replace read with access watchpoint)? And what > type will we store when the user says "rwatch"? It's a layering change. Right now the i386 target says "you asked me to insert a read watchpoint. OK! I've done it" and sneakily inserts an access watchpoint instead. That means higher layers can't tell that it's going to fire unexpectedly. If the i386 target instead said "Sorry, I can't insert a read watchpoint" and the higher layer said "well, how about this - can you insert an access watchpoint?" then it would be able to handle and skip the unexpected firing. > > Second, there's the question of which sort of watchpoint we've hit. If > > the target could tell us, say, as a return value from > > target_stopped_data_address, then we could only check read watchpoints > > when a read watchpoint triggers. But I think this is a smaller issue; > > at worst we might report that both a write and read watchpoint had > > triggered when really only a write watchpoint had. > > I think this is bad: if a user sets two different watchpoints at the > same address, she wants each watchpoint to fire when its specific > conditions are met. > > My philosophy here is that watchpoints are a kind of silver bullet: > you use them when you have almost no idea who could touch the data in > question. So watchpoints should perform as close to the spec as > possible, because the user is already in a very confused state; > confusing her even more with imprecise watch reports would be a bad > mantra, IMO. Yes, I know. I'm just trying to be pragmatic. The two items in my mail are different problems and will require different solutions; fixing one is better than fixing neither IMO, and this is the harder one to fix. It would be a shame to block a fix for one on a fix for the other. There's probably more than one target that can't tell us which sort of watchpoint triggered. In fact, I don't have first hand knowledge of any target which could tell us which triggered. You might be able to distinguish if you used one set of watchpoint registers to set a write watchpoint and another to set a read watchpoint - but that's awfully wasteful of watchpoint registers. -- Daniel Jacobowitz CodeSourcery