| |||
| Home > Debug > Debug state > Behavior of the PC in Debug state | |||
In Debug state:
The PC is frozen on entry to Debug state. That is, it does not increment on the execution of ARM instructions. However, branches and instructions that modify the PC directly do update it.
If the PC is read after the processor has entered Debug state, it returns a value as described in Table 13.17, depending on the previous state and the type of debug event.
If a sequence for writing a certain value to the PC is executed while in Debug state, and then the processor is forced to restart, execution starts at the address corresponding to the written value. However, the CPSR has to be set to the return ARM state or Thumb state before the PC is written to, otherwise the processor behavior is Unpredictable.
If the processor is forced to restart without having performed a write to the PC, the restart address is Unpredictable.
If the PC or CPSR are written to while in Debug state, subsequent reads to the PC return an Unpredictable value.
If a conditional branch is executed and it fails its condition code, an Unpredictable value is written to the PC.
Table 13.17 shows the read PC value after Debug state entry for different debug events.
Table 13.17. Read PC value after Debug state entry
| Debug event | ARM | Thumb | Return address (RA[1]) meaning |
|---|---|---|---|
| Breakpoint | RA+8 | RA+4 | Breakpointed instruction address |
| Watchpoint | RA+8 | RA+4 | Address of the instruction where the execution resumes (several instructions after the one that hit the watchpoint) |
| BKPT instruction | RA+8 | RA+4 | BKPT instruction address |
| Vector catch | RA+8 | RA+4 | Vector address |
| External debug request signal activation | RA+8 | RA+4 | Address of the instruction where the execution resumes |
| Debug state entry request command | RA+8 | RA+4 | Address of the instruction where the execution resumes |
[1] This is the
address of the instruction that the processor first executes on
Debug state exit. Watchpoints can be imprecise. RA is not the address
of the instruction after the one that hit the watchpoint, the processor
might stop a number of instructions later. The address (offset by | |||