Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Orjan Friberg <orjan.friberg@axis.com>
Cc: eliz@gnu.org, gdb-patches@sources.redhat.com
Subject: Re: Display of read/access watchpoints when HAVE_NONSTEPPABLE_WATCHPOINT
Date: Tue, 06 Apr 2004 14:22:00 -0000	[thread overview]
Message-ID: <20040406142228.GA29473@nevyn.them.org> (raw)
In-Reply-To: <407282F4.2080602@axis.com>

On Tue, Apr 06, 2004 at 12:14:12PM +0200, Orjan Friberg wrote:
> 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?

Presumably, the relevant part of the comment is the second half: "this
is for targets which cannot set read-only watchpoints".  On the other
hand, it does not sound like that code will work for targets which
_can_ set read-only watchpoints.  The patch was:

2000-03-21  Eli Zaretskii  <eliz@is.elta.co.il>

        * breakpoint.c (bpstat_stop_status): Don't stop if a read
        watchpoint appears to break, but the watched value changed.

And since Eli demonstrably knows more than I do about how watchpoints
work, I'm going to defer further comments at this point :)

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2004-04-06 14:22 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-08  8:50 Orjan Friberg
2003-10-08 10:26 ` Eli Zaretskii
2003-10-08 13:36   ` Orjan Friberg
2003-10-08 16:02     ` Paul Koning
2004-04-06 10:14   ` Orjan Friberg
2004-04-06 14:22     ` Daniel Jacobowitz [this message]
2004-04-07  9:11       ` Orjan Friberg
2004-04-15  8:17       ` Eli Zaretskii
2004-04-15 13:24         ` Orjan Friberg
2004-04-16  7:18           ` Eli Zaretskii
2004-04-16  9:46             ` Orjan Friberg
2004-04-16 11:42           ` Orjan Friberg
2004-04-17  8:27             ` Eli Zaretskii
2004-04-19 14:59               ` Orjan Friberg
2004-04-22 15:08                 ` Orjan Friberg
2004-04-22 15:48                   ` Paul Koning
2004-04-22 18:40                   ` Eli Zaretskii
2004-04-22 19:07                     ` Paul Koning
2004-04-22 19:09                       ` Paul Koning
2004-04-23 18:20                       ` Eli Zaretskii
2004-04-23 18:22                   ` Eli Zaretskii
2004-04-26  9:04                     ` Orjan Friberg
2004-04-26  9:25                       ` Eli Zaretskii
2004-05-01 21:18                   ` Mark Kettenis
2004-05-02  4:48                     ` Eli Zaretskii
2004-05-03 11:25                       ` Orjan Friberg
2004-05-03 15:05                         ` Andrew Cagney
2004-05-03 18:01                           ` Eli Zaretskii
2004-05-03 18:36                             ` Andrew Cagney
2004-05-03 17:49                         ` Eli Zaretskii
2004-05-04  7:31                           ` Orjan Friberg
2004-05-04 23:52                             ` Daniel Jacobowitz
2004-05-04 22:10 Ulrich Weigand
2004-05-05  5:08 ` Eli Zaretskii
2004-05-05  8:26   ` Orjan Friberg
2004-05-06  4:58     ` Eli Zaretskii
2004-05-06 14:21       ` Daniel Jacobowitz
2004-05-06 18:02         ` Eli Zaretskii
2004-05-06 18:05           ` Daniel Jacobowitz
2004-05-07  8:18             ` Eli Zaretskii
2004-05-06 21:34   ` Ulrich Weigand
2004-05-06 21:36     ` Daniel Jacobowitz
2004-05-07  8:22       ` Eli Zaretskii
2004-05-07  8:23     ` Eli Zaretskii
2004-05-05 13:44 ` Paul Koning
2004-05-06  5:08   ` Eli Zaretskii
2004-05-06 13:44     ` Paul Koning
2004-05-06 21:38   ` Ulrich Weigand
2004-05-06 21:49     ` Paul Koning
2004-05-07  8:18     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040406142228.GA29473@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=orjan.friberg@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox