Path: blob/main/contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
39688 views
//===-- ItaniumABILanguageRuntime.cpp -------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "ItaniumABILanguageRuntime.h"910#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"11#include "lldb/Breakpoint/BreakpointLocation.h"12#include "lldb/Core/Mangled.h"13#include "lldb/Core/Module.h"14#include "lldb/Core/PluginManager.h"15#include "lldb/Core/ValueObject.h"16#include "lldb/Core/ValueObjectMemory.h"17#include "lldb/DataFormatters/FormattersHelpers.h"18#include "lldb/Expression/DiagnosticManager.h"19#include "lldb/Expression/FunctionCaller.h"20#include "lldb/Interpreter/CommandObject.h"21#include "lldb/Interpreter/CommandObjectMultiword.h"22#include "lldb/Interpreter/CommandReturnObject.h"23#include "lldb/Symbol/Symbol.h"24#include "lldb/Symbol/SymbolFile.h"25#include "lldb/Symbol/TypeList.h"26#include "lldb/Target/Process.h"27#include "lldb/Target/RegisterContext.h"28#include "lldb/Target/SectionLoadList.h"29#include "lldb/Target/StopInfo.h"30#include "lldb/Target/Target.h"31#include "lldb/Target/Thread.h"32#include "lldb/Utility/ConstString.h"33#include "lldb/Utility/LLDBLog.h"34#include "lldb/Utility/Log.h"35#include "lldb/Utility/Scalar.h"36#include "lldb/Utility/Status.h"3738#include <vector>3940using namespace lldb;41using namespace lldb_private;4243LLDB_PLUGIN_DEFINE_ADV(ItaniumABILanguageRuntime, CXXItaniumABI)4445static const char *vtable_demangled_prefix = "vtable for ";4647char ItaniumABILanguageRuntime::ID = 0;4849bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {50const bool check_cxx = true;51const bool check_objc = false;52return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx,53check_objc);54}5556TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo(57ValueObject &in_value, const VTableInfo &vtable_info) {58if (vtable_info.addr.IsSectionOffset()) {59// See if we have cached info for this type already60TypeAndOrName type_info = GetDynamicTypeInfo(vtable_info.addr);61if (type_info)62return type_info;6364if (vtable_info.symbol) {65Log *log = GetLog(LLDBLog::Object);66llvm::StringRef symbol_name =67vtable_info.symbol->GetMangled().GetDemangledName().GetStringRef();68LLDB_LOGF(log,69"0x%16.16" PRIx6470": static-type = '%s' has vtable symbol '%s'\n",71in_value.GetPointerValue(),72in_value.GetTypeName().GetCString(),73symbol_name.str().c_str());74// We are a C++ class, that's good. Get the class name and look it75// up:76llvm::StringRef class_name = symbol_name;77class_name.consume_front(vtable_demangled_prefix);78// We know the class name is absolute, so tell FindTypes that by79// prefixing it with the root namespace:80std::string lookup_name("::");81lookup_name.append(class_name.data(), class_name.size());8283type_info.SetName(class_name);84ConstString const_lookup_name(lookup_name);85TypeList class_types;86ModuleSP module_sp = vtable_info.symbol->CalculateSymbolContextModule();87// First look in the module that the vtable symbol came from and88// look for a single exact match.89TypeResults results;90TypeQuery query(const_lookup_name.GetStringRef(),91TypeQueryOptions::e_exact_match |92TypeQueryOptions::e_find_one);93if (module_sp) {94module_sp->FindTypes(query, results);95TypeSP type_sp = results.GetFirstType();96if (type_sp)97class_types.Insert(type_sp);98}99100// If we didn't find a symbol, then move on to the entire module101// list in the target and get as many unique matches as possible102if (class_types.Empty()) {103query.SetFindOne(false);104m_process->GetTarget().GetImages().FindTypes(nullptr, query, results);105for (const auto &type_sp : results.GetTypeMap().Types())106class_types.Insert(type_sp);107}108109lldb::TypeSP type_sp;110if (class_types.Empty()) {111LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",112in_value.GetPointerValue());113return TypeAndOrName();114}115if (class_types.GetSize() == 1) {116type_sp = class_types.GetTypeAtIndex(0);117if (type_sp) {118if (TypeSystemClang::IsCXXClassType(119type_sp->GetForwardCompilerType())) {120LLDB_LOGF(121log,122"0x%16.16" PRIx64123": static-type = '%s' has dynamic type: uid={0x%" PRIx64124"}, type-name='%s'\n",125in_value.GetPointerValue(), in_value.GetTypeName().AsCString(),126type_sp->GetID(), type_sp->GetName().GetCString());127type_info.SetTypeSP(type_sp);128}129}130} else {131size_t i;132if (log) {133for (i = 0; i < class_types.GetSize(); i++) {134type_sp = class_types.GetTypeAtIndex(i);135if (type_sp) {136LLDB_LOGF(137log,138"0x%16.16" PRIx64139": static-type = '%s' has multiple matching dynamic "140"types: uid={0x%" PRIx64 "}, type-name='%s'\n",141in_value.GetPointerValue(),142in_value.GetTypeName().AsCString(),143type_sp->GetID(), type_sp->GetName().GetCString());144}145}146}147148for (i = 0; i < class_types.GetSize(); i++) {149type_sp = class_types.GetTypeAtIndex(i);150if (type_sp) {151if (TypeSystemClang::IsCXXClassType(152type_sp->GetForwardCompilerType())) {153LLDB_LOGF(154log,155"0x%16.16" PRIx64 ": static-type = '%s' has multiple "156"matching dynamic types, picking "157"this one: uid={0x%" PRIx64 "}, type-name='%s'\n",158in_value.GetPointerValue(),159in_value.GetTypeName().AsCString(),160type_sp->GetID(), type_sp->GetName().GetCString());161type_info.SetTypeSP(type_sp);162}163}164}165166if (log) {167LLDB_LOGF(log,168"0x%16.16" PRIx64169": static-type = '%s' has multiple matching dynamic "170"types, didn't find a C++ match\n",171in_value.GetPointerValue(),172in_value.GetTypeName().AsCString());173}174}175if (type_info)176SetDynamicTypeInfo(vtable_info.addr, type_info);177return type_info;178}179}180return TypeAndOrName();181}182183llvm::Error ItaniumABILanguageRuntime::TypeHasVTable(CompilerType type) {184// Check to make sure the class has a vtable.185CompilerType original_type = type;186if (type.IsPointerOrReferenceType()) {187CompilerType pointee_type = type.GetPointeeType();188if (pointee_type)189type = pointee_type;190}191192// Make sure this is a class or a struct first by checking the type class193// bitfield that gets returned.194if ((type.GetTypeClass() & (eTypeClassStruct | eTypeClassClass)) == 0) {195return llvm::createStringError(std::errc::invalid_argument,196"type \"%s\" is not a class or struct or a pointer to one",197original_type.GetTypeName().AsCString("<invalid>"));198}199200// Check if the type has virtual functions by asking it if it is polymorphic.201if (!type.IsPolymorphicClass()) {202return llvm::createStringError(std::errc::invalid_argument,203"type \"%s\" doesn't have a vtable",204type.GetTypeName().AsCString("<invalid>"));205}206return llvm::Error::success();207}208209// This function can accept both pointers or references to classes as well as210// instances of classes. If you are using this function during dynamic type211// detection, only valid ValueObjects that return true to212// CouldHaveDynamicValue(...) should call this function and \a check_type213// should be set to false. This function is also used by ValueObjectVTable214// and is can pass in instances of classes which is not suitable for dynamic215// type detection, these cases should pass true for \a check_type.216llvm::Expected<LanguageRuntime::VTableInfo>217ItaniumABILanguageRuntime::GetVTableInfo(ValueObject &in_value,218bool check_type) {219220CompilerType type = in_value.GetCompilerType();221if (check_type) {222if (llvm::Error err = TypeHasVTable(type))223return std::move(err);224}225ExecutionContext exe_ctx(in_value.GetExecutionContextRef());226Process *process = exe_ctx.GetProcessPtr();227if (process == nullptr)228return llvm::createStringError(std::errc::invalid_argument,229"invalid process");230231AddressType address_type;232lldb::addr_t original_ptr = LLDB_INVALID_ADDRESS;233if (type.IsPointerOrReferenceType())234original_ptr = in_value.GetPointerValue(&address_type);235else236original_ptr = in_value.GetAddressOf(/*scalar_is_load_address=*/true,237&address_type);238if (original_ptr == LLDB_INVALID_ADDRESS || address_type != eAddressTypeLoad)239return llvm::createStringError(std::errc::invalid_argument,240"failed to get the address of the value");241242Status error;243lldb::addr_t vtable_load_addr =244process->ReadPointerFromMemory(original_ptr, error);245246if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS)247return llvm::createStringError(std::errc::invalid_argument,248"failed to read vtable pointer from memory at 0x%" PRIx64,249original_ptr);250251// The vtable load address can have authentication bits with252// AArch64 targets on Darwin.253vtable_load_addr = process->FixDataAddress(vtable_load_addr);254255// Find the symbol that contains the "vtable_load_addr" address256Address vtable_addr;257if (!process->GetTarget().ResolveLoadAddress(vtable_load_addr, vtable_addr))258return llvm::createStringError(std::errc::invalid_argument,259"failed to resolve vtable pointer 0x%"260PRIx64 "to a section", vtable_load_addr);261262// Check our cache first to see if we already have this info263{264std::lock_guard<std::mutex> locker(m_mutex);265auto pos = m_vtable_info_map.find(vtable_addr);266if (pos != m_vtable_info_map.end())267return pos->second;268}269270Symbol *symbol = vtable_addr.CalculateSymbolContextSymbol();271if (symbol == nullptr)272return llvm::createStringError(std::errc::invalid_argument,273"no symbol found for 0x%" PRIx64,274vtable_load_addr);275llvm::StringRef name = symbol->GetMangled().GetDemangledName().GetStringRef();276if (name.starts_with(vtable_demangled_prefix)) {277VTableInfo info = {vtable_addr, symbol};278std::lock_guard<std::mutex> locker(m_mutex);279auto pos = m_vtable_info_map[vtable_addr] = info;280return info;281}282return llvm::createStringError(std::errc::invalid_argument,283"symbol found that contains 0x%" PRIx64 " is not a vtable symbol",284vtable_load_addr);285}286287bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(288ValueObject &in_value, lldb::DynamicValueType use_dynamic,289TypeAndOrName &class_type_or_name, Address &dynamic_address,290Value::ValueType &value_type) {291// For Itanium, if the type has a vtable pointer in the object, it will be at292// offset 0 in the object. That will point to the "address point" within the293// vtable (not the beginning of the vtable.) We can then look up the symbol294// containing this "address point" and that symbol's name demangled will295// contain the full class name. The second pointer above the "address point"296// is the "offset_to_top". We'll use that to get the start of the value297// object which holds the dynamic type.298//299300class_type_or_name.Clear();301value_type = Value::ValueType::Scalar;302303if (!CouldHaveDynamicValue(in_value))304return false;305306// Check if we have a vtable pointer in this value. If we don't it will307// return an error, else it will return a valid resolved address. We don't308// want GetVTableInfo to check the type since we accept void * as a possible309// dynamic type and that won't pass the type check. We already checked the310// type above in CouldHaveDynamicValue(...).311llvm::Expected<VTableInfo> vtable_info_or_err =312GetVTableInfo(in_value, /*check_type=*/false);313if (!vtable_info_or_err) {314llvm::consumeError(vtable_info_or_err.takeError());315return false;316}317318const VTableInfo &vtable_info = vtable_info_or_err.get();319class_type_or_name = GetTypeInfo(in_value, vtable_info);320321if (!class_type_or_name)322return false;323324CompilerType type = class_type_or_name.GetCompilerType();325// There can only be one type with a given name, so we've just found326// duplicate definitions, and this one will do as well as any other. We327// don't consider something to have a dynamic type if it is the same as328// the static type. So compare against the value we were handed.329if (!type)330return true;331332if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) {333// The dynamic type we found was the same type, so we don't have a334// dynamic type here...335return false;336}337338// The offset_to_top is two pointers above the vtable pointer.339Target &target = m_process->GetTarget();340const addr_t vtable_load_addr = vtable_info.addr.GetLoadAddress(&target);341if (vtable_load_addr == LLDB_INVALID_ADDRESS)342return false;343const uint32_t addr_byte_size = m_process->GetAddressByteSize();344const lldb::addr_t offset_to_top_location =345vtable_load_addr - 2 * addr_byte_size;346// Watch for underflow, offset_to_top_location should be less than347// vtable_load_addr348if (offset_to_top_location >= vtable_load_addr)349return false;350Status error;351const int64_t offset_to_top = m_process->ReadSignedIntegerFromMemory(352offset_to_top_location, addr_byte_size, INT64_MIN, error);353354if (offset_to_top == INT64_MIN)355return false;356// So the dynamic type is a value that starts at offset_to_top above357// the original address.358lldb::addr_t dynamic_addr = in_value.GetPointerValue() + offset_to_top;359if (!m_process->GetTarget().ResolveLoadAddress(360dynamic_addr, dynamic_address)) {361dynamic_address.SetRawAddress(dynamic_addr);362}363return true;364}365366TypeAndOrName ItaniumABILanguageRuntime::FixUpDynamicType(367const TypeAndOrName &type_and_or_name, ValueObject &static_value) {368CompilerType static_type(static_value.GetCompilerType());369Flags static_type_flags(static_type.GetTypeInfo());370371TypeAndOrName ret(type_and_or_name);372if (type_and_or_name.HasType()) {373// The type will always be the type of the dynamic object. If our parent's374// type was a pointer, then our type should be a pointer to the type of the375// dynamic object. If a reference, then the original type should be376// okay...377CompilerType orig_type = type_and_or_name.GetCompilerType();378CompilerType corrected_type = orig_type;379if (static_type_flags.AllSet(eTypeIsPointer))380corrected_type = orig_type.GetPointerType();381else if (static_type_flags.AllSet(eTypeIsReference))382corrected_type = orig_type.GetLValueReferenceType();383ret.SetCompilerType(corrected_type);384} else {385// If we are here we need to adjust our dynamic type name to include the386// correct & or * symbol387std::string corrected_name(type_and_or_name.GetName().GetCString());388if (static_type_flags.AllSet(eTypeIsPointer))389corrected_name.append(" *");390else if (static_type_flags.AllSet(eTypeIsReference))391corrected_name.append(" &");392// the parent type should be a correctly pointer'ed or referenc'ed type393ret.SetCompilerType(static_type);394ret.SetName(corrected_name.c_str());395}396return ret;397}398399// Static Functions400LanguageRuntime *401ItaniumABILanguageRuntime::CreateInstance(Process *process,402lldb::LanguageType language) {403// FIXME: We have to check the process and make sure we actually know that404// this process supports405// the Itanium ABI.406if (language == eLanguageTypeC_plus_plus ||407language == eLanguageTypeC_plus_plus_03 ||408language == eLanguageTypeC_plus_plus_11 ||409language == eLanguageTypeC_plus_plus_14)410return new ItaniumABILanguageRuntime(process);411else412return nullptr;413}414415class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed {416public:417CommandObjectMultiwordItaniumABI_Demangle(CommandInterpreter &interpreter)418: CommandObjectParsed(419interpreter, "demangle", "Demangle a C++ mangled name.",420"language cplusplus demangle [<mangled-name> ...]") {421AddSimpleArgumentList(eArgTypeSymbol, eArgRepeatPlus);422}423424~CommandObjectMultiwordItaniumABI_Demangle() override = default;425426protected:427void DoExecute(Args &command, CommandReturnObject &result) override {428bool demangled_any = false;429bool error_any = false;430for (auto &entry : command.entries()) {431if (entry.ref().empty())432continue;433434// the actual Mangled class should be strict about this, but on the435// command line if you're copying mangled names out of 'nm' on Darwin,436// they will come out with an extra underscore - be willing to strip this437// on behalf of the user. This is the moral equivalent of the -_/-n438// options to c++filt439auto name = entry.ref();440if (name.starts_with("__Z"))441name = name.drop_front();442443Mangled mangled(name);444if (mangled.GuessLanguage() == lldb::eLanguageTypeC_plus_plus) {445ConstString demangled(mangled.GetDisplayDemangledName());446demangled_any = true;447result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(),448demangled.GetCString());449} else {450error_any = true;451result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",452entry.ref().str().c_str());453}454}455456result.SetStatus(457error_any ? lldb::eReturnStatusFailed458: (demangled_any ? lldb::eReturnStatusSuccessFinishResult459: lldb::eReturnStatusSuccessFinishNoResult));460}461};462463class CommandObjectMultiwordItaniumABI : public CommandObjectMultiword {464public:465CommandObjectMultiwordItaniumABI(CommandInterpreter &interpreter)466: CommandObjectMultiword(467interpreter, "cplusplus",468"Commands for operating on the C++ language runtime.",469"cplusplus <subcommand> [<subcommand-options>]") {470LoadSubCommand(471"demangle",472CommandObjectSP(473new CommandObjectMultiwordItaniumABI_Demangle(interpreter)));474}475476~CommandObjectMultiwordItaniumABI() override = default;477};478479void ItaniumABILanguageRuntime::Initialize() {480PluginManager::RegisterPlugin(481GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance,482[](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {483return CommandObjectSP(484new CommandObjectMultiwordItaniumABI(interpreter));485});486}487488void ItaniumABILanguageRuntime::Terminate() {489PluginManager::UnregisterPlugin(CreateInstance);490}491492BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(493const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) {494return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);495}496497BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(498const BreakpointSP &bkpt, bool catch_bp, bool throw_bp,499bool for_expressions) {500// One complication here is that most users DON'T want to stop at501// __cxa_allocate_expression, but until we can do anything better with502// predicting unwinding the expression parser does. So we have two forms of503// the exception breakpoints, one for expressions that leaves out504// __cxa_allocate_exception, and one that includes it. The505// SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in506// the runtime the former.507static const char *g_catch_name = "__cxa_begin_catch";508static const char *g_throw_name1 = "__cxa_throw";509static const char *g_throw_name2 = "__cxa_rethrow";510static const char *g_exception_throw_name = "__cxa_allocate_exception";511std::vector<const char *> exception_names;512exception_names.reserve(4);513if (catch_bp)514exception_names.push_back(g_catch_name);515516if (throw_bp) {517exception_names.push_back(g_throw_name1);518exception_names.push_back(g_throw_name2);519}520521if (for_expressions)522exception_names.push_back(g_exception_throw_name);523524BreakpointResolverSP resolver_sp(new BreakpointResolverName(525bkpt, exception_names.data(), exception_names.size(),526eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));527528return resolver_sp;529}530531lldb::SearchFilterSP ItaniumABILanguageRuntime::CreateExceptionSearchFilter() {532Target &target = m_process->GetTarget();533534FileSpecList filter_modules;535if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {536// Limit the number of modules that are searched for these breakpoints for537// Apple binaries.538filter_modules.EmplaceBack("libc++abi.dylib");539filter_modules.EmplaceBack("libSystem.B.dylib");540filter_modules.EmplaceBack("libc++abi.1.0.dylib");541filter_modules.EmplaceBack("libc++abi.1.dylib");542}543return target.GetSearchFilterForModuleList(&filter_modules);544}545546lldb::BreakpointSP ItaniumABILanguageRuntime::CreateExceptionBreakpoint(547bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {548Target &target = m_process->GetTarget();549FileSpecList filter_modules;550BreakpointResolverSP exception_resolver_sp =551CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions);552SearchFilterSP filter_sp(CreateExceptionSearchFilter());553const bool hardware = false;554const bool resolve_indirect_functions = false;555return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,556hardware, resolve_indirect_functions);557}558559void ItaniumABILanguageRuntime::SetExceptionBreakpoints() {560if (!m_process)561return;562563const bool catch_bp = false;564const bool throw_bp = true;565const bool is_internal = true;566const bool for_expressions = true;567568// For the exception breakpoints set by the Expression parser, we'll be a569// little more aggressive and stop at exception allocation as well.570571if (m_cxx_exception_bp_sp) {572m_cxx_exception_bp_sp->SetEnabled(true);573} else {574m_cxx_exception_bp_sp = CreateExceptionBreakpoint(575catch_bp, throw_bp, for_expressions, is_internal);576if (m_cxx_exception_bp_sp)577m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");578}579}580581void ItaniumABILanguageRuntime::ClearExceptionBreakpoints() {582if (!m_process)583return;584585if (m_cxx_exception_bp_sp) {586m_cxx_exception_bp_sp->SetEnabled(false);587}588}589590bool ItaniumABILanguageRuntime::ExceptionBreakpointsAreSet() {591return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled();592}593594bool ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop(595lldb::StopInfoSP stop_reason) {596if (!m_process)597return false;598599if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)600return false;601602uint64_t break_site_id = stop_reason->GetValue();603return m_process->GetBreakpointSiteList().StopPointSiteContainsBreakpoint(604break_site_id, m_cxx_exception_bp_sp->GetID());605}606607ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread(608ThreadSP thread_sp) {609if (!thread_sp->SafeToCallFunctions())610return {};611612TypeSystemClangSP scratch_ts_sp =613ScratchTypeSystemClang::GetForTarget(m_process->GetTarget());614if (!scratch_ts_sp)615return {};616617CompilerType voidstar =618scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();619620DiagnosticManager diagnostics;621ExecutionContext exe_ctx;622EvaluateExpressionOptions options;623624options.SetUnwindOnError(true);625options.SetIgnoreBreakpoints(true);626options.SetStopOthers(true);627options.SetTimeout(m_process->GetUtilityExpressionTimeout());628options.SetTryAllThreads(false);629thread_sp->CalculateExecutionContext(exe_ctx);630631const ModuleList &modules = m_process->GetTarget().GetImages();632SymbolContextList contexts;633SymbolContext context;634635modules.FindSymbolsWithNameAndType(636ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts);637contexts.GetContextAtIndex(0, context);638if (!context.symbol) {639return {};640}641Address addr = context.symbol->GetAddress();642643Status error;644FunctionCaller *function_caller =645m_process->GetTarget().GetFunctionCallerForLanguage(646eLanguageTypeC, voidstar, addr, ValueList(), "caller", error);647648ExpressionResults func_call_ret;649Value results;650func_call_ret = function_caller->ExecuteFunction(exe_ctx, nullptr, options,651diagnostics, results);652if (func_call_ret != eExpressionCompleted || !error.Success()) {653return ValueObjectSP();654}655656size_t ptr_size = m_process->GetAddressByteSize();657addr_t result_ptr = results.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);658addr_t exception_addr =659m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);660661if (!error.Success()) {662return ValueObjectSP();663}664665lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,666*m_process);667ValueObjectSP exception = ValueObject::CreateValueObjectFromData(668"exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx,669voidstar);670ValueObjectSP dyn_exception671= exception->GetDynamicValue(eDynamicDontRunTarget);672// If we succeed in making a dynamic value, return that:673if (dyn_exception)674return dyn_exception;675676return exception;677}678679TypeAndOrName ItaniumABILanguageRuntime::GetDynamicTypeInfo(680const lldb_private::Address &vtable_addr) {681std::lock_guard<std::mutex> locker(m_mutex);682DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);683if (pos == m_dynamic_type_map.end())684return TypeAndOrName();685else686return pos->second;687}688689void ItaniumABILanguageRuntime::SetDynamicTypeInfo(690const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {691std::lock_guard<std::mutex> locker(m_mutex);692m_dynamic_type_map[vtable_addr] = type_info;693}694695696