LLDB mainline
CPPLanguageRuntime.h
Go to the documentation of this file.
1//===-- CPPLanguageRuntime.h
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_LANGUAGERUNTIME_CPLUSPLUS_CPPLANGUAGERUNTIME_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_CPPLANGUAGERUNTIME_H
11
12#include <vector>
13
14#include "llvm/ADT/StringMap.h"
15
16#include "CommonABIRuntime.h"
19#include "lldb/Utility/Locked.h"
20#include "lldb/lldb-private.h"
21
22namespace lldb_private {
23
25public:
32
41
44
45 static char ID;
46
47 static void Initialize();
48
49 static void Terminate();
50
52 CreateInstance(Process *process, lldb::LanguageType language);
53
54 static llvm::StringRef GetPluginNameStatic() {
55 return "cpp-language-runtime";
56 }
57
58 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
59
60 bool isA(const void *ClassID) const override {
61 return ClassID == &ID || LanguageRuntime::isA(ClassID);
62 }
63
64 static bool classof(const LanguageRuntime *runtime) {
65 return runtime->isA(&ID);
66 }
67
71
72 static CPPLanguageRuntime *Get(Process &process) {
73 return llvm::cast_or_null<CPPLanguageRuntime>(
75 }
76
77 llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override;
78
79 llvm::Error GetObjectDescription(Stream &str, Value &value,
80 ExecutionContextScope *exe_scope) override;
81
82 /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
83 ///
84 /// \param[in] thread
85 /// Current thrad of execution.
86 ///
87 /// \param[in] stop_others
88 /// True if other threads should pause during execution.
89 ///
90 /// \return
91 /// A ThreadPlan Shared pointer
93 bool stop_others) override;
94
95 bool IsAllowedRuntimeValue(ConstString name) override;
96
97 bool IsSymbolARuntimeThunk(const Symbol &symbol) override;
98
99 llvm::Expected<LanguageRuntime::VTableInfo>
100 GetVTableInfo(ValueObject &in_value, bool check_type) override;
101
103 lldb::DynamicValueType use_dynamic,
104 TypeAndOrName &class_type_or_name,
105 Address &address, Value::ValueType &value_type,
106 llvm::ArrayRef<uint8_t> &local_buffer) override;
107
108 TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
109 ValueObject &static_value) override;
110
111 bool CouldHaveDynamicValue(ValueObject &in_value) override;
112
113 void SetExceptionBreakpoints() override;
114
115 void ClearExceptionBreakpoints() override;
116
117 bool ExceptionBreakpointsAreSet() override;
118
119 bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
120
122 CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp,
123 bool throw_bp) override;
124
126
129
130private:
131 CPPLanguageRuntime(Process *process);
132
134 CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp,
135 bool throw_bp, bool for_expressions);
136
137 lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,
138 bool for_expressions,
139 bool is_internal);
140
142 llvm::StringMap<CPPLanguageRuntime::LibCppStdFunctionCallableInfo>;
143
145
147 std::vector<std::unique_ptr<CommonABIRuntime>> m_abi_runtimes;
148
153
154 llvm::Expected<VTableInfoEntry> GetVTableInfoEntry(ValueObject &in_value,
155 bool check_type);
156
157 using VTableInfoMap = std::map<Address, VTableInfoEntry>;
159};
160
161} // namespace lldb_private
162
163#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_CPPLANGUAGERUNTIME_H
A section + offset based address class.
Definition Address.h:62
llvm::Expected< LanguageRuntime::VTableInfo > GetVTableInfo(ValueObject &in_value, bool check_type) override
Get the vtable information for a given value.
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
bool CouldHaveDynamicValue(ValueObject &in_value) override
lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal)
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override
static bool classof(const LanguageRuntime *runtime)
Guarded< VTableInfoMap, std::mutex > m_vtable_info_map
lldb::SearchFilterSP CreateExceptionSearchFilter() override
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
llvm::Expected< VTableInfoEntry > GetVTableInfoEntry(ValueObject &in_value, bool check_type)
llvm::StringMap< CPPLanguageRuntime::LibCppStdFunctionCallableInfo > OperatorStringToCallableInfoMap
bool IsSymbolARuntimeThunk(const Symbol &symbol) override
bool IsAllowedRuntimeValue(ConstString name) override
Identify whether a name is a runtime value that should not be hidden by from the user interface.
LibCppStdFunctionCallableInfo FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp)
llvm::StringRef GetPluginName() override
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) override
Obtain a ThreadPlan to get us into C++ constructs such as std::function.
bool isA(const void *ClassID) const override
static CPPLanguageRuntime * Get(Process &process)
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
lldb::LanguageType GetLanguageType() const override
OperatorStringToCallableInfoMap CallableLookupCache
static llvm::StringRef GetPluginNameStatic()
std::vector< std::unique_ptr< CommonABIRuntime > > m_abi_runtimes
std::map< Address, VTableInfoEntry > VTableInfoMap
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
This call should return true if it could set the name and/or the type Sets address to the address of ...
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
A uniqued constant string class.
Definition ConstString.h:40
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
Bundles a value of type T with the Mutex that guards it.
Definition Locked.h:178
virtual bool isA(const void *ClassID) const
A plug-in interface definition class for debugging a process.
Definition Process.h:368
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
Definition Process.cpp:1551
A stream class that can stream formatted output to a file.
Definition Stream.h:28
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition Type.h:780
ValueType
Type that describes Value::m_value.
Definition Value.h:42
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
A line table entry class.
Definition LineEntry.h:21