Skip to content

Commit

Permalink
Merge branch 'feature/dr8' into 'master'
Browse files Browse the repository at this point in the history
Add support for DR 8.0

See merge request multicore/drace!125
  • Loading branch information
fmoessbauer committed May 5, 2020
2 parents 0bbdfeb + 6223f8d commit 27636c2
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 70 deletions.
63 changes: 32 additions & 31 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
variables:
PROJECT_NAME: "DRace"
GIT_SUBMODULE_STRATEGY: "normal"
DR_VERSION: "7.91.18369"
DR_VERSION: "8.0.18373"
DR_ABI: "8.0"
_NT_SYMBOL_PATH: "SRV*c:\\symbolcache\\*https://msdl.microsoft.com/download/symbols"
http_proxy: $CODE_PROXY
https_proxy: $CODE_PROXY
Expand All @@ -28,7 +29,7 @@ cppcheck:
<<: *globals
stage: test
script:
- cd build-dr791; C:\opt\Cppcheck\cppcheck.exe --project=compile_commands.json --enable=all --inline-suppr --suppressions-list=suppressions.txt --error-exitcode=1 --quiet
- cd win64-dr${DR_ABI}; C:\opt\Cppcheck\cppcheck.exe --project=compile_commands.json --enable=all --inline-suppr --suppressions-list=suppressions.txt --error-exitcode=1 --quiet
needs: ["windows_x64:compile"]

report-converter-test:
Expand Down Expand Up @@ -76,45 +77,47 @@ windows_x64:compile:
- .\contrib\compile-win-x64.bat
artifacts:
paths:
- build-dr791
- win64-dr${DR_ABI}

linux_x64:compile:
<<: *globals
stage: build
tags:
- DOCKER
image: docker.siemens.com/multicore/drace:buildamd64-ci
script:
before_script:
- echo "Release build..."
- if [ ! -d "DynamoRIO-Linux-${DR_VERSION}" ]; then wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-${DR_VERSION}/DynamoRIO-Linux-${DR_VERSION}.tar.gz; fi
- if [ ! -d "DynamoRIO-Linux-${DR_VERSION}" ]; then tar -xf DynamoRIO-Linux-${DR_VERSION}.tar.gz; fi
script:
- sh ./contrib/compile-linux-x64.sh
cache:
key: dynamorio-cache-linux
paths:
- ./DynamoRIO-Linux-${DR_VERSION}
artifacts:
paths:
- build64
- linux-x86-64-dr${DR_ABI}

linux_i386:compile:
<<: *globals
stage: build
tags:
- DOCKER
image: docker.siemens.com/multicore/drace:buildi386-ci
script:
before_script:
- echo "Release build..."
- if [ ! -d "DynamoRIO-Linux-${DR_VERSION}" ]; then wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-${DR_VERSION}/DynamoRIO-Linux-${DR_VERSION}.tar.gz; fi
- if [ ! -d "DynamoRIO-Linux-${DR_VERSION}" ]; then tar -xfDynamoRIO-Linux-${DR_VERSION}.tar.gz; fi
script:
- sh ./contrib/compile-linux-i386.sh
cache:
key: dynamorio-cache-linux
paths:
- ./DynamoRIO-Linux-${DR_VERSION}
artifacts:
paths:
- build32
- linux-i386-dr${DR_ABI}

### Test ###

Expand All @@ -123,19 +126,19 @@ windows_x64:test:
<<: *testing
stage: test
script:
- cd build-dr791
- echo "Use DR 7.91.x"
- cd win64-dr${DR_ABI}
- echo "Use DR ${DR_VERSION}"
# run only FT detector backend, as tsan often fails to alloc mem in low-memory environments
- ctest -j4 -T test --output-on-failure -E "tsan"
- ./bin/drace-system-tests.exe --gtest_output="xml:test-system-results.xml" --gtest_filter="*/0"
artifacts:
paths:
- build-dr791/test-system-results.xml
- build-dr791/Testing/**/Test.xml
- win64-dr${DR_ABI}/test-system-results.xml
- win64-dr${DR_ABI}/Testing/**/Test.xml
reports:
junit:
- build-dr791/test-system-results.xml
- build-dr791/Testing/**/Test.xml
- win64-dr${DR_ABI}/test-system-results.xml
- win64-dr${DR_ABI}/Testing/**/Test.xml
needs: ["windows_x64:compile"]

