Debug Support
ARM DDI 0144B
Copyright 1999, 2000 ARM Limited. All rights reserved.
8-37
8.10.3
Watchpoint with another exception
If a watchpoint access simultaneously causes a Data Abort, the ARM940T enters debug
state in abort mode. Entry into debug is held off until the core has changed into abort
mode, and fetched the instruction from the abort vector.
A similar sequence is followed when an interrupt, or any other exception, occurs during
a watchpointed memory access. The ARM940T enters debug state in the same mode as
the exception, and the debugger must check that this happens by looking at the current
and previous mode (in the CPSR and SPSR), and the value of the PC. If an exception
takes place, you must be able to choose to service the exception before debugging.
For example, suppose an abort occurred on a watchpoint access and ten instructions had
been executed to determine this, the following sequence can be used to return program
execution:
0 EAFFFFFC
1 E1A00000
; B -15 addresses (two’s complement)
; NOP (MOV r0, r0), SYSSPEED bit is set
This forces a branch back to the abort vector, causing the instructions at that location to
be refetched and executed. After the abort service routine, the instruction that caused
the abort and watchpoint is re-executed. This causes the watchpoint to be generated and
the ARM940T enters debug state again.
8.10.4
Watchpoint and breakpoint
It is possible to have a watchpoint and breakpoint condition occurring simultaneously.
This can happen when the instruction causes a watchpoint, and the following instruction
has been breakpointed. The same calculation must be performed as for breakpoint (see
Breakpoint
on page 8-36) to determine the address to resume at. In this case, it is at the
breakpoint instruction because this has not been executed.
8.10.5
Debug request
Entry into debug state from a debug request is similar to a breakpoint and, as for
breakpoint entry to debug state, adds four addresses to the PC. Every instruction
executed in debug state adds one.
For example, the following sequence handles a situation where you have invoked a
debug request, and decided to return to program execution immediately:
0 EAFFFFFD
1 E1A00000
; B -5 addresses (2’s complement)
; NOP (MOV r0, r0), SYSSPEED bit is set
This restores the PC, and restarts the program from the next instruction.