Intel® System Debugger User Guide

ID 648476
Date 06/13/2024
Confidential
Document Table of Contents

Collecting Execution Trace

Typical debugging workflows can be described as follows:

  • Backwards traversal:

    1. Determine the symptoms of the issue.

    2. Place a breakpoint at the place where the symptoms become apparent.

    3. Retrace the execution backwards by unwinding the call stack and checking callers.

      Drawback: In some cases, the call stack might not provide enough information to identify the issue, because it might have originated in a separate execution branch.

  • Forward traversal:

    1. Determine the hierarchy of function calls that lead to the symptom of the issue.

    2. Place a breakpoint at a function that leads to the issue.

    3. Single-step the execution until the symptoms are apparent.

      Drawback: Forward traversal might not work if you have to step through a large number of executions of a code piece to identify the issue. It can also be destructive to issues like race conditions, deadlocks, and others.

In such cases, execution trace can be helpful. Using execution trace, you can place a breakpoint at the location where the issues become apparent and review the code lines that have been executed up to this point.

Launch Trace Capturing

Intel(R) System Debugger supports the following methods for collecting execution trace:

  • Last Branch Record (LBR) - a register-backed hardware feature with limited jump history.

    Note:

    Certain distributions of Linux* OS running on the target disable LBR, which does not allow Intel(R) System Debugger use this method for tracing. If you face such issue, contact your OS vendor or Intel.

  • Intel(R) Processor Trace (Intel(R) PT) - a feature to that allows you to trace thousands of instructions and provides options for configuring the trace.

If you debug virtual target simulation, see Collecting Execution Trace with Simics(R) Simulator.

To record trace with Intel(R) System Debugger:

Note:

The target must be halted before configuring, starting, or stopping instruction tracing.

  1. Halt the target and select the desired debug context in the Debug view.

    Each thread uses specific mechanisms for tracing.

  2. Open the Instruction Trace view and click show_target_breakpoints Configure Instruction Trace.

  3. In the opened dialog box, select the desired method from the Trace Type drop-down list.

  4. You can filter out kernel or user mode instructions or choose to trace all (default) using radio buttons.

  5. If you have selected the Intel(R) PT feature, you can further customize trace parameters. Check Show Advanced Parameters box to expand the dialog.

    1. To specify the search address range, click Add on the right.

    2. In the new dialog box, select the method of defining the address range:

      • Choose to trace instructions belonging to a specific module only. The information on modules currently loaded is displayed in the dialog.

      • Specify the address range manually by entering the values in hexadecimal format.

    3. Click OK to save changes.

      configure_trace

  6. Click OK to close the configuration dialog and start trace capturing by clicking resume Start Instruction Trace.

  7. Resume the target.

  8. To stop trace capturing, halt the target and, in the Instruction Trace view, click terminate Stop Instruction Trace.

  9. Wait for the captured trace to be decoded.

If the console returns the message ITrace: Processor Trace decoding timed out, see the troubleshooting page for suggestions on how to fix the issue.

PTWRITE Instruction and Power Event Tracing Support

If your target platform supports PTWRITE instruction and Power Event tracing, you can get corresponding data in the captured trace results. The event payload is displayed in the Event Description column of the Instruction Trace view.

If no event information is displayed, refer to the Troubleshooting section.

See also:

Intel® 64 and IA-32 Architectures Software Developer Manual, Volume 3C, section 36.2.3 “Power Event Tracing”