From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31956 invoked by alias); 14 Nov 2005 13:16:30 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 31937 invoked by uid 22791); 14 Nov 2005 13:16:27 -0000 Received: from dns.vtab.com (HELO gorgon.vtab.com) (62.20.90.195) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 14 Nov 2005 13:16:27 +0000 Received: from [10.0.0.133] (despair.hq.vtech [10.0.0.133]) by gorgon.vtab.com (Postfix) with ESMTP id 7F735B9145; Mon, 14 Nov 2005 14:16:24 +0100 (CET) Message-ID: <43788E28.90108@virtutech.com> Date: Mon, 14 Nov 2005 13:16:00 -0000 From: Johan Rydberg User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Eli Zaretskii , gdb@sources.redhat.com, Vladimir Prus Subject: Re: read watchpoints ignored? References: <200511111622.01337.ghost@cs.msu.su> <20051113164546.GA465@nevyn.them.org> <20051114024345.GB10567@nevyn.them.org> In-Reply-To: <20051114024345.GB10567@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-11/txt/msg00263.txt.bz2 Daniel Jacobowitz wrote: > I thought this was fairly straightforward, so I didn't go into detail. > Certainly there's no reason to disable rwatch. Conditionalize "skip > this watchpoint if the value has changed" on "this is really an access > watchpoint because the target does not support read watchpoints". > > It should be trivial to fix if you had a platform with read watchpoints > handy. Which I don't easily. I happen to have access to a target that supports true read watchpoints, and the following patch seems to do the trick, at least for the testcase that Vladimir provided. I also quickly tested it against the i386 target, and for that simple test it does not seem to introduce any regressions. Though I can not say that "this is the (right) way to do it", but you could take a peek at it. I suppose the comment in breakpoint.h should be a bit more verbose. 2005-11-14 Johan Rydberg * breakpoint.h: Document why hw_access should be used instead of hw_read for read watchpoints. * breakpoint.c (insert_bp_location): Use hw_access instead of hw_read for read watchpoints. Index: breakpoint.h =================================================================== RCS file: /repository/gdb/gdb/breakpoint.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 breakpoint.h --- breakpoint.h 22 Aug 2005 15:45:43 -0000 1.1.1.1 +++ breakpoint.h 14 Nov 2005 13:01:54 -0000 @@ -177,6 +177,11 @@ disp_donttouch /* Leave it alone */ }; +/* Most targets does not support true read watchpoints so GDB instead + uses access watchpoints, which almost every known target supports, + to provide the same functionality as true read watchpoints. For + this reason, GDB will never insert a real read watchpoint (hw_read). */ + enum target_hw_bp_type { hw_write = 0, /* Common HW watchpoint */ Index: breakpoint.c =================================================================== RCS file: /repository/gdb/gdb/breakpoint.c,v retrieving revision 1.2 diff -u -r1.2 breakpoint.c --- breakpoint.c 20 Oct 2005 16:17:59 -0000 1.2 +++ breakpoint.c 14 Nov 2005 13:08:47 -0000 @@ -978,7 +978,11 @@ len = TYPE_LENGTH (VALUE_TYPE (v)); type = hw_write; if (bpt->owner->type == bp_read_watchpoint) - type = hw_read; + { + /* Use hw_access instead of hw_read for read + watchpoints. Why? See breakpoint.h */ + type = hw_access; + } else if (bpt->owner->type == bp_access_watchpoint) type = hw_access; @@ -1508,7 +1512,11 @@ len = TYPE_LENGTH (VALUE_TYPE (v)); type = hw_write; if (b->owner->type == bp_read_watchpoint) - type = hw_read; + { + /* Use hw_access instead of hw_read for read + watchpoints. Why? See breakpoint.h */ + type = hw_access; + } else if (b->owner->type == bp_access_watchpoint) type = hw_access;