From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13873 invoked by alias); 9 Jun 2006 15:40:43 -0000 Received: (qmail 13865 invoked by uid 22791); 9 Jun 2006 15:40:43 -0000 X-Spam-Check-By: sourceware.org Received: from ausmtp04.au.ibm.com (HELO ausmtp04.au.ibm.com) (202.81.18.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Jun 2006 15:40:41 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.6/8.13.5) with ESMTP id k59Fhx1w250112 for ; Sat, 10 Jun 2006 01:43:59 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.250.237]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k59FhwQ7204366 for ; Sat, 10 Jun 2006 01:43:58 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k59FebH3021343 for ; Sat, 10 Jun 2006 01:40:37 +1000 Received: from sig-9-65-73-159.mts.ibm.com (sig-9-65-73-159.mts.ibm.com [9.65.73.159]) by d23av04.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k59FeX9T020963 for ; Sat, 10 Jun 2006 01:40:35 +1000 Date: Fri, 09 Jun 2006 15:40:00 -0000 From: Wu Zhou To: gdb-patches@sourceware.org Subject: [ppc-linux-nat]: set access flag for h/w watchpoint even if it is only read or write Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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-06/txt/msg00096.txt.bz2 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. Here is the patch. Thanks for reviewing. 2006-06-09 Wu Zhou * ppc-linux-nat.c (ppc_linux_insert_watchpoint): Set access flag for all hardware watchpoint. --- ppc-linux-nat.c.orig 2006-06-09 14:53:35.000000000 +0800 +++ ppc-linux-nat.c 2006-06-09 15:04:12.000000000 +0800 @@ -821,22 +821,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR a long dabr_value; ptid_t ptid = inferior_ptid; - dabr_value = addr & ~7; - switch (rw) - { - case hw_read: - /* Set read and translate bits. */ - dabr_value |= 5; - break; - case hw_write: - /* Set write and translate bits. */ - dabr_value |= 6; - break; - case hw_access: - /* Set read, write and translate bits. */ - dabr_value |= 7; - break; - } + dabr_value = addr | 7; tid = TIDGET (ptid); if (tid == 0) :ADDPATCH ppc: Regards - Wu Zhou