1 //===-- ThreadSanitizerRuntime.h --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadSanitizerRuntime_h_
11 #define liblldb_ThreadSanitizerRuntime_h_
15 // Other libraries and framework 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"
22 namespace lldb_private {
24 class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime {
26 ~ThreadSanitizerRuntime() override;
28 static lldb::InstrumentationRuntimeSP
29 CreateInstance(const lldb::ProcessSP &process_sp);
31 static void Initialize();
33 static void Terminate();
35 static lldb_private::ConstString GetPluginNameStatic();
37 static lldb::InstrumentationRuntimeType GetTypeStatic();
39 lldb_private::ConstString GetPluginName() override {
40 return GetPluginNameStatic();
43 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }
45 uint32_t GetPluginVersion() override { return 1; }
47 lldb::ThreadCollectionSP
48 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
51 ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp)
52 : lldb_private::InstrumentationRuntime(process_sp) {}
54 const RegularExpression &GetPatternForRuntimeLibrary() override;
56 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
58 void Activate() override;
62 static bool NotifyBreakpointHit(void *baton,
63 StoppointCallbackContext *context,
64 lldb::user_id_t break_id,
65 lldb::user_id_t break_loc_id);
67 StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref);
69 std::string FormatDescription(StructuredData::ObjectSP report);
71 std::string GenerateSummary(StructuredData::ObjectSP report);
73 lldb::addr_t GetMainRacyAddress(StructuredData::ObjectSP report);
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);
80 lldb::addr_t GetFirstNonInternalFramePc(StructuredData::ObjectSP trace,
81 bool skip_one_frame = false);
84 } // namespace lldb_private
86 #endif // liblldb_ThreadSanitizerRuntime_h_