Consistently use "rG" constraint for copy instruction in move patterns
[official-gcc.git] / libsanitizer / tsan / tsan_report.h
blobd68c2db88828f1565f287131770d4a2b3235e512
1 //===-- tsan_report.h -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of ThreadSanitizer (TSan), a race detector.
11 //===----------------------------------------------------------------------===//
12 #ifndef TSAN_REPORT_H
13 #define TSAN_REPORT_H
15 #include "sanitizer_common/sanitizer_symbolizer.h"
16 #include "sanitizer_common/sanitizer_thread_registry.h"
17 #include "sanitizer_common/sanitizer_vector.h"
18 #include "tsan_defs.h"
20 namespace __tsan {
22 enum ReportType {
23 ReportTypeRace,
24 ReportTypeVptrRace,
25 ReportTypeUseAfterFree,
26 ReportTypeVptrUseAfterFree,
27 ReportTypeExternalRace,
28 ReportTypeThreadLeak,
29 ReportTypeMutexDestroyLocked,
30 ReportTypeMutexDoubleLock,
31 ReportTypeMutexInvalidAccess,
32 ReportTypeMutexBadUnlock,
33 ReportTypeMutexBadReadLock,
34 ReportTypeMutexBadReadUnlock,
35 ReportTypeSignalUnsafe,
36 ReportTypeErrnoInSignal,
37 ReportTypeDeadlock
40 struct ReportStack {
41 SymbolizedStack *frames = nullptr;
42 bool suppressable = false;
45 struct ReportMopMutex {
46 u64 id;
47 bool write;
50 struct ReportMop {
51 int tid;
52 uptr addr;
53 int size;
54 bool write;
55 bool atomic;
56 uptr external_tag;
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 = ReportLocationGlobal;
73 DataInfo global = {};
74 uptr heap_chunk_start = 0;
75 uptr heap_chunk_size = 0;
76 uptr external_tag = 0;
77 Tid tid = kInvalidTid;
78 int fd = 0;
79 bool suppressable = false;
80 ReportStack *stack = nullptr;
83 struct ReportThread {
84 Tid id;
85 tid_t os_id;
86 bool running;
87 ThreadType thread_type;
88 char *name;
89 Tid parent_tid;
90 ReportStack *stack;
93 struct ReportMutex {
94 u64 id;
95 uptr addr;
96 bool destroyed;
97 ReportStack *stack;
100 class ReportDesc {
101 public:
102 ReportType typ;
103 uptr tag;
104 Vector<ReportStack*> stacks;
105 Vector<ReportMop*> mops;
106 Vector<ReportLocation*> locs;
107 Vector<ReportMutex*> mutexes;
108 Vector<ReportThread*> threads;
109 Vector<Tid> unique_tids;
110 ReportStack *sleep;
111 int count;
113 ReportDesc();
114 ~ReportDesc();
116 private:
117 ReportDesc(const ReportDesc&);
118 void operator = (const ReportDesc&);
121 // Format and output the report to the console/log. No additional logic.
122 void PrintReport(const ReportDesc *rep);
123 void PrintStack(const ReportStack *stack);
125 } // namespace __tsan
127 #endif // TSAN_REPORT_H