summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>2019-07-23 19:43:56 (GMT)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>2019-07-29 14:33:51 (GMT)
commitfd696ae56964f5e08ffe09b4acf1221bfed0de59 (patch)
tree14a5e1a47c9356a60738038c2108026013edfe50
parentd6c5fd363ef8aa14820bf2e1db517392ef8a37e8 (diff)
downloadcoreclr-fd696ae56964f5e08ffe09b4acf1221bfed0de59.zip
coreclr-fd696ae56964f5e08ffe09b4acf1221bfed0de59.tar.gz
coreclr-fd696ae56964f5e08ffe09b4acf1221bfed0de59.tar.bz2
Add debug prints
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r--src/pal/src/loader/module.cpp3
-rw-r--r--src/vm/tizenasanenv.cpp43
2 files changed, 44 insertions, 2 deletions
diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp
index 4dc06d0..efb11f5 100644
--- a/src/pal/src/loader/module.cpp
+++ b/src/pal/src/loader/module.cpp
@@ -85,6 +85,7 @@ using namespace CorUnix;
#define LIBC_NAME_WITHOUT_EXTENSION "libc"
+extern "C" int dprintf(int fd, const char *format, ...);
/* static variables ***********************************************************/
/* critical section that regulates access to the module list */
@@ -1641,9 +1642,11 @@ static MODSTRUCT *LOADAddModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR libraryN
exe_module.prev->next = module;
exe_module.prev = module;
+ dprintf(1, "#### LOADAddModule PRE\n");
#ifdef TIZEN_ASAN_ENVIRONMENT
module->is_sanitized = module_is_sanitized(dl_handle);
#endif // TIZEN_ASAN_ENVIRONMENT
+ dprintf(1, "#### LOADAddModule POST: is_sanitized=%d lib_name='%s'\n", module->is_sanitized, libraryNameOrPath);
#if RETURNS_NEW_HANDLES_ON_REPEAT_DLOPEN
module->inode = stat_buf.st_ino;
diff --git a/src/vm/tizenasanenv.cpp b/src/vm/tizenasanenv.cpp
index 067aa3d..afb78ae 100644
--- a/src/vm/tizenasanenv.cpp
+++ b/src/vm/tizenasanenv.cpp
@@ -2,6 +2,8 @@
#include "common.h"
#include "tizenasanenv.h"
+extern "C" int dprintf(int fd, const char *format, ...);
+extern "C" long write(int fd, const void *buf, unsigned long count);
template <typename Type, int STACK_SIZE>
class StaticStack {
@@ -58,15 +60,34 @@ static __thread int s_enableCounter;
static void TryEnable()
{
- if (s_enableCounter == 0)
+ if (s_enableCounter == 0) {
+ {
+ char msg[] = "#### DO_ENABLE PRE\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
__sanitizer_enable_interceptors();
+ {
+ char msg[] = "#### DO_ENABLE POST\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
+ __sanitizer_enable_interceptors();
+ }
++s_enableCounter;
}
static void TryDisable()
{
- if (s_enableCounter == 1)
+ if (s_enableCounter == 1) {
+ {
+ char msg[] = "#### DO_DISABLE PRE\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
__sanitizer_disable_interceptors();
+ {
+ char msg[] = "#### DO_DISABLE POST\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
+ }
--s_enableCounter;
}
@@ -75,12 +96,20 @@ namespace TizenASanEnv {
void PushAndDisableASan(LPVOID addr)
{
+ {
+ char msg[] = "#### PushDisable\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
TryDisable();
s_retaddrStack.push(addr);
}
LPVOID PopAndEnableASan()
{
+ {
+ char msg[] = "#### PopEnable\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
LPVOID addr = s_retaddrStack.top();
s_retaddrStack.pop();
@@ -91,12 +120,20 @@ LPVOID PopAndEnableASan()
void PushAndEnableASan(LPVOID addr)
{
+ {
+ char msg[] = "#### PushEnable\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
s_retaddrStack.push(addr);
TryEnable();
}
LPVOID PopAndDisableASan()
{
+ {
+ char msg[] = "#### PopDisable\n";
+ write(1, msg, sizeof(msg) - 1);
+ }
TryDisable();
LPVOID addr = s_retaddrStack.top();
@@ -107,6 +144,7 @@ LPVOID PopAndDisableASan()
LPVOID CreateWrapper(LPVOID target, void (*pushAddr)(LPVOID addr), LPVOID (*popAddr)())
{
+ dprintf(1, "#### CreateWrapper B\n");
_ASSERTE(tizenASanWrapperEntryOffset == sizeof(AuxiliaryCalls));
LPVOID wrapperSpace = (LPVOID)SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap()->AllocMem(S_SIZE_T(tizenASanWrapperSize));
@@ -129,6 +167,7 @@ LPVOID CreateWrapper(LPVOID target, void (*pushAddr)(LPVOID addr), LPVOID (*popA
FlushInstructionCache(GetCurrentProcess(), wrapperSpace, tizenASanWrapperSize);
+ dprintf(1, "#### CreateWrapper E\n");
return entryPointer;
}
} // namespace TizenASanEnv