1 //===-- InstrumentationRuntimeASanLibsanitizers.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_ASANLIBSANITIZERS_INSTRUMENTATIONRUNTIMEASANLIBSANITIZERS_H
10 #define LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_ASANLIBSANITIZERS_INSTRUMENTATIONRUNTIMEASANLIBSANITIZERS_H
11 
12 #include "lldb/Target/InstrumentationRuntime.h"
13 
14 class InstrumentationRuntimeASanLibsanitizers
15     : public lldb_private::InstrumentationRuntime {
16 public:
17   ~InstrumentationRuntimeASanLibsanitizers() override;
18 
19   static lldb::InstrumentationRuntimeSP
20   CreateInstance(const lldb::ProcessSP &process_sp);
21 
22   static void Initialize();
23 
24   static void Terminate();
25 
GetPluginNameStatic()26   static llvm::StringRef GetPluginNameStatic() { return "Libsanitizers-ASan"; }
27 
28   static lldb::InstrumentationRuntimeType GetTypeStatic();
29 
GetPluginName()30   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
31 
GetType()32   virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }
33 
34 private:
InstrumentationRuntimeASanLibsanitizers(const lldb::ProcessSP & process_sp)35   InstrumentationRuntimeASanLibsanitizers(const lldb::ProcessSP &process_sp)
36       : lldb_private::InstrumentationRuntime(process_sp) {}
37 
38   const lldb_private::RegularExpression &GetPatternForRuntimeLibrary() override;
39 
40   bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
41 
42   void Activate() override;
43 
44   void Deactivate();
45 
46   static bool
47   NotifyBreakpointHit(void *baton,
48                       lldb_private::StoppointCallbackContext *context,
49                       lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
50 };
51 
52 #endif // LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_ASANLIBSANITIZERS_INSTRUMENTATIONRUNTIMEASANLIBSANITIZERS_H
53