Instruction Trace Tool — Intel® SDE documentation

# Instruction Trace Tool

The instruction trace analysis tool is a tool that dumps the executed instructions into a text file. This tool is useful for checking which instructions has been executed in the region of interest (as defined by The Controller).

The output file include a line for each instruction and in this line the information includes the thread ID, the address and the full disassembly.

    % sde -skx -itrace-execute -- myapp

For example, this multi-threaded application will have a dump of the form

    TID0: ITRACE PC=2aaaf21d3b54 vmovdqa ymmword ptr [rdi+0x60], ymm3
    TID1: ITRACE PC=2aaaaaac3cb2 cmp al, byte ptr [rsi]
    TID2: ITRACE PC=2aaaf2193f31 test rax, rax
    TID0: ITRACE PC=2aaaf21d3b59 add rdi, rax
    TID2: ITRACE PC=2aaaf2193f34 jl 0x2aaaf2193f75
    TID1: ITRACE PC=2aaaaaac3cb4 jnz 0x2aaaaaac3cc3

There are a few options to control the output of the instruction trace. One of the options is to dump an histogram of the instruction counts per executed IP (instruction address).

Here are the instruction trace analysis knobs.

`-itrace_count`

  Generate histogram with instruction count per IP [default 0]

`-itrace_disasm`

  Add disassembly to the instruction trace [default 1]

`-itrace_execute`

  Debug/Trace execution [default 0]

`-itrace_execute_emulate`

  Debug/Trace execution of emulation [default 0]

`-itrace_file`

  Output file for execution/instrumentation tracing [default sde-itrace-out.txt]

`-itrace_flush`

  Flush the output buffer after writing [default 0]

`-itrace_instrument`

  Debug/Trace instrumentation [default 0]

`-itrace_instrument_emulate`

  Debug/Trace instrumentation of emulated instructions only [default 0]

`-itrace_lines`

  Number of lines for circular buffer. 0=no circular buffer [default 0]

`-itrace_only_isa`

  Print only ISA set types in the trace [default 0]

`-itrace_rawinst`

  Add instruction’s raw bytes to the trace [default 0]

`-itrace_thread_count`

  Maximal number of counters per thread to allocate for each instruction [default 10]