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