]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / InstrumentationRuntime / TSan / TSanRuntime.h
1 //===-- ThreadSanitizerRuntime.h --------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_ThreadSanitizerRuntime_h_
11 #define liblldb_ThreadSanitizerRuntime_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Target/ABI.h"
18 #include "lldb/Target/InstrumentationRuntime.h"
19 #include "lldb/Utility/StructuredData.h"
20 #include "lldb/lldb-private.h"
21
22 namespace lldb_private {
23
24 class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime {
25 public:
26   ~ThreadSanitizerRuntime() override;
27
28   static lldb::InstrumentationRuntimeSP
29   CreateInstance(const lldb::ProcessSP &process_sp);
30
31   static void Initialize();
32
33   static void Terminate();
34
35   static lldb_private::ConstString GetPluginNameStatic();
36
37   static lldb::InstrumentationRuntimeType GetTypeStatic();
38
39   lldb_private::ConstString GetPluginName() override {
40     return GetPluginNameStatic();
41   }
42
43   virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }
44
45   uint32_t GetPluginVersion() override { return 1; }
46
47   lldb::ThreadCollectionSP
48   GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
49
50 private:
51   ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp)
52       : lldb_private::InstrumentationRuntime(process_sp) {}
53
54   const RegularExpression &GetPatternForRuntimeLibrary() override;
55
56   bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
57
58   void Activate() override;
59
60   void Deactivate();
61
62   static bool NotifyBreakpointHit(void *baton,
63                                   StoppointCallbackContext *context,
64                                   lldb::user_id_t break_id,
65                                   lldb::user_id_t break_loc_id);
66
67   StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref);
68
69   std::string FormatDescription(StructuredData::ObjectSP report);
70
71   std::string GenerateSummary(StructuredData::ObjectSP report);
72
73   lldb::addr_t GetMainRacyAddress(StructuredData::ObjectSP report);
74
75   std::string GetLocationDescription(StructuredData::ObjectSP report,
76                                      lldb::addr_t &global_addr,
77                                      std::string &global_name,
78                                      std::string &filename, uint32_t &line);
79
80   lldb::addr_t GetFirstNonInternalFramePc(StructuredData::ObjectSP trace,
81                                           bool skip_one_frame = false);
82 };
83
84 } // namespace lldb_private
85
86 #endif // liblldb_ThreadSanitizerRuntime_h_