1 //===-- tsan_trace.h --------------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
10 //===----------------------------------------------------------------------===//
14 #include "tsan_defs.h"
15 #include "tsan_mutex.h"
16 #include "tsan_stack_trace.h"
17 #include "tsan_mutexset.h"
21 const int kTracePartSizeBits
= 14;
22 const int kTracePartSize
= 1 << kTracePartSizeBits
;
23 const int kTraceParts
= 4 * 1024 * 1024 / kTracePartSize
;
24 const int kTraceSize
= kTracePartSize
* kTraceParts
;
26 // Must fit into 3 bits.
37 // Represents a thread event (from most significant bit):
38 // u64 typ : 3; // EventType.
39 // u64 addr : 61; // Associated pc.
43 StackTrace stack0
; // Start stack for the trace.
44 u64 epoch0
; // Start epoch for the trace.
47 uptr stack0buf
[kTraceStackSize
];
52 : stack0(stack0buf
, kTraceStackSize
)
61 TraceHeader headers
[kTraceParts
];
64 // Must be last to catch overflow as paging fault.
65 // Go shadow stack is dynamically allocated.
66 uptr shadow_stack
[kShadowStackSize
];
70 : mtx(MutexTypeTrace
, StatMtxTrace
) {
76 #endif // TSAN_TRACE_H