DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.63k stars 557 forks source link

Add cross-architecture drcachesim trace analysis and postprocessing support #4318

Open derekbruening opened 4 years ago

derekbruening commented 4 years ago

It is useful to be able to analyze and post-process drcachesim offline traces gathered on one architecture on a different platform: e.g., to trace an ARM application and pull the trace onto an x86 machine for analysis.

Most of the analysis code is already cross-platform, but the decoder for tools like opcode_mix is the key missing piece. We would need something like #1684 to continue using DR's decoder there, but we'd need it in full DR and not just drdecodelib (because raw2trace uses full DR and it is complex to downgrade it).

derekbruening commented 4 years ago

Pasting from PR #4325 :

Here's the key test in the new Travis job for drcachesim: https://travis-ci.com/github/DynamoRIO/dynamorio/jobs/353366354

3109    Start 6: code_api|tool.drcacheoff.altbindir
3110
31116: Test command: /home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/bin64/runstats "-s" "90" "-killpg" "-silent" "-env" "LD_LIBRARY_PATH" "/home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/lib64/debug:/home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/ext/lib64/debug:" "-env" "DYNAMORIO_OPTIONS" "-stderr_mask 0xC -dumpcore_mask 0 -code_api" "/home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/clients/bin64/drcachesim" "-indir" "/home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/drmemtrace.threadsig.aarch64" "-simulator_type" "opcode_mix" "-alt_module_dir" "/home/travis/build/DynamoRIO/dynamorio/clients/drcachesim/tests/drmemtrace.threadsig.aarch64.raw" "-module_file" "/home/travis/build/DynamoRIO/dynamorio/build_aarch64-on-x86/drmemtrace.threadsig.aarch64/raw/modules.log"
31165/6 Test #5: code_api|api.drdecode ................   Passed    0.00 sec
31176: Opcode mix tool results:
31186:          125442 : total executed instructions
31196:           15742 :     bcond
31206:           15165 :       stp
31216:           13670 :      subs
31226:           12240 :       add
31236:            8286 :       and
31246:            6059 :        xx
...

So it's x86 drraw2trace and opcode_mix analyzers operating on aarch64 traces. Pretty cool.