DynamoRIO / DynamoRIO/dynamorio

Dr. Memory fails on DR assertion when an empty or trivial .cpp file is added to the build

Open
#544 10 comments 0 reactions 0 assignees View on GitHub
Bug-Assert Migrated OpSys-Linux Priority-Medium
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on August 30, 2011 05:40:45_

Initially filed as https://code.google.com/p/drmemory/issues/detail?id=440 but turns out it's more of a DR problem.

In short, Dr. Memory is a C-only client.
When I try to add a simple C++ file it crashes on start with different symptoms in different configurations.
I'm seeing the following results as of r958 (DrM revision 482 )

Patch 1:
----------------------------------
$ git diff trunk
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 151386b..572f288 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -632,6 +632,7 @@ else (TOOL_DR_HEAPSTAT)
drmemory/alloc_drmem.c
drmemory/syscall.c
drmemory/report.c
- drmemory/empty.cpp
drmemory/replace.c
drmemory/leak.c
drmemory/perturb.c
diff --git a/drmemory/empty.cpp b/drmemory/empty.cpp
new file mode 100755
index 0000000..5f7c77d
--- /dev/null
+++ b/drmemory/empty.cpp
@@ -0,0 +1 @@
+//
----------------------------------
$ mkdir debug && cd debug
$ cmake -DCMAKE_BUILD_TYPE=Debug .. && cmake --build .
$ ./bin/drmemory.exe -- ./tests/hello.exe
DynamoRIO usage error : failure to process imports of client library (dynamorio\core\loader_shared.c, line 120)

the Release build fails to start with a few "WARNING: unable to locate results file since can't open .../resfile" lines printed to stderr.

Patch 2: [attached] // also replaces msvcrt linking with libcmt[d] and adds some simple C++ code to run.
----------------------------------

A larger patch (attached) fails in the Debug build (both DR and DrM are Debug):
...
Usage error: privately-loaded library executed by app:
please report this transparency violation (dynamorio\core\vmareas.c, line 7261)
...
CURIOSITY : name[1] == ':' && (name[2] == '/' || name[2] == '\') && "create file invalid name"
in file dynamorio\core\win32\os.c line 4479
// name = "USER32.DLL" while the drive letter is expected?

If I use Release DR (regardless of the DrM build) it works fine with the second patch.

------------------------------

Are there any known C++ DR clients except for stl_test?

**Attachment:** [empty_cpp_drm.patch](http://code.google.com/p/dynamorio/issues/detail?id=544)

_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=544_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.