Getting Started — Intel® SDE documentation

# Getting Started

## Running Intel® SDE

Intel® SDE is application level binary instrumentation based emulator. Running Intel® SDE on applications is of the following pattern:

    % <path-to-kit>/sde [sde args] -- user-application [app args]

The double dash (’–’) is important. Options to SDE go before the double dash. Square brackets denote optional arguments. Intel® SDE comes with short and long help messages. To see the short help message use:

    % <path-to-kit>/sde -help

The long help message is very long

    % <path-to-kit>/sde -long-help

In the help messages, the command line options are often displayed using underscores between words, but dashes may be used instead of underscores. Often the Intel® SDE help messages and this web page will refer to command line options as “knobs” for historical reasons.

The short help message contains some top level analysis tools knobs as well as the list of supported CPUs.

The ‘sde’ binary in the kit can run both 32 bits and 64 bits binaries. In Linux, the ‘sde’ binary is a 32 bits binary, and it can run only when the host supports running 32 bits applications. Intel® SDE kit has also the ‘sde64’ binary, which can be used when the host supports only 64 bits applications.

Intel® SDE provides many emulated CPUs to choose, both old and new CPUs. When choosing a CPU, you instruct Intel® SDE to verify that every executed instruction is legal (i.e. supported) by the given CPU, and to emulate the behavior of the CPUID instruction as if running on the emulated CPU. When not specifying the emulated CPU, then Intel® SDE takes the host as the executing CPU. More information on checking for legal instructions is available in the Chip Check Feature and the CPUID Emulation sections.

## Emulate Everything Mode

Intel® SDE inject itself to sub-processes created during the run. Therefore, when you run Intel® SDE on a shell or command application, it will emulate all the processes launched in this session. On Linux you can run your favorite shell (e.g. tcsh) as with:

    % <path-to-kit>/sde -icl -- /bin/tcsh

This runs the shell and everything inside it as ICELAKE CPU. Similarly, on Windows you can use:

    % <path-to-kit>/sde -icl -- cmd.exe

Note

You may experience a slow down even when the applications you are running do not need emulation, as in this mode, everything invoked is running under the control of Intel® SDE.

## Environment Variables

Normally, Intel® SDE pass the environment variables set in the current shell to the application to run. Intel® SDE also allow users to specify environment variables that will be set for the application.

    % <path-to-kit>/sde -icl -env MY_ENV_VAR "VALUE" -- myapp

## Error Messages

Normally, Intel® SDE doesn’t emit messages during the run. When an error condition is detected then Intel® SDE emits the error message into two locations, the standard error and a special error file with a default name sde-error.txt. The error output file is needed when the standard error stream is not available or already been closed.

Intel® SDE allows users to specify their name for the error output file. By specifying an output file, users can capture and review errors conveniently without cluttering the console.

    % <path-to-kit>/sde -icl -err-filename my_error_file.txt -- myapp

## Attach to a Running Process

In most cases, the user would like to run the application under Intel® SDE control from launch time till the end of the run. In this case every instruction is executed under the Intel® SDE control and therefore instructions like CPUID are intercepted and emulated according to the input CPU.

Intel® SDE allows the user to attach to a running process. In this case all the instructions executed prior to the attach point, were executed natively, meaning that they have been executed without emulation. This mode is useful for running analysis tool or for recording the application skipping long initialization phases and attaching close to the point of interest.

When attaching to a running process, the user should not specify application.

    % <path-to-kit>/sde -mix -attach-pid 20396

Note

When attaching to a running process, Intel® SDE exits immediately and it doesn’t wait for the process to finish as when launching the application.

## Windows Installation

Whenever installing Intel® SDE on Windows without Visual Studio installed Make sure you have VC runtime 32 bit installation on your host. <https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170>