Debug state

Debug state is the basis of the external debug model. The external debugger programs the debug logic to cause Debug state on the occurrence of debug events. External debug is also called halting debug mode. When the PE enters Debug state, the following things happen, in this order:

  • The PE stops executing instructions from the location that the Program Counter indicates. Instead, the debugger controls the PE through the external debug interface.

  • The debugger uses the Instruction Transfer Register (ITR), through the external debug interface, to pass instructions to the PE to execute in Debug state.
    • Using the instructions that are executed through the ITR, the debugger can read/write architectural registers, for example general-purpose registers, System registers, and Floating Point registers.
    • Using the instructions that are executed through the ITR, the debugger can read/write to memory locations.
    • The Data Transfer Registers of the DCC are accessible by both the external debug interface and the System register interface. The DCC plays an important role in exchanging data between the PE and the external debugger.
  • The PE cannot service interrupts in Debug state.
Debug state entry and exit

When the PE enters Debug state:

  • The PSTATE of the PE, before entering Debug state, is stored in the Debug Saved Program Status Register (DSPSR).
  • The preferred restart address is stored in the Debug Link Register (DLR).
  • The PE stops execution of the code that is pointed by the Program Counter.
  • Interrupts are not serviced.
  • External debugger takes control of the PE.

While the PE is in Debug state, the external debugger can:

  • View and modify the contents of memory locations and architectural registers, including DLR and DSPSR.
  • Use the ITR to pass instructions to the PE to execute in Debug state.
  • Use the Debug Communications Channel (DCC) to pass data to the PE, and to receive data from the PE.
  • Change Exception levels, by using the DCPS and DRPS instructions.
  • Exit Debug state by triggering a Restart request.

On a restart request from the external debugger, the PE exits Debug state. When the PE exits Debug state, the PE:

  • Sets the Program Counter to the address in the DLR.
  • Restores PSTATE from DSPSR.
  • Begins execution of instructions pointed by the Program Counter.

The following diagram illustrates Debug state entry and exit:

Debug state entry and exit
Debug state entry and exit

External debug is useful for:

  • Hardware bring-up: Debugging during development when a system is first powered up and some software functionality is not available.
  • Debugging PEs that are deeply embedded inside systems
Previous Next