Evgeniy Stepanov | 79b2d17 | 2013-02-22 09:34:19 +0000 | [diff] [blame] | 1 | Experimental DynamoRIO-MSAN plugin (codename "MSanDR"). |
| 2 | Supports Linux/x86_64 only. |
| 3 | |
| 4 | Building: |
| 5 | 1. First, download and build DynamoRIO: |
| 6 | (svn co https://dynamorio.googlecode.com/svn/trunk dr && \ |
| 7 | cd dr && mkdir build && cd build && \ |
| 8 | cmake -DDR_EXT_DRMGR_STATIC=ON -DDR_EXT_DRSYMS_STATIC=ON \ |
Evgeniy Stepanov | b6c3c12 | 2013-09-02 14:21:12 +0000 | [diff] [blame] | 9 | -DDR_EXT_DRUTIL_STATIC=ON -DDR_EXT_DRWRAP_STATIC=ON \ |
| 10 | -DDR_EXT_DRX_STATIC=ON .. && \ |
Evgeniy Stepanov | 79b2d17 | 2013-02-22 09:34:19 +0000 | [diff] [blame] | 11 | make -j10 && make install) |
| 12 | |
| 13 | 2. Download and build DrMemory (for DrSyscall extension) |
| 14 | (svn co http://drmemory.googlecode.com/svn/trunk/ drmemory && \ |
| 15 | cd drmemory && mkdir build && cd build && \ |
| 16 | cmake -DDynamoRIO_DIR=`pwd`/../../dr/exports/cmake .. && \ |
| 17 | make -j10 && make install) |
| 18 | |
| 19 | NOTE: The line above will build a shared DrSyscall library in a non-standard |
| 20 | location. This will require the use of LD_LIBRARY_PATH when running MSanDR. |
| 21 | To build a static DrSyscall library (and link it into MSanDR), add |
| 22 | -DDR_EXT_DRSYSCALL_STATIC=ON to the CMake invocation above, but |
| 23 | beware: DrSyscall is LGPL. |
| 24 | |
| 25 | 3. Now, build LLVM with two extra CMake flags: |
| 26 | -DDynamoRIO_DIR=<path_to_dynamorio>/exports/cmake |
| 27 | -DDrMemoryFramework_DIR=<path_to_drmemory>/exports64/drmf |
| 28 | |
| 29 | This will build a lib/clang/$VERSION/lib/linux/libclang_rt.msandr-x86_64.so |
| 30 | |
| 31 | Running: |
| 32 | <path_to_dynamorio>/exports/bin64/drrun -c lib/clang/$VERSION/lib/linux/libclang_rt.msandr-x86_64.so -- test_binary |
| 33 | |
| 34 | MSan unit tests contain several tests for MSanDR (use MemorySanitizerDr.* gtest filter). |
Evgeniy Stepanov | 48abc61 | 2013-09-13 11:00:50 +0000 | [diff] [blame] | 35 | |
| 36 | Debugging: |
| 37 | Add -DCMAKE_BUILD_TYPE=Debug to the first and/or second cmake invocation(s). |
| 38 | Add -debug -v to drrun invocation line (right before -c). |
| 39 | Add -checklevel 1 to drrun (as the first argument) to make debug DR faster. |
| 40 | |