From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28781 invoked by alias); 6 Apr 2004 10:14:28 -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 28717 invoked from network); 6 Apr 2004 10:14:17 -0000 Received: from unknown (HELO miranda.se.axis.com) (193.13.178.2) by sources.redhat.com with SMTP; 6 Apr 2004 10:14:17 -0000 Received: from axis.com (ironmaiden.se.axis.com [10.13.8.120]) by miranda.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id i36AECUm030981 for ; Tue, 6 Apr 2004 12:14:15 +0200 Message-ID: <407282F4.2080602@axis.com> Date: Tue, 06 Apr 2004 10:14:00 -0000 From: Orjan Friberg Organization: Axis Communications User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: Display of read/access watchpoints when HAVE_NONSTEPPABLE_WATCHPOINT References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-04/txt/msg00136.txt.bz2 Eli Zaretskii wrote: > > Anyway, from your description, it is quite clear that if a target > defines HAVE_NONSTEPPABLE_WATCHPOINT, GDB must call > target_stopped_data_address before it disables the watchpoint and > steps over it, or else the target end should store the necessary info > somewhere and deliver it when target_stopped_data_address is called. > > In other words, it sounds like a bug. I had missed a previous thread on the subject, initiated by Paul Koning (starting at http://sources.redhat.com/ml/gdb-patches/2003-05/msg00506.html). Paul sent me a patch for 5.3 which no longer applies cleanly, and with his blessings I'm trying to update his patch to the current CVS. Doing that, I encountered a problem with read watchpoints (rwatch command): in insert_breakpoints, before calling insert_bp_location, the current value of the watched expression is read. Then in bpstat_stop_status, when the watchpoint has hit, there's the following code snippet: case WP_VALUE_CHANGED: if (b->type == bp_read_watchpoint) { /* Don't stop: read watchpoints shouldn't fire if the value has changed. This is for targets which cannot set read-only watchpoints. */ bs->print_it = print_it_noop; bs->stop = 0; continue; } ++(b->hit_count); break; So, if we're "read watching" a variable that indeed has changed since we read it before inserting it we decide not to stop. Here's another example (foo is rwatched): volatile int foo = 0; int a; a = foo; /* foo read; stops. */ foo = 1; a = foo; /* foo read; doesn't stop because value changed. */ The "Don't stop" comment is consistent with the behaviour, so it seems like this is intended. What am I missing here? -- Orjan Friberg Axis Communications