#once the integration tests in linux are working, uncomment integration tests
Expand All @@ -147,18 +150,18 @@ linux_x64:test:
- DOCKER
image: docker.siemens.com/multicore/drace:buildamd64-ci
script:
- echo "Use DR 7.91.x"
- cd build64
- echo "Use DR ${DR_VERSION}"
- cd linux-x86-64-dr${DR_ABI}
- ctest -j4 -T test --output-on-failure
#- .\test\drace-system-tests --gtest_output="xml:test-system-results.xml"
artifacts:
paths:
#- build64/test-system-results.xml
- build64/Testing/**/Test.xml
#- linux-x86-64-dr${DR_ABI}/test-system-results.xml
- linux-x86-64-dr${DR_ABI}/Testing/**/Test.xml
reports:
junit:
#- build64/test-system-results.xml
- build64/Testing/**/Test.xml
#- linux-x86-64-dr${DR_ABI}/test-system-results.xml
- linux-x86-64-dr${DR_ABI}/Testing/**/Test.xml
needs: ["linux_x64:compile"]

linux_i386:test:
Expand All @@ -169,18 +172,18 @@ linux_i386:test:
- DOCKER
image: docker.siemens.com/multicore/drace:buildi386-ci
script:
- echo "Use DR 7.91.x"
- cd build32
- echo "Use DR ${DR_VERSION}"
- cd linux-i386-dr${DR_ABI}
- ctest -j4 -T test --output-on-failure
#- .\test\drace-system-tests --gtest_output="xml:test-system-results.xml"
artifacts:
paths:
#- build32/test-system-results.xml
- build32/Testing/**/Test.xml
#- linux-i386-dr${DR_ABI}/test-system-results.xml
- linux-i386-dr${DR_ABI}/Testing/**/Test.xml
reports:
junit:
#- build32/test-system-results.xml
- build32/Testing/**/Test.xml
#- linux-i386-dr${DR_ABI}/test-system-results.xml
- linux-i386-dr${DR_ABI}/Testing/**/Test.xml
needs: ["linux_i386:compile"]

# Package
Expand All @@ -192,17 +195,15 @@ windows_x64:bundle:
# for packaging, we just need NPM, hence run in linux container
image: docker.siemens.com/multicore/drace:buildamd64-ci
script:
- cp "contrib/package.json" "."
- cp "contrib/package-lock.json" "."
- echo "Generate Changelog"
- npx generate-changelog
- cp "CHANGELOG.md" "build-dr791/package/doc/"
- cd contrib && npx generate-changelog -f ../CHANGELOG
- cd .. && cp "CHANGELOG.md" "win64-dr${DR_ABI}/package/doc/"
dependencies:
- windows_x64:compile
- windows_x64:test
artifacts:
paths:
- build-dr791/package
- win64-dr${DR_ABI}/package

pages:
stage: package
Expand All @@ -214,7 +215,7 @@ pages:
- job: "windows_x64:test"
artifacts: false
script:
- mv build-dr791/doc/html/ public/
- mv win64-dr${DR_ABI}/doc/html/ public/
artifacts:
paths:
- public
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
#### 1.7.0 (2020-05-05)

##### Chores

