Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint

Peter Maydell
2014-09-30T10:18:07Z

On 30 September 2014 11:07, Pedro Alves <palves@redhat.com> wrote:
> WFAR - Watchpoint Fault Address Register
>
> The WFAR is updated to indicate the address of the instruction that
> accessed the watchpointed address:
>
> - the address of the instruction + 8 in ARM state
> - the address of the instruction + 4 in Thumb® state
>
> What wasn't clear to me was whether this meant that the
> instruction at the address of the instruction, and
> at the the address of the instruction +4/+2 (ARM/Thumb) had
> executed completely or not. It's my understanding now that,
> yes, both the instruction that caused the watchpoint and the
> instruction after that one have already been executed.

No, you are misinterpreting this. The WFAR records
the address of the offending instruction + an offset
which you have to correct for. The offset does *not*
have any relation to how many further instructions
the CPU has executed after the offending instruction,
which could be none, one, two or ten. Asynchronous
watchpoints are *asynchronous*, which means there
is no timing guarantee about how soon the CPU will
notice that one has fired and stop executing insns.
The only guarantee you get in v7 is that you'll get
the watchpoint before any exception that might be
caused by a following instruction.

-- PMM