forked from OSchip/llvm-project
tsan: support MapThreadTrace() on all platforms
llvm-svn: 170113
This commit is contained in:
parent
65c14f5314
commit
3e7ede230f
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue