Debug Support
ARM DDI0145B
Copyright © 1998, 1999 ARM Limited. All rights reserved.
5-35
5.12
The behavior of the program counter during debug
To force the ARM9TDMI to branch back to the place at which program flow was
interrupted by debug, the debugger must keep track of what happens to the PC. There
are six cases:
•
•
.
•
Watchpoint with another exception
•
•
•
In each case the same equation is used to determine where to resume execution. These
are explained below.
5.12.1
Breakpoint
Entry to debug state from a breakpointed instruction advances the PC by 16 bytes in
ARM state, or 8 bytes in Thumb state. Each instruction executed in debug state
advances the PC by one address. The normal way to exit from debug state after a
breakpoint is to remove the breakpoint, and branch back to the previously breakpointed
address.
For example, if the ARM9TDMI entered debug state from a breakpoint set on a given
address and two debug speed instructions were executed, a branch of 7 addresses must
occur (four for debug entry, plus two for the instructions, plus one for the final branch).
The following sequence shows ARM instructions scanned into scan chain 1. This is the
Most Significant Bit
(MSB) first, so the first digit represents the value to be scanned into
the SYSSPEED bit, followed by the instruction.
0 EAFFFFF9 ; B -7 addresses (two’s complement)
1 E1A00000 ; NOP (MOV R0, R0), SYSSPEED bit is set
For small branches, the final branch could be replaced with a subtract with the PC as the
destination. For example,
SUB PC, PC, #28
for ARM code.
5.12.2
Watchpoint
Returning to the program execution after entering debug state from a watchpoint is done
in the same way as the procedure described in
above. Debug entry adds four
addresses to the PC, and every instruction adds one address. Since the instruction after
that which caused the watchpoint has executed, instruction execution will resume at the
one after that.
Summary of Contents for ARM9TDMI
Page 6: ...Contents vi Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...
Page 12: ...Preface xii Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...
Page 16: ...Introduction 1 4 Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...
Page 22: ...Programmer s Model 2 6 Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...
Page 110: ...Test Issues 6 6 Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...
Page 154: ...Index Index 4 Copyright 1998 1999 ARM Limited All rights reserved ARM DDI0145B ...