From 3e7ede230f840c2141dd42a90a3cd87027a9d049 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 13 Dec 2012 08:14:02 +0000 Subject: [PATCH] tsan: support MapThreadTrace() on all platforms llvm-svn: 170113 --- compiler-rt/lib/tsan/rtl/tsan_platform.h | 1 - compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | 10 ---------- compiler-rt/lib/tsan/rtl/tsan_rtl.cc | 10 ++++++++++ compiler-rt/lib/tsan/rtl/tsan_rtl.h | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h index 4b7abb58ca2c..c859c3e85b19 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform.h +++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h @@ -137,7 +137,6 @@ void FlushShadowMemory(); const char *InitializePlatform(); void FinalizePlatform(); -void MapThreadTrace(uptr addr, uptr size); uptr ALWAYS_INLINE INLINE GetThreadTrace(int tid) { uptr p = kTraceMemBegin + (uptr)tid * kTraceSize * sizeof(Event); DCHECK_LT(p, kTraceMemBegin + kTraceMemSize); diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index 0a2ec3cdd105..523f97c17031 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -120,16 +120,6 @@ void InitializeShadowMemory() { } #endif -void MapThreadTrace(uptr addr, uptr size) { - DPrintf("Mapping trace at %p-%p(0x%zx)\n", addr, addr + size, size); - CHECK_GE(addr, kTraceMemBegin); - CHECK_LE(addr + size, kTraceMemBegin + kTraceMemSize); - if (addr != (uptr)MmapFixedNoReserve(addr, size)) { - Printf("FATAL: ThreadSanitizer can not mmap thread trace\n"); - Die(); - } -} - static uptr g_data_start; static uptr g_data_end; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc index 7bb090d39843..3522a0a94301 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc @@ -166,6 +166,16 @@ void MapShadow(uptr addr, uptr size) { MmapFixedNoReserve(MemToShadow(addr), size * kShadowMultiplier); } +void MapThreadTrace(uptr addr, uptr size) { + DPrintf("Mapping trace at %p-%p(0x%zx)\n", addr, addr + size, size); + CHECK_GE(addr, kTraceMemBegin); + CHECK_LE(addr + size, kTraceMemBegin + kTraceMemSize); + if (addr != (uptr)MmapFixedNoReserve(addr, size)) { + Printf("FATAL: ThreadSanitizer can not mmap thread trace\n"); + Die(); + } +} + void Initialize(ThreadState *thr) { // Thread safe because done before all threads exist. static bool is_initialized = false; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h index ca06716b8179..b14c99ef0912 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -482,6 +482,7 @@ void ALWAYS_INLINE INLINE StatInc(ThreadState *thr, StatType typ, u64 n = 1) { } void MapShadow(uptr addr, uptr size); +void MapThreadTrace(uptr addr, uptr size); void InitializeShadowMemory(); void InitializeInterceptors(); void InitializeDynamicAnnotations(); -- GitLab