From: Johan Rydberg <jrydberg@virtutech.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
gdb@sources.redhat.com, Vladimir Prus <ghost@cs.msu.su>
Subject: Re: read watchpoints ignored?
Date: Mon, 14 Nov 2005 13:16:00 -0000 [thread overview]
Message-ID: <43788E28.90108@virtutech.com> (raw)
In-Reply-To: <20051114024345.GB10567@nevyn.them.org>
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 <jrydberg@virtutech.com>
* 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;
next prev parent reply other threads:[~2005-11-14 13:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-11 13:22 Vladimir Prus
2005-11-11 18:19 ` Eli Zaretskii
2005-11-13 16:45 ` Daniel Jacobowitz
2005-11-13 22:38 ` Eli Zaretskii
2005-11-14 2:43 ` Daniel Jacobowitz
2005-11-14 4:38 ` Eli Zaretskii
2005-11-14 14:42 ` Daniel Jacobowitz
2005-11-15 4:02 ` Eli Zaretskii
2005-11-14 10:10 ` Vladimir Prus
2005-11-14 14:41 ` Daniel Jacobowitz
2005-11-14 14:45 ` Daniel Jacobowitz
2005-11-15 4:02 ` Eli Zaretskii
2005-11-14 13:16 ` Johan Rydberg [this message]
2005-11-14 13:42 ` Vladimir Prus
2005-11-14 13:59 ` Johan Rydberg
2005-11-14 14:10 ` Vladimir Prus
2005-11-15 4:01 ` 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=43788E28.90108@virtutech.com \
--to=jrydberg@virtutech.com \
--cc=drow@false.org \
--cc=eliz@gnu.org \
--cc=gdb@sources.redhat.com \
--cc=ghost@cs.msu.su \
/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