* reduce necessary permissions for SHM ([4606dcc7](https://github.com/siemens/drace/commit/4606dcc7ed9a5dd09b9202950a7782a39af45a43))
* speedup ci by using pre-build images ([a44a6fa8](https://github.com/siemens/drace/commit/a44a6fa8b7a94f5b1afa84392c0ef0f583e76877))
* remove is_standard_layout trait, as not working in all compilers ([674e73ac](https://github.com/siemens/drace/commit/674e73acd1586f7c9fab18ee7c25ad35c0e068c4))

##### Continuous Integration

* use DynamoRio 8.0.x ([4d9b3e99](https://github.com/siemens/drace/commit/4d9b3e99c80081b77d489b844579a92793e6d839))
* run package task in container ([b539244f](https://github.com/siemens/drace/commit/b539244f595cbe987eeed8abebb1382eacd2910c))
* use variables to control dr version ([87d25dce](https://github.com/siemens/drace/commit/87d25dcee5a2519dedc9a1197dbaf26a98353323))

##### New Features

* add printer detector to trace calls to the detector API ([85be7a50](https://github.com/siemens/drace/commit/85be7a50fb7d7d7fc36db1bfeda6061833c24b21))
* add support to exclude addresses ([f19eac09](https://github.com/siemens/drace/commit/f19eac0948e6cd516d7da7ad82b98c37c5a77e49))
* add addr-based race suppressions ([b09abe4f](https://github.com/siemens/drace/commit/b09abe4fe6a633679ab12536fb1d0d59f4b53ed2))

##### Bug Fixes

* load tsan early as it uses TLS ([5b854111](https://github.com/siemens/drace/commit/5b854111d14fd21eca2e40303659ec5290b658d3))
* use session-local events instead of global ones ([1c684295](https://github.com/siemens/drace/commit/1c6842953572f2e9e47ae3bad082b6a4f1b34cfe))
* do not print after return in printer ([cbd9d53e](https://github.com/siemens/drace/commit/cbd9d53eb6b9d2f30107beb591eca16aefe71484))
* thread-safety in address exclusion component ([7911c4fd](https://github.com/siemens/drace/commit/7911c4fd1f454d588d3cdd449d2eacd8e2d88df0))

##### Other Changes

* build and publish doc in CI ([c4f11ac8](https://github.com/siemens/drace/commit/c4f11ac8372985ea1624408d1c775ae55a640959))
* improve documentation regarding thread-safety guarantees ([1cc308a4](https://github.com/siemens/drace/commit/1cc308a4daefa36611ceba446d5ee4bceb817e90))

##### Performance Improvements

* remove inheritance in spinlock ([ee67b9af](https://github.com/siemens/drace/commit/ee67b9af9958304a6ab7b48a197461cac4ad2e38))

##### Tests

* make system tests portable ([c88499e3](https://github.com/siemens/drace/commit/c88499e353da28cc50e4d0fdb015be632c82e385))
* streamlined ci ([a10e9157](https://github.com/siemens/drace/commit/a10e91579b8e3ed9f11e4ad49d9c8a69333c5d62))
* disable tsan tests in CI ([dd372986](https://github.com/siemens/drace/commit/dd3729862759fe968c97fa69c7eba8ea04a3128a))
* tweak to support unit tests in debug mode ([c8dacef7](https://github.com/siemens/drace/commit/c8dacef7d906372f8c30da9b2470780a82714cdf))

#### 1.6.1 (2020-03-26)

##### Chores
Expand Down
18 changes: 8 additions & 10 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This project uses three kinds of dependencies:
With external dependencies we refer to software components that are not shipped in this repository, but which are necessary to build or run DRace.

- CMake > 3.8
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) 7.0.x (use weekly releases)
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) 8.0.x (use weekly releases)
- C++11 / C99 Compiler (e.g msvc)

## Git Submodules
Expand Down Expand Up @@ -40,7 +40,6 @@ All submodules are located in the `vendor` directory.

- Boost > 1.65


### Managed Symbol Resolver (MSR)

**Mandatory:**
Expand All @@ -57,11 +56,10 @@ All submodules are located in the `vendor` directory.
These components are adapted or modified for DRace and shipped with the repository.
The exact license wording is found either in the source file directly, or in a dedicated license file in the directory.

| Name | Location | License | Comment |
|--------------|-----------------------------------|-------------|---------|
|LLVM-Tsan | `vendor/tsan` | BSD-Like/MIT| a customized version is included in binary format|
|CoreCLR Header| `ManagedResolver/include/prebuild`| MIT | prebuild version of MIDL files (cannot be build on windows)|
|Ringbuffer | `common/ipc/ringbuffer.cpp` | CC0 | generic ring buffer implementation for embedded targets|
|LossyCounting | `drace-client/include/lcm` | BSD 3-Clause| fast lossy-counting model implementation|
|git-watcher | `CMakeExt/git_watcher.cmake` | MIT | burn in git commit hash into binary|

| Name | Location | License | Comment |
| -------------- | ---------------------------------- | ------------ | ----------------------------------------------------------- |
| LLVM-Tsan | `vendor/tsan` | BSD-Like/MIT | a customized version is included in binary format |
| CoreCLR Header | `ManagedResolver/include/prebuild` | MIT | prebuild version of MIDL files (cannot be build on windows) |
| Ringbuffer | `common/ipc/ringbuffer.cpp` | CC0 | generic ring buffer implementation for embedded targets |
| LossyCounting | `drace-client/include/lcm` | BSD 3-Clause | fast lossy-counting model implementation |
| git-watcher | `CMakeExt/git_watcher.cmake` | MIT | burn in git commit hash into binary |
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and user-level synchronization cannot be detected.

When using the pre-build releases, only DynamoRIO is required:

- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) 7.91.x (use weekly releases)
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) 8.0.x (use weekly releases)
- [Debugging Tools for Windows](https://docs.microsoft.com/de-de/windows-hardware/drivers/debugger/debugger-download-tools) for symbol lookup in .Net runtime libraries (only required for .Net)

## Using the DRace Race Detector
Expand Down Expand Up @@ -242,7 +242,7 @@ A doxygen documentation can be generated by building the `doc` target.

- CMake > 3.8
- C++11 / C99 Compiler
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) > 7.91.x
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) > 8.0.x

For detailed information on all dependencies, see `DEPENDENCIES.md`.

Expand Down
2 changes: 1 addition & 1 deletion common/version/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
* git tag and commit hash to the binary.
*/

static const char* DRACE_BUILD_VERSION = "1.6.x (git)";
static const char* DRACE_BUILD_VERSION = "1.7.x (git)";
static const char* DRACE_BUILD_HASH = "@GIT_HEAD_SHA1@";
4 changes: 2 additions & 2 deletions contrib/compile-linux-i386.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
root=$(pwd)
dynamorio32=${root}"/DynamoRIO-Linux-${DR_VERSION}/cmake"

mkdir build32
cd build32
mkdir linux-i386-dr${DR_ABI}
cd linux-i386-dr${DR_ABI}
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 -DBOOST_LIBRARYDIR=/usr/lib/i386-linux-gnu -DDynamoRIO_DIR=$dynamorio32 -DDRACE_ENABLE_RUNTIME=1 -DBUILD_TESTING=1 -DDRACE_ENABLE_BENCH=0 -DCMAKE_INSTALL_PREFIX:PATH=package ..

cmake --build .
Expand Down
4 changes: 2 additions & 2 deletions contrib/compile-linux-x64.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
root=$(pwd)
dynamorio64=${root}"/DynamoRIO-Linux-${DR_VERSION}/cmake"

mkdir build64
cd build64
mkdir linux-x86-64-dr${DR_ABI}
cd linux-x86-64-dr${DR_ABI}
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDynamoRIO_DIR=$dynamorio64 -DDRACE_ENABLE_RUNTIME=1 -DBUILD_TESTING=1 -DDRACE_ENABLE_BENCH=0 -DCMAKE_INSTALL_PREFIX:PATH=package ..

cmake --build .
Expand Down
4 changes: 2 additions & 2 deletions contrib/compile-win-x64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ set CC=cl.exe
set CXX=cl.exe

echo "=== Generate drace DR %DR_VERSION% ==="
mkdir build-dr791
cd build-dr791
mkdir win64-dr%DR_ABI%
cd win64-dr%DR_ABI%
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDRACE_XML_EXPORTER=1 -DBOOST_ROOT=C:\\opt\\boost_1_71_0 -DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.13.1\\5.13.1\\msvc2017_64\\lib\\cmake\\Qt5 -DBUILD_TESTING=1 -DDRACE_ENABLE_BENCH=1 -DDynamoRIO_DIR=C:/opt/DynamoRIO-Windows-%DR_VERSION%/cmake -DCMAKE_INSTALL_PREFIX:PATH=package ..

cmake --build . || goto :error
Expand Down
2 changes: 1 addition & 1 deletion contrib/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contrib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drace",
"version": "1.6.1",
"version": "1.7.0",
"description": "Data-race detector for windows applications build on top of DynamoRIO",
"directories": {
"test": "test"
Expand Down
8 changes: 4 additions & 4 deletions drace-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(SOURCES
"src/module/Tracker"
"src/symbol/Symbols"
"src/symbol/SymbolLocation"
"src/util"
"src/util.cpp"
"src/InstrumentationConfig"
"src/RuntimeConfig"
"src/race-filter"
Expand Down Expand Up @@ -49,15 +49,15 @@ target_link_libraries(
"drace-common" # drace and msr common libs
"jtilly-inih" # ini parser
"hh-date" # C++ date lib
"clipp" # option parser
"$<$<CXX_COMPILER_ID:Clang>:atomic>"
"clipp" # option parser
"$<$<CXX_COMPILER_ID:Clang>:atomic>"
)

# Set loglevel
target_compile_definitions("drace-client" PRIVATE "LOGLEVEL=${DRACE_LOGLEVEL}")
# we need a specific base addr, hence disable this warning
if(WIN32)
target_link_libraries("drace-client" -ignore:4281)
target_link_libraries("drace-client" "drace.detector.tsan" -ignore:4281)
target_compile_options("drace-client" PRIVATE -EHsc)
endif()

Expand Down
16 changes: 16 additions & 0 deletions drace-client/include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ std::string to_iso_time(std::chrono::system_clock::time_point tp);

std::string instr_flags_to_str(uint8_t flags);

constexpr bool is_windows() {
#ifdef WIN32
return true;
#else
return false;
#endif
}

constexpr bool is_unix() {
#ifdef UNIX
return true;
#else
return false;
#endif
}

template <typename T>
T unsafe_ptr_cast(void* ptr) {
#pragma warning(suppress : 4302 4311)
Expand Down
Loading

0 comments on commit 27636c2

Please sign in to comment.