From: "Eli Zaretskii" <eliz@is.elta.co.il>
To: ac131313@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa:breakpoint] Correctly count watchpoints
Date: Mon, 30 Sep 2002 11:26:00 -0000 [thread overview]
Message-ID: <9743-Mon30Sep2002212639+0200-eliz@is.elta.co.il> (raw)
In-Reply-To: <3D987D2D.6010605@redhat.com> (message from Andrew Cagney on Mon, 30 Sep 2002 12:34:53 -0400)
> Date: Mon, 30 Sep 2002 12:34:53 -0400
> From: Andrew Cagney <ac131313@redhat.com>
>
> Each watch
> element / location / value in the watchpoint expression is assumed to
> consume one watch resource.
Given that this assumption doesn't hold on at least one very popular
architecture, is it a useful assumption?
> Anyway, the problem you refer to is why I was thinking of re-defining
> TARGET_REGION_OK_FOR_HW_WATCHPOINT() so that it returns the number of
> watchpoint resources required to watch addr/len. If {&a, sizeof a}
> required two registers it could return two.
But this is very hard or even impossible to do in practice. For
example, on a i386, if there are two watchpoint that watch the same
4-byte aligned int variable, you need only one debug register to watch
them both, so counting each one as taking one resource is incorrect.
But you cannot return the correct result unless you are presented with
the entire list of watchpoints GDB would like to set. Alas, GDB's
application code examines the watchpoints one by one and queries the
target vector about each one of them in order. Thus, the target
vector doesn't see the whole picture and therefore cannot give the
right answer.
What is the value of the result you get if we _know_ in advance that
it will be incorrect, sometimes grossly incorrect, in some not very
rare cases?
> I think it would be helpful if, at least in maintainer mode, the user
> could see how many resources have been allocated to a watchpoint.
If this is for maintainers, the count should be accurate. The i386
native debugging implements a maintainer-mode command to do that, but
it manipulates target-side data, and only works after all watchpoints
have been inserted.
> (I've a sinking feeling that hardware breakpoints have the same problem
> ...).
Indeed they do.
next prev parent reply other threads:[~2002-09-30 18:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-29 20:34 Andrew Cagney
2002-09-29 22:40 ` Eli Zaretskii
2002-09-30 9:34 ` Andrew Cagney
2002-09-30 11:26 ` Eli Zaretskii [this message]
2002-09-30 12:42 ` Andrew Cagney
[not found] <3D98A393.6010801@redhat.com>
2002-09-30 21:54 ` Eli Zaretskii
2002-09-30 23:00 ` Andrew Cagney
2002-10-01 11:23 ` 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=9743-Mon30Sep2002212639+0200-eliz@is.elta.co.il \
--to=eliz@is.elta.co.il \
--cc=ac131313@redhat.com \
--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