Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Orjan Friberg <orjan.friberg@axis.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: drow@false.org, gdb-patches@sources.redhat.com
Subject: Re: Display of read/access watchpoints when HAVE_NONSTEPPABLE_WATCHPOINT
Date: Fri, 16 Apr 2004 09:46:00 -0000	[thread overview]
Message-ID: <407FAB42.4070409@axis.com> (raw)
In-Reply-To: <7494-Fri16Apr2004101245+0300-eliz@gnu.org>

Eli Zaretskii wrote:
>>Date: Thu, 15 Apr 2004 15:23:59 +0200
>>From: Orjan Friberg <orjan.friberg@axis.com>
>>
>>The test program (repeated below) *does* work for i386 (though I didn't 
>>say that), because it also stops when foo is written (thus updating the 
>>value of foo when watchpoint_check is called), so by the time it stops 
>>when the second read happens the value hasn't changed since the last 
>>time and GDB decides it's a valid hit.
> 
> 
> Right; sorry I forgot about that.  It's been a long time since I
> hacked that part of GDB.

Apologies; I didn't mean to imply that that was obvious.  (I certainly 
didn't know that was why it worked on the i386 when I posted the example 
in the first place.)

>>1. Add a check if the target cannot set "pure" read watchpoints to the 
>>b->type == bp_read_watchpoint check at WP_VALUE_CHANGED (my 
>>interpretation of Eli's suggestion).
> 
> 
> On balance, this is probably the best solution, although it's not
> quite clean.  The ability to set read watchpoints would be part of the
> architecture vector, right?

Yes, I think so.  Also, this seems like the least intrusive change. 
(Nevertheless, since you were kind enough to comment on the other 
suggestions, I'll continue the discussion of them.)

>>2. Somehow don't update the value in watchpoint_check when it's a false 
>>hit.  (Then the b->type == bp_read_watchpoint check at WP_VALUE_CHANGED 
>>isn't needed.)
> 
> 
> Wouldn't this reintroduce the bug that I was trying to solve back
> then?  That is, will GDB still DTRT when both rwatch and watch are set
> at the same variable?

You're right; this won't work.  I failed to account for the fact that 
the code *relies* on the i386 stopping (and updating the value) when 
writing to an rwatched variable.

In addition, I'm not sure how we'd detect a false hit for the i386 (the 
"somehow" part).  For my upcoming target, I have bits telling me if it 
was a read or write that caused the exception.

>>3. Add some distinction between "wanted watchpoint type" and "actual 
>>watchpoint type".
> 
> 
> Any specific ideas how to do that?  For that matter, what is ``wanted
> watchpoint type'', and how can we decide that?

The idea was that when inserting a watchpoint, target_insert_watchpoint 
would return the type of watchpoint that was actually inserted.  So, for 
the i386 an insertion of a read watchpoint would return an access 
watchpoint (if I've understood correctly).  The breakpoint struct would 
then have an additional field storing this returned value.

In bpstat_stop_status, the code would then be something like

   case WP_VALUE_CHANGED:
     if (b->type == bp_read_watchpoint
         && b->actual_type == bp_access_watchpoint)
       /* Don't stop.  */
       ...


I'll have a look at implementing the first suggestion.  Thanks.

-- 
Orjan Friberg
Axis Communications


  reply	other threads:[~2004-04-16  9:46 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
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 [this message]
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=407FAB42.4070409@axis.com \
    --to=orjan.friberg@axis.com \
    --cc=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.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