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