Fix typo.
[official-gcc.git] / libsanitizer / tsan / tsan_report.h
blobe51ed4f50f8ea55255682d0173e97524d5bede63
1 //===-- tsan_report.h -------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 //===----------------------------------------------------------------------===//
11 #ifndef TSAN_REPORT_H
12 #define TSAN_REPORT_H
14 #include "sanitizer_common/sanitizer_symbolizer.h"
15 #include "tsan_defs.h"
16 #include "tsan_vector.h"
18 namespace __tsan {
20 enum ReportType {
21 ReportTypeRace,
22 ReportTypeVptrRace,
23 ReportTypeUseAfterFree,
24 ReportTypeVptrUseAfterFree,
25 ReportTypeThreadLeak,
26 ReportTypeMutexDestroyLocked,
27 ReportTypeMutexDoubleLock,
28 ReportTypeMutexInvalidAccess,
29 ReportTypeMutexBadUnlock,
30 ReportTypeMutexBadReadLock,
31 ReportTypeMutexBadReadUnlock,
32 ReportTypeSignalUnsafe,
33 ReportTypeErrnoInSignal,
34 ReportTypeDeadlock
37 struct ReportStack {
38 SymbolizedStack *frames;
39 bool suppressable;
40 static ReportStack *New();
42 private:
43 ReportStack();
46 struct ReportMopMutex {
47 u64 id;
48 bool write;
51 struct ReportMop {
52 int tid;
53 uptr addr;
54 int size;
55 bool write;
56 bool atomic;
57 Vector<ReportMopMutex> mset;
58 ReportStack *stack;
60 ReportMop();
63 enum ReportLocationType {
64 ReportLocationGlobal,
65 ReportLocationHeap,
66 ReportLocationStack,
67 ReportLocationTLS,
68 ReportLocationFD
71 struct ReportLocation {
72 ReportLocationType type;
73 DataInfo global;
74 uptr heap_chunk_start;
75 uptr heap_chunk_size;
76 int tid;
77 int fd;
78 bool suppressable;
79 ReportStack *stack;
81 static ReportLocation *New(ReportLocationType type);
82 private:
83 explicit ReportLocation(ReportLocationType type);
86 struct ReportThread {
87 int id;
88 uptr os_id;
89 bool running;
90 char *name;
91 int parent_tid;
92 ReportStack *stack;
95 struct ReportMutex {
96 u64 id;
97 uptr addr;
98 bool destroyed;
99 ReportStack *stack;
102 class ReportDesc {
103 public:
104 ReportType typ;
105 Vector<ReportStack*> stacks;
106 Vector<ReportMop*> mops;
107 Vector<ReportLocation*> locs;
108 Vector<ReportMutex*> mutexes;
109 Vector<ReportThread*> threads;
110 Vector<int> unique_tids;
111 ReportStack *sleep;
112 int count;
114 ReportDesc();
115 ~ReportDesc();
117 private:
118 ReportDesc(const ReportDesc&);
119 void operator = (const ReportDesc&);
122 // Format and output the report to the console/log. No additional logic.
123 void PrintReport(const ReportDesc *rep);
124 void PrintStack(const ReportStack *stack);
126 } // namespace __tsan
128 #endif // TSAN_REPORT_H