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