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_
13 #include "lldb/Target/ABI.h"
14 #include "lldb/Target/InstrumentationRuntime.h"
15 #include "lldb/Utility/StructuredData.h"
16 #include "lldb/lldb-private.h"
18 namespace lldb_private {
20 class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime {
22 ~ThreadSanitizerRuntime() override;
24 static lldb::InstrumentationRuntimeSP
25 CreateInstance(const lldb::ProcessSP &process_sp);
27 static void Initialize();
29 static void Terminate();
31 static lldb_private::ConstString GetPluginNameStatic();
33 static lldb::InstrumentationRuntimeType GetTypeStatic();
35 lldb_private::ConstString GetPluginName() override {
36 return GetPluginNameStatic();
39 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }
41 uint32_t GetPluginVersion() override { return 1; }
43 lldb::ThreadCollectionSP
44 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
47 ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp)
48 : lldb_private::InstrumentationRuntime(process_sp) {}
50 const RegularExpression &GetPatternForRuntimeLibrary() override;
52 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
54 void Activate() override;
58 static bool NotifyBreakpointHit(void *baton,
59 StoppointCallbackContext *context,
60 lldb::user_id_t break_id,
61 lldb::user_id_t break_loc_id);
63 StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref);
65 std::string FormatDescription(StructuredData::ObjectSP report);
67 std::string GenerateSummary(StructuredData::ObjectSP report);
69 lldb::addr_t GetMainRacyAddress(StructuredData::ObjectSP report);
71 std::string GetLocationDescription(StructuredData::ObjectSP report,
72 lldb::addr_t &global_addr,
73 std::string &global_name,
74 std::string &filename, uint32_t &line);
76 lldb::addr_t GetFirstNonInternalFramePc(StructuredData::ObjectSP trace,
77 bool skip_one_frame = false);
80 } // namespace lldb_private
82 #endif // liblldb_ThreadSanitizerRuntime_h_