From: Orjan Friberg <orjan.friberg@axis.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Hardware watchpoints; dealing with false triggers?
Date: Wed, 21 Nov 2001 17:14:00 -0000 [thread overview]
Message-ID: <3C07B6FE.BBFA048D@axis.com> (raw)
Message-ID: <20011121171400.TrkgiSacc67LSnRY0QKdsG4LzcIIHmV9zmkj8N44cCY@z> (raw)
In-Reply-To: <Pine.SUN.3.91.1011129164553.14665E-100000@is>
Eli Zaretskii wrote:
>
> On Thu, 29 Nov 2001, Orjan Friberg wrote:
>
> > But consider the following: say your watchpoint registers can only watch
> > 4-byte aligned areas of 4 bytes, but you want to rwatch (or awatch) an
> > unaligned variable of size 4 bytes. You'd have to use two watchpoint
> > registers, both covering too much, like this:
> >
> > Variable to watch: | 0 1 2 3 |
> > Watchpoints: | 0 1 2 3 | 0 1 2 3 |
> > wp1 wp2
>
> This shouldn't happen, and it indeed does not happen with x86. x86 uses
> 2 debug registers in this case, like so:
Eli,
Many thanks for your detailed response.
Maybe I should clarify that I'm not talking about the x86, but a
hypothetical target whose watchpoint mechanism would function this way.
I was only using the i386 hardware watchpoint implementation as a
reference and a basis for discussion.
> > Now, say a there's a read of wp1's byte 0. The hardware would trigger,
> > but it would be a false trigger. Gdb would somehow have to find out the
> > actual address that was read and if it was found to be outside of the
> > variable's range it would not trigger the watchpoint.
>
> You can't do that, at least not with x86 debug registers: when a
> watchpoint triggers, you don't know what byte of its covered memory was
> written to. All you know is that memory covered by a specific register
> was written.
Ok, but say that the actual address is shipped with the register packet
when the target stops so that gdb in fact knows what address was
actually read/written. I'm thinking gdb could compare that address with
the watchpoints, and just send the target on its way if the address is
outside the watched ranges.
I'm thinking of the implementation of this in a cross-environment, and
while you could do it on the target side, say in the kernel, I'd rather
not since I could potentially have several stubs. Handling it on the
host side would allow me to handle it in one place only.
> > are
> > there any major obstacles for implementing such target-dependent false
> > trigger handling in gdb?
>
> IIRC, no. If you cannot do something similar to what x86 does, I think
> you are in for a bumpy ride, as GDB doesn't handle such problems very
> well. Your best bet would be to solve this in the target-specific
> low-level code.
And this is the key issue: could the interface to the target-specific
code be extended to handle the concept of "actual watchpoint address"?
Or rather, could it be made to fit in nicely with the existing
framework, or would it require a horrible kludge? (Maybe this question
is on a too general level, and I just have to dig deeper into the code
to see what would actually be needed.)
> Do you really have such a strange target? Can you tell the details?
No, I don't actually have such a target, so I'm sorry; I can't tell any
details.
--
Orjan Friberg
Axis Communications AB
next prev parent reply other threads:[~2001-11-30 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-29 6:25 Orjan Friberg
2001-11-19 11:58 ` Orjan Friberg
2001-11-19 12:06 ` Eli Zaretskii
2001-11-29 7:01 ` Eli Zaretskii
2001-11-30 8:44 ` Orjan Friberg [this message]
2001-11-21 17:14 ` Orjan Friberg
2001-11-22 13:19 ` Eli Zaretskii
2001-11-30 10:33 ` Eli Zaretskii
2001-12-04 3:09 ` Orjan Friberg
2001-12-04 3:43 ` Eli Zaretskii
2001-12-04 5:51 ` Orjan Friberg
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=3C07B6FE.BBFA048D@axis.com \
--to=orjan.friberg@axis.com \
--cc=eliz@is.elta.co.il \
--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