Unlike LBR, the processor trace (PT) and the real time instruction trace (RTIT) record trace data inside one or more buffers in the system memory. This allows for very large amounts of trace data. However, it requires that some regions of memory are allocated specifically for tracing.
In most cases, the EFI BIOS is able to configure the trace parameters for you. Locate the PT or RTIT memory allocation options in the BIOS settings and enable automatic trace buffer allocation. The basic options look similar to this:
|Direct Connect Interface||<Disabled>|
|Debug Interface Lock||<Enabled>|
|RTIT Mem Allocation||<4KB>|
|SMM Processor Trace||<Disabled>|
|CPU SMM Enhancement|
In some cases the BIOS might fail to allocate this memory or the option might not be available in the BIOS setting. In those cases you can easily edit the trace configuration using the Configure Trace dialog box.
To open the Configure Trace dialog box, click the Configure Trace menu item in the trace window toolbar.
The dialog box displays the existing trace configuration which you can inspect and modify.
The dialog box has two modes for editing the trace configuration: A simple mode, and an advanced mode. The simple mode satisfies the needs of most users as all they need is to set up some buffers for tracing.
In order to set up trace buffers the simple way, all you need is a region of memory that you know to be unused or that you've allocated yourself:
- Select the simple configuration mode.
- Enter the memory region's address in hexadecimal notation.
- Enter the memory region's size. The size can be entered in human readable format, for example: 1.5MB.
- Press the Create Configuration button.
The dialog calculates an appropriate distribution of buffers and displays the generated configuration.
- If you are satisfied with the generated configuration, click Apply and start debugging.
- If you are not satisfied with the configuration, you can use the advanced configuration mode to fine-tune the parameters as described below.
For advanced users, the advanced configuration mode allows the fine-tuning of the trace collection parameters:
- Select the advanced configuration mode.
- Select the processor thread that is of interest to you.
- Depending on the target processor you can add tables to a thread.
Tables allow you to easily group multiple trace collection buffers. Each table contains a link to the next table that the processor should start using once this table's buffers are consumed. If a table links back to itself, the processor will keep overwriting this table's buffers. See also the Tip below.
- Depending on the target processor you can add multiple buffers to a table.
The availability of options for buffers is dependent on the CPU type. Buffers offer two parameters: Stop, and Interrupt. If selected, the Stop parameter instructs the processor to stop tracing once this buffer is full. The Interrupt parameter informs the processor to send a Power Management Interrupt (PMI) if the buffer is full. This interrupt can be used as a trigger to halt the target.
- If you are satisfied with the configuration, click Apply and start debugging.
Overwriting behavior can be used to capture only the beginning and the end of a long trace. For example, you can create two tables: Table1 and Table2, where Table1 links to Table2, but Table2 links back to itself. In this care, the processor will only overwrite the second table, leaving the first one intact. Table1 will contain the beginning of the trace, while Table2 will contain the end of the trace.
After configuring the trace buffer the debugger is ready to start tracing code. Run to the place where you want to start your trace, and enable tracing by clicking on the Enable Trace button in the trace window toolbar.
At this point the Trace window will be updated with the latest execution trace every time the execution stops. Single stepping is not recommended when the trace is enabled. Instead, set a breakpoint to the interesting location and let the target run to it or use the configuration parameters described above to control the debugger.