From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19260 invoked by alias); 6 Jul 2006 20:59:04 -0000 Received: (qmail 19251 invoked by uid 22791); 6 Jul 2006 20:59:04 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Jul 2006 20:59:02 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-192-59.inter.net.il [83.130.192.59]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id FDB94967 (AUTH halo1); Thu, 6 Jul 2006 23:58:58 +0300 (IDT) Date: Thu, 06 Jul 2006 20:59:00 -0000 Message-Id: From: Eli Zaretskii To: Wu Zhou , gdb-patches@sourceware.org In-reply-to: <20060706132020.GB18827@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 6 Jul 2006 09:20:20 -0400) Subject: Re: [ppc-linux-nat]: set access flag for h/w watchpoint even if it is only read or write Reply-to: Eli Zaretskii References: <20060706132020.GB18827@nevyn.them.org> 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/msg00043.txt.bz2 > Date: Thu, 6 Jul 2006 09:20:20 -0400 > From: Daniel Jacobowitz > Cc: gdb-patches@sourceware.org > > On Fri, Jun 09, 2006 at 11:40:26PM +0800, Wu Zhou wrote: > > Hello all, > > > > I found a bug in the current ppc-linux h/w watchpoint implementation: > > when we set read watchpoint to some expression, if there are any write > > operation to it before a read operation is hit, watchpoint_check will see > > that its value is changed. So user won't see the watchpoint is hit. > > > > I make one change to the SET_DEBUGREG operation: even if it is only > > read or write watchpoint, we still set access flag. Then, no matter > > what operation is on the watched address, a SIGTRAP will be triggered. > > The gdb code itself can determine if it is a write operation or read > > operation. If it is write, watchpoint_check routine can update the > > bs->value to the latest. > > Eli, you're the most familiar with watchpoint support; do you have any > comment on this? I'm sorry, I missed it somehow. Yes, this problem is known on x86 and elsewhere. The problem is extremely rare, as reading and writing to the same address in the same instruction is a hard-to-accomplish treat. Wu, could you show a real-life example of where this matters? The solution you suggest, in my experience, is worse than the problem: it will cause a significant slow-down of the most frequent case, as Daniel points out. > Many targets can tell us what sort of watchpoint was hit; we could > do something like extend target_stopped_data_address to also return > what sort of watchpoint was triggered, if it knows. Yes, that would be a welcome addition, I agree.