1 //===-- tsan_trace.h --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of ThreadSanitizer (TSan), a race detector.
12 //===----------------------------------------------------------------------===//
16 #include "tsan_defs.h"
17 #include "tsan_mutex.h"
18 #include "tsan_stack_trace.h"
19 #include "tsan_mutexset.h"
23 const int kTracePartSizeBits = 14;
24 const int kTracePartSize = 1 << kTracePartSizeBits;
25 const int kTraceParts = 4 * 1024 * 1024 / kTracePartSize;
26 const int kTraceSize = kTracePartSize * kTraceParts;
28 // Must fit into 3 bits.
39 // Represents a thread event (from most significant bit):
40 // u64 typ : 3; // EventType.
41 // u64 addr : 61; // Associated pc.
46 BufferedStackTrace stack0; // Start stack for the trace.
48 VarSizeStackTrace stack0;
50 u64 epoch0; // Start epoch for the trace.
53 TraceHeader() : stack0(), epoch0() {}
57 TraceHeader headers[kTraceParts];
60 // Must be last to catch overflow as paging fault.
61 // Go shadow stack is dynamically allocated.
62 uptr shadow_stack[kShadowStackSize];
66 : mtx(MutexTypeTrace, StatMtxTrace) {
72 #endif // TSAN_TRACE_H