![]() ![]() | |||
![]() ![]() | ![]() ![]() | ||
| |||
| Home > Program Flow Tracing > About Program Flow Tracing | |||
When tracing processor execution, other ARM trace architectures generate trace for every instruction that the processor commits for execution. This generates trace that is easy to interpret, but it normally requires a high trace bandwidth. The Program Flow Trace (PFT) architecture assumes that any trace decompressor has a copy of the program being traced, and generally outputs only enough trace for the decompressor to reconstruct the program flow. However, its trace output also enables a decompressor to reconstruct the program flow when it does not have a copy of parts of the program, for example because the program uses self-modifying code.
The PFT architecture also provides full information about exceptions, and the instruction set state, security state, and current Context ID of the processor. It can also provide cycle count information, and timestamping.
A trace macrocell that implements the PFT architecture is called a Program Trace Macrocell (PTM).
PFT identifies certain instructions in the program, and certain events, as waypoints. A waypoint is a point where instruction execution by the processor might involve a change in the program flow. A PTM only traces these waypoints.
PFT waypoints include:
all indirect branches
conditional and unconditional direct branches
all exceptions
any instruction that changes the instruction set state or security state of the processor
when Halting debug-mode is enabled, entering or leaving Debug state
synchronization primitives.
When a waypoint occurs, the PTM generates trace data that describes the waypoint. From this data, a trace decompressor can determine how many instructions have been executed since the previous waypoint, and therefore can reconstruct the execution stream. In effect, the PTM outputs an indicator at each waypoint, and the decompressor matches these indicators with the waypoints in the program code, to reconstruct the program flow.
To provide this waypoint matching, certain instructions are treated as waypoint instructions, regardless of whether:
they pass or fail their condition code check
they are part of an IT block, if they are Thumb instructions.
Waypoint instructions are a subset of the waypoints that a PTM traces:
A waypoint instruction is an instruction that might cause a change in the program flow, and that can be statically determined from the program image.
Some instructions might cause a waypoint, but cannot be statically determined from the program image. These are not waypoint instructions. Typically, these are instructions that cause an exception or are affected by an exception. The PTM traces the exception as a waypoint, but that trace does not correspond to a waypoint instruction.
PFT only traces execution at waypoints. Tracing a waypoint implies the execution of all instructions from the target address of the previous waypoint up to the current waypoint. Nonwaypoint instructions are not traced explicitly, and a debugger can infer the execution of a block of contiguous instructions between two waypoints only when the waypoint at the end of the block is traced. The concept of a block of instructions is used throughout this document, and refers to the contiguous block of instructions between two waypoints.
The following subsections give more information about PTM tracing: