Enabling external debug
External debug mode does not include any global enable bits. For each external debug event, corresponding control bits can be programmed to enable halting of the processor for that external debug event.
Breakpoints and watchpoints are resources that are shared between self-hosted debuggers and external debuggers. Setting EDSCR.HDE to 1 causes breakpoints and watchpoints to halt the PE.
External debuggers may need to authenticate themselves. If an external debugger does not authenticate itself, halting of an Arm implementation might be prohibited. Details of the authentication are IMPLEMENTATION DEFINED. Authentication may exist in hierarchical fashion. This means that a level of authentication might be required during which halting might be enabled at Non-secure execution of the PE. Another level of authentication might be required to allow halting in a Secure execution of the PE.
Handshake between the external debugger and the PE
The external debugger takes control of the PE when the PE enters Debug state. The external debugger also initiates the PE to exit Debug state, to continue normal execution of the program. The mechanism that is used to transfer control between the external debugger and the PE is called a handshake. Let’s look at this in more detail.
A typical handshake between the external debugger and the PE includes the following actions, in this order:
- The external debugger configures the debug logic of the PE to generate debug events at the point of interest in the program execution. For example, the external debugger configures a breakpoint on the start address of a subroutine.
- When the program reaches the point of interest a debug event is generated, causing the PE to enter Debug state. The external debugger registers of the PE indicate the status of the PE in Debug state.
- The external debugger polls for the external debug registers of the PE to indicate Debug state.
- The external debugger queries the program state and issues a restart request to the PE.
The following diagram and table illustrate the handshake sequence between the external debugger and the core:
External debugger and core handshake sequence
|External debugger action||Core action|
|Step 1||The external debugger programs Debug logic for the debug event, either by programming the Debug logic or by asserting a debug halt request.|
|Step 2||The external debugger polls its status register until the core enters debug state.|
|Step 3||During normal code execution, the core enters debug state on an debug event.|
|Step 4||The external debugger takes control of the core.|
|Step 5||The external debugger engages in its activities, for example, it reads status, modifies status, and runs instructions.|
|Step 6||Post external debugger activities, the external debugger requests debug exit.|
|Step 7||The core exits debug state when possible.|
|Step 8||The core resumes normal execution based on the Program Counter and PSTATE.|