]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / LanguageRuntime / CPlusPlus / ItaniumABI / ItaniumABILanguageRuntime.h
1 //===-- ItaniumABILanguageRuntime.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_ItaniumABILanguageRuntime_h_
11 #define liblldb_ItaniumABILanguageRuntime_h_
12
13 // C Includes
14 // C++ Includes
15 #include <map>
16 #include <mutex>
17 #include <vector>
18
19 // Other libraries and framework includes
20 // Project includes
21 #include "lldb/Breakpoint/BreakpointResolver.h"
22 #include "lldb/Core/Value.h"
23 #include "lldb/Symbol/Type.h"
24 #include "lldb/Target/CPPLanguageRuntime.h"
25 #include "lldb/Target/LanguageRuntime.h"
26 #include "lldb/lldb-private.h"
27
28 namespace lldb_private {
29
30 class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {
31 public:
32   ~ItaniumABILanguageRuntime() override = default;
33
34   //------------------------------------------------------------------
35   // Static Functions
36   //------------------------------------------------------------------
37   static void Initialize();
38
39   static void Terminate();
40
41   static lldb_private::LanguageRuntime *
42   CreateInstance(Process *process, lldb::LanguageType language);
43
44   static lldb_private::ConstString GetPluginNameStatic();
45
46   bool IsVTableName(const char *name) override;
47
48   bool GetDynamicTypeAndAddress(ValueObject &in_value,
49                                 lldb::DynamicValueType use_dynamic,
50                                 TypeAndOrName &class_type_or_name,
51                                 Address &address,
52                                 Value::ValueType &value_type) override;
53
54   TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
55                                  ValueObject &static_value) override;
56
57   bool CouldHaveDynamicValue(ValueObject &in_value) override;
58
59   void SetExceptionBreakpoints() override;
60
61   void ClearExceptionBreakpoints() override;
62
63   bool ExceptionBreakpointsAreSet() override;
64
65   bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
66
67   lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
68                                                      bool catch_bp,
69                                                      bool throw_bp) override;
70
71   lldb::SearchFilterSP CreateExceptionSearchFilter() override;
72
73   //------------------------------------------------------------------
74   // PluginInterface protocol
75   //------------------------------------------------------------------
76   lldb_private::ConstString GetPluginName() override;
77
78   uint32_t GetPluginVersion() override;
79
80 protected:
81   lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
82                                                      bool catch_bp,
83                                                      bool throw_bp,
84                                                      bool for_expressions);
85
86   lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,
87                                                bool for_expressions,
88                                                bool is_internal);
89
90 private:
91   typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;
92
93   ItaniumABILanguageRuntime(Process *process)
94       : // Call CreateInstance instead.
95         lldb_private::CPPLanguageRuntime(process),
96         m_cxx_exception_bp_sp(), m_dynamic_type_map(),
97         m_dynamic_type_map_mutex() {}
98
99   lldb::BreakpointSP m_cxx_exception_bp_sp;
100   DynamicTypeCache m_dynamic_type_map;
101   std::mutex m_dynamic_type_map_mutex;
102
103   TypeAndOrName GetTypeInfoFromVTableAddress(ValueObject &in_value,
104                                              lldb::addr_t original_ptr,
105                                              lldb::addr_t vtable_addr);
106
107   TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
108
109   void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
110                           const TypeAndOrName &type_info);
111 };
112
113 } // namespace lldb_private
114
115 #endif // liblldb_ItaniumABILanguageRuntime_h_