View the drrun command

This example uses the -s or --show-drrun-cmd option when running ArmIE on a binary, to output the full DynamoRIO drrun command that ArmIE uses. The -s option is provided to enable the full range of options for drrun, and to pass command-line arguments to clients. Without this feature, options and arguments would be required to be passed via the armie command.

Prerequisites

Procedure

  1. Run ArmIE with the -s option, using the example described in Get Started:

    armie -msve-vector-bits=128 -s -- ./example

    This returns:

    /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/bin64/drrun -max_bb_instrs 32 -max_trace_bbs 4 -c /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/lib64/release/libsve_128.so -- ./example
    i       a[i]    b[i]    c[i]                                                     
    =============================                                                    
    0       197     283     86
    1       262     277     15
    . . .
    1021    165     234     69
    1022    232     295     63
    1023    204     235     31

    Notice that drrun uses the emulation client libsve_128.so to run the example binary.

  2. If an instrumentation client is specified:

    armie -msve-vector-bits=128 -s -i libinscount_emulated.so -- ./example

    This returns:

    /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/bin64/drrun -client /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/lib64/release/libsve_128.so 0 "" -client /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/samples/bin64/libinscount_emulated.so 1 "" -max_bb_instrs 32 -max_trace_bbs 4 -- ./example
    Client inscount is running . . .
    1022    232     295     63        1023    204     235     31
    2134094 instructions executed of which 1537 were emulated instructions

    Notice that drrun now uses two clients: the emulation client libsve_128.so and libinscount_emulated.so to run and count instructions executed by example.

  3. The libinscount_emulated.so client has an option -only_from_app which only counts instructions executed by the application, rather than including linked libraries in addition. This enables users to copy and paste the above command adding -only_from_app:

    /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/bin64/drrun -client /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/lib64/release/libsve_128.so 0 "" -client /path/to/your/arm-instruction-emulator-<xx.y>_Generic-AArch64_<OS>_aarch64-linux/samples/bin64/libinscount_emulated.so 1 "-only_from_app" -max_bb_instrs 32 -max_trace_bbs 4 -- ./example
    Client inscount is running
    . . .
    1021    165     234     69
    1022    232     295     63
    1023    204     235     31
    42902 instructions executed of which 1537 were emulated instructions

    Notice that the native AArch64 instruction count has dropped to 42902 from 2134094 due to the exclusion of library instructions.

Related information