1 //===-- tsan_report.h -------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is a part of ThreadSanitizer (TSan), a race detector.
11 //===----------------------------------------------------------------------===//
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"
25 ReportTypeUseAfterFree
,
26 ReportTypeVptrUseAfterFree
,
27 ReportTypeExternalRace
,
29 ReportTypeMutexDestroyLocked
,
30 ReportTypeMutexDoubleLock
,
31 ReportTypeMutexInvalidAccess
,
32 ReportTypeMutexBadUnlock
,
33 ReportTypeMutexBadReadLock
,
34 ReportTypeMutexBadReadUnlock
,
35 ReportTypeSignalUnsafe
,
36 ReportTypeErrnoInSignal
,
38 ReportTypeMutexHeldWrongContext
42 SymbolizedStack
*frames
= nullptr;
43 bool suppressable
= false;
46 struct ReportMopMutex
{
58 Vector
<ReportMopMutex
> mset
;
64 enum ReportLocationType
{
72 struct ReportLocation
{
73 ReportLocationType type
= ReportLocationGlobal
;
75 uptr heap_chunk_start
= 0;
76 uptr heap_chunk_size
= 0;
77 uptr external_tag
= 0;
78 Tid tid
= kInvalidTid
;
80 bool fd_closed
= false;
81 bool suppressable
= false;
82 ReportStack
*stack
= nullptr;
89 ThreadType thread_type
;
105 Vector
<ReportStack
*> stacks
;
106 Vector
<ReportMop
*> mops
;
107 Vector
<ReportLocation
*> locs
;
108 Vector
<ReportMutex
*> mutexes
;
109 Vector
<ReportThread
*> threads
;
110 Vector
<Tid
> unique_tids
;
119 ReportDesc(const ReportDesc
&);
120 void operator = (const ReportDesc
&);
123 // Format and output the report to the console/log. No additional logic.
124 void PrintReport(const ReportDesc
*rep
);
125 void PrintStack(const ReportStack
*stack
);
127 } // namespace __tsan
129 #endif // TSAN_REPORT_H