* tree-cfg.c (verify_gimple_in_cfg): Call verify_location on the
[official-gcc.git] / libsanitizer / tsan / tsan_report.h
blob6eb043fc86667c65e77e969a9e5e31c688069e7d
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 ReportTypeExternalRace,
26 ReportTypeThreadLeak,
27 ReportTypeMutexDestroyLocked,
28 ReportTypeMutexDoubleLock,
29 ReportTypeMutexInvalidAccess,
30 ReportTypeMutexBadUnlock,
31 ReportTypeMutexBadReadLock,
32 ReportTypeMutexBadReadUnlock,
33 ReportTypeSignalUnsafe,
34 ReportTypeErrnoInSignal,
35 ReportTypeDeadlock
38 struct ReportStack {
39 SymbolizedStack *frames;
40 bool suppressable;
41 static ReportStack *New();
43 private:
44 ReportStack();
47 struct ReportMopMutex {
48 u64 id;
49 bool write;
52 struct ReportMop {
53 int tid;
54 uptr addr;
55 int size;
56 bool write;
57 bool atomic;
58 uptr external_tag;
59 Vector<ReportMopMutex> mset;
60 ReportStack *stack;
62 ReportMop();
65 enum ReportLocationType {
66 ReportLocationGlobal,
67 ReportLocationHeap,
68 ReportLocationStack,
69 ReportLocationTLS,
70 ReportLocationFD
73 struct ReportLocation {
74 ReportLocationType type;
75 DataInfo global;
76 uptr heap_chunk_start;
77 uptr heap_chunk_size;
78 uptr external_tag;
79 int tid;
80 int fd;
81 bool suppressable;
82 ReportStack *stack;
84 static ReportLocation *New(ReportLocationType type);
85 private:
86 explicit ReportLocation(ReportLocationType type);
89 struct ReportThread {
90 int id;
91 tid_t os_id;
92 bool running;
93 bool workerthread;
94 char *name;
95 u32 parent_tid;
96 ReportStack *stack;
99 struct ReportMutex {
100 u64 id;
101 uptr addr;
102 bool destroyed;
103 ReportStack *stack;
106 class ReportDesc {
107 public:
108 ReportType typ;
109 uptr tag;
110 Vector<ReportStack*> stacks;
111 Vector<ReportMop*> mops;
112 Vector<ReportLocation*> locs;
113 Vector<ReportMutex*> mutexes;
114 Vector<ReportThread*> threads;
115 Vector<int> unique_tids;
116 ReportStack *sleep;
117 int count;
119 ReportDesc();
120 ~ReportDesc();
122 private:
123 ReportDesc(const ReportDesc&);
124 void operator = (const ReportDesc&);
127 // Format and output the report to the console/log. No additional logic.
128 void PrintReport(const ReportDesc *rep);
129 void PrintStack(const ReportStack *stack);
131 } // namespace __tsan
133 #endif // TSAN_REPORT_H