1 | //===-- InstrumentationRuntimeTSan.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 | #ifndef LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_TSAN_INSTRUMENTATIONRUNTIMETSAN_H |
10 | #define LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_TSAN_INSTRUMENTATIONRUNTIMETSAN_H |
11 | |
12 | #include "lldb/Target/ABI.h" |
13 | #include "lldb/Target/InstrumentationRuntime.h" |
14 | #include "lldb/Utility/StructuredData.h" |
15 | #include "lldb/lldb-private.h" |
16 | |
17 | namespace lldb_private { |
18 | |
19 | class InstrumentationRuntimeTSan : public lldb_private::InstrumentationRuntime { |
20 | public: |
21 | ~InstrumentationRuntimeTSan() override; |
22 | |
23 | static lldb::InstrumentationRuntimeSP |
24 | CreateInstance(const lldb::ProcessSP &process_sp); |
25 | |
26 | static void Initialize(); |
27 | |
28 | static void Terminate(); |
29 | |
30 | static llvm::StringRef GetPluginNameStatic() { return "ThreadSanitizer"; } |
31 | |
32 | static lldb::InstrumentationRuntimeType GetTypeStatic(); |
33 | |
34 | llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } |
35 | |
36 | virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } |
37 | |
38 | lldb::ThreadCollectionSP |
39 | GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; |
40 | |
41 | private: |
42 | InstrumentationRuntimeTSan(const lldb::ProcessSP &process_sp) |
43 | : lldb_private::InstrumentationRuntime(process_sp) {} |
44 | |
45 | const RegularExpression &GetPatternForRuntimeLibrary() override; |
46 | |
47 | bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; |
48 | |
49 | void Activate() override; |
50 | |
51 | void Deactivate(); |
52 | |
53 | static bool NotifyBreakpointHit(void *baton, |
54 | StoppointCallbackContext *context, |
55 | lldb::user_id_t break_id, |
56 | lldb::user_id_t break_loc_id); |
57 | |
58 | StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref); |
59 | |
60 | std::string FormatDescription(StructuredData::ObjectSP report); |
61 | |
62 | std::string GenerateSummary(StructuredData::ObjectSP report); |
63 | |
64 | lldb::addr_t GetMainRacyAddress(StructuredData::ObjectSP report); |
65 | |
66 | std::string GetLocationDescription(StructuredData::ObjectSP report, |
67 | lldb::addr_t &global_addr, |
68 | std::string &global_name, |
69 | std::string &filename, uint32_t &line); |
70 | |
71 | lldb::addr_t GetFirstNonInternalFramePc(StructuredData::ObjectSP trace, |
72 | bool skip_one_frame = false); |
73 | }; |
74 | |
75 | } // namespace lldb_private |
76 | |
77 | #endif // LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_TSAN_INSTRUMENTATIONRUNTIMETSAN_H |
78 |