16#include "llvm/Support/Error.h"
30 return "Itanium ABI runtime";
54 module_sp->FindGlobalVariables(
ConstString(
"__clang_vtable"),
58 LLDB_LOG(log,
"{0:x}: found {1} __clang_vtable variables",
63 if (valobj->GetLoadAddress() != vtableBase)
66 auto type_sp = var->GetEnclosingType();
70 "{0:x}: Found __clang_vtable at {1:x}, but not the enclosing type!",
81 "{0:x}: Found __clang_vtable at {1:x} for '{2}' which is not a "
82 "CXXClassType. Ignoring",
84 type_sp->GetQualifiedName().AsCString(
""));
89 "{0:x}: static-type = '{1}' has dynamic type: uid={2:x}, "
93 type_sp->GetName().GetCString());
135 llvm::StringRef symbol_name =
139 ": static-type = '%s' has vtable symbol '%s'\n",
145 llvm::StringRef class_name = symbol_name;
149 std::string lookup_name(
"::");
150 lookup_name.append(class_name.data(), class_name.size());
153 bool any_found =
false;
163 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
164 "}, type-name='%s'\n",
167 type_sp->GetName().GetCString());
193 class_type_or_name =
GetTypeInfo(in_value, vtable_info);
195 if (!class_type_or_name)
217 const uint32_t addr_byte_size =
m_process->GetAddressByteSize();
219 vtable_load_addr - 2 * addr_byte_size;
222 if (offset_to_top_location >= vtable_load_addr)
226 Address(offset_to_top_location), addr_byte_size, INT64_MIN,
error);
228 if (offset_to_top == INT64_MIN)
234 if (!
m_process->GetTarget().ResolveLoadAddress(dynamic_addr,
242 std::vector<const char *> &names,
bool catch_bp,
bool throw_bp,
243 bool for_expressions) {
251 static const char *g_catch_name =
"__cxa_begin_catch";
252 static const char *g_throw_name1 =
"__cxa_throw";
253 static const char *g_throw_name2 =
"__cxa_rethrow";
254 static const char *g_exception_throw_name =
"__cxa_allocate_exception";
257 names.push_back(g_catch_name);
260 names.push_back(g_throw_name1);
261 names.push_back(g_throw_name2);
265 names.push_back(g_exception_throw_name);
282 if (!thread_sp->SafeToCallFunctions())
302 thread_sp->CalculateExecutionContext(exe_ctx);
318 m_process->GetTarget().GetFunctionCallerForLanguage(
323 func_call_ret = function_caller->
ExecuteFunction(exe_ctx,
nullptr, options,
324 diagnostics, results);
329 size_t ptr_size =
m_process->GetAddressByteSize();
331 llvm::Expected<lldb::addr_t> exception_addr =
332 m_process->ReadPointerFromMemory(result_ptr - ptr_size);
334 if (!exception_addr) {
335 llvm::consumeError(exception_addr.takeError());
348 return dyn_exception;
static llvm::raw_ostream & error(Stream &strm)
static const char * vtable_demangled_prefix
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
void SetRawAddress(lldb::addr_t addr)
bool IsSectionOffset() const
Check if an address is section offset.
llvm::Triple & GetTriple()
Architecture triple accessor.
CommonABIRuntime(Process *process)
void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info)
lldb::TypeSP LookupTypeByName(llvm::StringRef type_name, lldb::ModuleSP preferred_module, bool &any_found) const
Find a type by its name, preferably in preferred_module.
TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr)
Represents a generic declaration context in a program.
Generic representation of a type in a programming language.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
void SetUnwindOnError(bool unwind=false)
void SetTryAllThreads(bool try_others=true)
void SetTimeout(const Timeout< std::micro > &timeout)
void SetStopOthers(bool stop_others=true)
void SetIgnoreBreakpoints(bool ignore=false)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void EmplaceBack(Args &&...args)
Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
Encapsulates a function that can be called.
lldb::ExpressionResults ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager, Value &results)
Run the function this FunctionCaller was created with.
void AppendExceptionBreakpointFilterModules(FileSpecList &list, const Target &target) override
ItaniumABIRuntime(Process *process)
TypeAndOrName FindTypeInfoWithDemangling(ValueObject &in_value, const LanguageRuntime::VTableInfo &vtable_info) const
llvm::StringRef GetName() const override
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, const LanguageRuntime::VTableInfo &vtable_info, TypeAndOrName &class_type_or_name, Address &dynamic_address) override
TypeAndOrName FindTypeInfoWithClangVTable(ValueObject &in_value, const LanguageRuntime::VTableInfo &vtable_info) const
clang emits a DW_TAG_variable called __clang_vtable inside the enclosing class this function uses tha...
TypeAndOrName GetTypeInfo(ValueObject &in_value, const LanguageRuntime::VTableInfo &vtable_info)
void AppendExceptionBreakpointFunctions(std::vector< const char * > &names, bool catch_bp, bool throw_bp, bool for_expressions) override
bool IsVTableSymbol(Mangled &manged) const override
A class that handles mangled names.
ConstString GetDemangledName() const
Demangled name get accessor.
A collection class for Module objects.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
A plug-in interface definition class for debugging a process.
unsigned long long ULongLong(unsigned long long fail_value=0) const
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Defines a symbol context baton that can be handed other debug core functions.
Symbol * symbol
The Symbol for a given query.
lldb::addr_t GetLoadAddress(Target *target) const
lldb::ModuleSP CalculateSymbolContextModule() override
Address GetAddress() const
int64_t ReadSignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, int64_t fail_value, Status &error, bool force_live_memory=false)
const ArchSpec & GetArchitecture() const
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
void SetName(ConstString type_name)
CompilerType GetCompilerType() const
void SetTypeSP(lldb::TypeSP type_sp)
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
static bool IsCXXClassType(const CompilerType &type)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
virtual ConstString GetTypeName()
CompilerType GetCompilerType()
AddrAndType GetPointerValue()
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type, ValueObject *parent=nullptr)
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eLanguageTypeC
Non-standardized C, such as K&R.
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::Module > ModuleSP
Symbol * symbol
Address of the vtable's virtual function table.