1 //===-- AddressSanitizerRuntime.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_AddressSanitizerRuntime_h_ 11 #define liblldb_AddressSanitizerRuntime_h_ 12 13 #include "lldb/Target/InstrumentationRuntime.h" 14 #include "lldb/Target/Process.h" 15 #include "lldb/Utility/StructuredData.h" 16 #include "lldb/lldb-private.h" 17 18 namespace lldb_private { 19 20 class AddressSanitizerRuntime : public lldb_private::InstrumentationRuntime { 21 public: 22 ~AddressSanitizerRuntime() override; 23 24 static lldb::InstrumentationRuntimeSP 25 CreateInstance(const lldb::ProcessSP &process_sp); 26 27 static void Initialize(); 28 29 static void Terminate(); 30 31 static lldb_private::ConstString GetPluginNameStatic(); 32 33 static lldb::InstrumentationRuntimeType GetTypeStatic(); 34 GetPluginName()35 lldb_private::ConstString GetPluginName() override { 36 return GetPluginNameStatic(); 37 } 38 GetType()39 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } 40 GetPluginVersion()41 uint32_t GetPluginVersion() override { return 1; } 42 43 private: AddressSanitizerRuntime(const lldb::ProcessSP & process_sp)44 AddressSanitizerRuntime(const lldb::ProcessSP &process_sp) 45 : lldb_private::InstrumentationRuntime(process_sp) {} 46 47 const RegularExpression &GetPatternForRuntimeLibrary() override; 48 49 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; 50 51 void Activate() override; 52 53 void Deactivate(); 54 55 static bool NotifyBreakpointHit(void *baton, 56 StoppointCallbackContext *context, 57 lldb::user_id_t break_id, 58 lldb::user_id_t break_loc_id); 59 60 StructuredData::ObjectSP RetrieveReportData(); 61 62 std::string FormatDescription(StructuredData::ObjectSP report); 63 }; 64 65 } // namespace lldb_private 66 67 #endif // liblldb_AddressSanitizerRuntime_h_ 68