Re: [patch] aarch64: PR 19806: watchpoints: false negatives -> false positives

Yao Qi
2016-06-10T08:11:52Z

Pedro Alves <palves@redhat.com> writes:

> So I'm now thinking that the best is to extend the RSP somehow.
>

I think it is a good idea to extend the RSP...

> I think that my preference is for the target to report a
> memory range instead of a single address in the watchpoint
> stop reply. Like, e.g., if an access to address 10000006 triggers,
> but all the target knows is that some address between 10000004
> and 10000008 was accessed, it reports:
>
> T05 watch:10000004-10000008
>
> instead of:
>
> T05 watch:10000006
>
> ( or maybe T05 watch:10000004;watch-end:10000008 )
>
> This should be easy to implement in the target side, and
> is practically stateless (a stub that just forwards requests
> to a lower level debug api doesn't have to remember
> the addresses gdb requested).
>

Right.

> Then the corresponding target methods in gdb would work with an
> address range instead of a single address too. E.g.,
> target_watchpoint_addr_within_range would be replaced by
> a range overlap check.
>
> If the target knows the process stopped for a watchpoint, but
> doesn't know the address that triggered, then it could report
> the whole address space as range:
>
> T05 watch:00000000-ffffffff
>
> Note that it's not possible currently for a remote stub to tell gdb
> that it doesn't know the address that trapped, even though the
> target_ops:target_stopped_data_address method supports
> returning false, and some native targets do make use of it.
>
> Alternatively, since we're extending the packet anyway, we
> can make the address optional, thus making these equivalent:
>
> T05 watch:00000000-ffffffff
> T05 watch:

I prefer the latter, T05 watch:.

> Alternatively, I though we could add a new qSupported feature value
> that informs gdb of what is the watchpoint alignment and size
> restriction, but I'm not so keen on that since the alignment
> restriction may depend on mode (e.g., 32-bit vs 64-bit inferior),
> or on the size of the area being watched, or some more complicated rule.

Yes, there are different watchpoint alignment restrictions on arm and
aarch64.

--
Yao (齐尧)