Debug in Depth
ARM DDI 0210C
Copyright © 2001, 2004 ARM Limited. All rights reserved.
B-31
Debug entry adds four addresses to the PC and every instruction adds one address. The
difference from breakpoint operation is that the instruction that caused the watchpoint
has executed and the program must return to the next instruction.
B.9.3
Watchpoint with another exception
If a watchpointed access simultaneously causes a Data Abort, the ARM7TDMI core
enters debug state in abort mode. Entry into debug is prevented until the core changes
into abort mode and has fetched the instruction from the abort vector.
A similar sequence follows when an interrupt, or any other exception, occurs during a
watchpointed memory access. The ARM7TDMI core enters debug state in the mode of
the exception. The debugger must check to see if an exception has occurred by
examining the current and previous mode, in the CPSR and SPSR, and the value of the
PC. When an exception has taken place, you must give the user the choice of servicing
the exception before debugging.
Entry to debug state when an exception has occurred causes the PC to be incremented
by three instructions rather than four and this must be considered in the return branch
calculation when exiting debug state. For example, suppose that an abort occurs on a
watchpointed access and ten instructions have been executed to determine this
eventuality. You can use the following sequence to return to program execution:
0 E1A00000; MOV R0, R0
1 E1A00000; MOV R0, R0
0 EAFFFFF0; B -16
This code forces a branch back to the abort vector, causing the instruction at that
location to be refetched and executed.
Note
After the abort service routine, the instruction that caused the abort and watchpoint is
refetched and executed. This triggers the watchpoint again and the ARM7TDMI core
re-enters debug state.
B.9.4
Debug request
Entry into debug state through a debug request is similar to a breakpoint. However,
unlike a breakpoint, the last instruction has completed execution and so must not be
refetched on exit from debug state. You can assume that entry to debug state adds three
addresses to the PC and every instruction executed in debug state adds one address.
For example, suppose that you have invoked a debug request and decided to return to
program execution straight away. You can use the following sequence:
Содержание ARM7TDMI
Страница 6: ...Contents vi Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 10: ...List of Tables x Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 14: ...List of Figures xiv Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 46: ...Introduction 1 26 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 120: ...Coprocessor Interface 4 18 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 142: ...Debug Interface 5 22 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 276: ...Differences Between Rev 3a and Rev 4 C 6 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 282: ...Glossary Glossary 6 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...