1 //===-- ItaniumABILanguageRuntime.h -----------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_ItaniumABILanguageRuntime_h_
10 #define liblldb_ItaniumABILanguageRuntime_h_
16 #include "lldb/Breakpoint/BreakpointResolver.h"
17 #include "lldb/Core/Value.h"
18 #include "lldb/Symbol/Type.h"
19 #include "lldb/Target/LanguageRuntime.h"
20 #include "lldb/lldb-private.h"
22 #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
24 namespace lldb_private {
26 class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {
28 ~ItaniumABILanguageRuntime() override = default;
31 static void Initialize();
33 static void Terminate();
35 static lldb_private::LanguageRuntime *
36 CreateInstance(Process *process, lldb::LanguageType language);
38 static lldb_private::ConstString GetPluginNameStatic();
42 bool isA(const void *ClassID) const override {
43 return ClassID == &ID || CPPLanguageRuntime::isA(ClassID);
46 static bool classof(const LanguageRuntime *runtime) {
47 return runtime->isA(&ID);
50 bool GetDynamicTypeAndAddress(ValueObject &in_value,
51 lldb::DynamicValueType use_dynamic,
52 TypeAndOrName &class_type_or_name,
54 Value::ValueType &value_type) override;
56 TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
57 ValueObject &static_value) override;
59 bool CouldHaveDynamicValue(ValueObject &in_value) override;
61 void SetExceptionBreakpoints() override;
63 void ClearExceptionBreakpoints() override;
65 bool ExceptionBreakpointsAreSet() override;
67 bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
69 lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
71 bool throw_bp) override;
73 lldb::SearchFilterSP CreateExceptionSearchFilter() override;
75 lldb::ValueObjectSP GetExceptionObjectForThread(
76 lldb::ThreadSP thread_sp) override;
78 // PluginInterface protocol
79 lldb_private::ConstString GetPluginName() override;
81 uint32_t GetPluginVersion() override;
84 lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
87 bool for_expressions);
89 lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,
94 typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;
96 ItaniumABILanguageRuntime(Process *process)
97 : // Call CreateInstance instead.
98 lldb_private::CPPLanguageRuntime(process), m_cxx_exception_bp_sp(),
99 m_dynamic_type_map(), m_dynamic_type_map_mutex() {}
101 lldb::BreakpointSP m_cxx_exception_bp_sp;
102 DynamicTypeCache m_dynamic_type_map;
103 std::mutex m_dynamic_type_map_mutex;
105 TypeAndOrName GetTypeInfoFromVTableAddress(ValueObject &in_value,
106 lldb::addr_t original_ptr,
107 lldb::addr_t vtable_addr);
109 TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
111 void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
112 const TypeAndOrName &type_info);
115 } // namespace lldb_private
117 #endif // liblldb_ItaniumABILanguageRuntime_h_