1 //===-- ItaniumABILanguageRuntime.cpp -------------------------------------===// 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 #include "ItaniumABILanguageRuntime.h" 10 11 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" 12 #include "lldb/Breakpoint/BreakpointLocation.h" 13 #include "lldb/Core/Mangled.h" 14 #include "lldb/Core/Module.h" 15 #include "lldb/Core/PluginManager.h" 16 #include "lldb/Core/ValueObject.h" 17 #include "lldb/Core/ValueObjectMemory.h" 18 #include "lldb/DataFormatters/FormattersHelpers.h" 19 #include "lldb/Expression/DiagnosticManager.h" 20 #include "lldb/Expression/FunctionCaller.h" 21 #include "lldb/Interpreter/CommandObject.h" 22 #include "lldb/Interpreter/CommandObjectMultiword.h" 23 #include "lldb/Interpreter/CommandReturnObject.h" 24 #include "lldb/Symbol/Symbol.h" 25 #include "lldb/Symbol/SymbolFile.h" 26 #include "lldb/Symbol/TypeList.h" 27 #include "lldb/Target/Process.h" 28 #include "lldb/Target/RegisterContext.h" 29 #include "lldb/Target/SectionLoadList.h" 30 #include "lldb/Target/StopInfo.h" 31 #include "lldb/Target/Target.h" 32 #include "lldb/Target/Thread.h" 33 #include "lldb/Utility/ConstString.h" 34 #include "lldb/Utility/Log.h" 35 #include "lldb/Utility/Scalar.h" 36 #include "lldb/Utility/Status.h" 37 38 #include <vector> 39 40 using namespace lldb; 41 using namespace lldb_private; 42 43 static const char *vtable_demangled_prefix = "vtable for "; 44 45 char ItaniumABILanguageRuntime::ID = 0; 46 47 bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) { 48 const bool check_cxx = true; 49 const bool check_objc = false; 50 return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx, 51 check_objc); 52 } 53 54 TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress( 55 ValueObject &in_value, lldb::addr_t original_ptr, 56 lldb::addr_t vtable_load_addr) { 57 if (m_process && vtable_load_addr != LLDB_INVALID_ADDRESS) { 58 // Find the symbol that contains the "vtable_load_addr" address 59 Address vtable_addr; 60 Target &target = m_process->GetTarget(); 61 if (!target.GetSectionLoadList().IsEmpty()) { 62 if (target.GetSectionLoadList().ResolveLoadAddress(vtable_load_addr, 63 vtable_addr)) { 64 // See if we have cached info for this type already 65 TypeAndOrName type_info = GetDynamicTypeInfo(vtable_addr); 66 if (type_info) 67 return type_info; 68 69 SymbolContext sc; 70 target.GetImages().ResolveSymbolContextForAddress( 71 vtable_addr, eSymbolContextSymbol, sc); 72 Symbol *symbol = sc.symbol; 73 if (symbol != nullptr) { 74 const char *name = 75 symbol->GetMangled().GetDemangledName().AsCString(); 76 if (name && strstr(name, vtable_demangled_prefix) == name) { 77 Log *log( 78 lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); 79 LLDB_LOGF(log, 80 "0x%16.16" PRIx64 81 ": static-type = '%s' has vtable symbol '%s'\n", 82 original_ptr, in_value.GetTypeName().GetCString(), name); 83 // We are a C++ class, that's good. Get the class name and look it 84 // up: 85 const char *class_name = name + strlen(vtable_demangled_prefix); 86 // We know the class name is absolute, so tell FindTypes that by 87 // prefixing it with the root namespace: 88 std::string lookup_name("::"); 89 lookup_name.append(class_name); 90 91 type_info.SetName(class_name); 92 const bool exact_match = true; 93 TypeList class_types; 94 95 // First look in the module that the vtable symbol came from and 96 // look for a single exact match. 97 llvm::DenseSet<SymbolFile *> searched_symbol_files; 98 if (sc.module_sp) 99 sc.module_sp->FindTypes(ConstString(lookup_name), exact_match, 1, 100 searched_symbol_files, class_types); 101 102 // If we didn't find a symbol, then move on to the entire module 103 // list in the target and get as many unique matches as possible 104 if (class_types.Empty()) 105 target.GetImages().FindTypes(nullptr, ConstString(lookup_name), 106 exact_match, UINT32_MAX, 107 searched_symbol_files, class_types); 108 109 lldb::TypeSP type_sp; 110 if (class_types.Empty()) { 111 LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n", 112 original_ptr); 113 return TypeAndOrName(); 114 } 115 if (class_types.GetSize() == 1) { 116 type_sp = class_types.GetTypeAtIndex(0); 117 if (type_sp) { 118 if (TypeSystemClang::IsCXXClassType( 119 type_sp->GetForwardCompilerType())) { 120 LLDB_LOGF( 121 log, 122 "0x%16.16" PRIx64 123 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64 124 "}, type-name='%s'\n", 125 original_ptr, in_value.GetTypeName().AsCString(), 126 type_sp->GetID(), type_sp->GetName().GetCString()); 127 type_info.SetTypeSP(type_sp); 128 } 129 } 130 } else { 131 size_t i; 132 if (log) { 133 for (i = 0; i < class_types.GetSize(); i++) { 134 type_sp = class_types.GetTypeAtIndex(i); 135 if (type_sp) { 136 LLDB_LOGF( 137 log, 138 "0x%16.16" PRIx64 139 ": static-type = '%s' has multiple matching dynamic " 140 "types: uid={0x%" PRIx64 "}, type-name='%s'\n", 141 original_ptr, in_value.GetTypeName().AsCString(), 142 type_sp->GetID(), type_sp->GetName().GetCString()); 143 } 144 } 145 } 146 147 for (i = 0; i < class_types.GetSize(); i++) { 148 type_sp = class_types.GetTypeAtIndex(i); 149 if (type_sp) { 150 if (TypeSystemClang::IsCXXClassType( 151 type_sp->GetForwardCompilerType())) { 152 LLDB_LOGF( 153 log, 154 "0x%16.16" PRIx64 ": static-type = '%s' has multiple " 155 "matching dynamic types, picking " 156 "this one: uid={0x%" PRIx64 "}, type-name='%s'\n", 157 original_ptr, in_value.GetTypeName().AsCString(), 158 type_sp->GetID(), type_sp->GetName().GetCString()); 159 type_info.SetTypeSP(type_sp); 160 } 161 } 162 } 163 164 if (log) { 165 LLDB_LOGF(log, 166 "0x%16.16" PRIx64 167 ": static-type = '%s' has multiple matching dynamic " 168 "types, didn't find a C++ match\n", 169 original_ptr, in_value.GetTypeName().AsCString()); 170 } 171 } 172 if (type_info) 173 SetDynamicTypeInfo(vtable_addr, type_info); 174 return type_info; 175 } 176 } 177 } 178 } 179 } 180 return TypeAndOrName(); 181 } 182 183 bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( 184 ValueObject &in_value, lldb::DynamicValueType use_dynamic, 185 TypeAndOrName &class_type_or_name, Address &dynamic_address, 186 Value::ValueType &value_type) { 187 // For Itanium, if the type has a vtable pointer in the object, it will be at 188 // offset 0 in the object. That will point to the "address point" within the 189 // vtable (not the beginning of the vtable.) We can then look up the symbol 190 // containing this "address point" and that symbol's name demangled will 191 // contain the full class name. The second pointer above the "address point" 192 // is the "offset_to_top". We'll use that to get the start of the value 193 // object which holds the dynamic type. 194 // 195 196 class_type_or_name.Clear(); 197 value_type = Value::ValueType::eValueTypeScalar; 198 199 // Only a pointer or reference type can have a different dynamic and static 200 // type: 201 if (!CouldHaveDynamicValue(in_value)) 202 return false; 203 204 // First job, pull out the address at 0 offset from the object. 205 AddressType address_type; 206 lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type); 207 if (original_ptr == LLDB_INVALID_ADDRESS) 208 return false; 209 210 ExecutionContext exe_ctx(in_value.GetExecutionContextRef()); 211 212 Process *process = exe_ctx.GetProcessPtr(); 213 214 if (process == nullptr) 215 return false; 216 217 Status error; 218 const lldb::addr_t vtable_address_point = 219 process->ReadPointerFromMemory(original_ptr, error); 220 221 if (!error.Success() || vtable_address_point == LLDB_INVALID_ADDRESS) 222 return false; 223 224 class_type_or_name = GetTypeInfoFromVTableAddress(in_value, original_ptr, 225 vtable_address_point); 226 227 if (!class_type_or_name) 228 return false; 229 230 CompilerType type = class_type_or_name.GetCompilerType(); 231 // There can only be one type with a given name, so we've just found 232 // duplicate definitions, and this one will do as well as any other. We 233 // don't consider something to have a dynamic type if it is the same as 234 // the static type. So compare against the value we were handed. 235 if (!type) 236 return true; 237 238 if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) { 239 // The dynamic type we found was the same type, so we don't have a 240 // dynamic type here... 241 return false; 242 } 243 244 // The offset_to_top is two pointers above the vtable pointer. 245 const uint32_t addr_byte_size = process->GetAddressByteSize(); 246 const lldb::addr_t offset_to_top_location = 247 vtable_address_point - 2 * addr_byte_size; 248 // Watch for underflow, offset_to_top_location should be less than 249 // vtable_address_point 250 if (offset_to_top_location >= vtable_address_point) 251 return false; 252 const int64_t offset_to_top = process->ReadSignedIntegerFromMemory( 253 offset_to_top_location, addr_byte_size, INT64_MIN, error); 254 255 if (offset_to_top == INT64_MIN) 256 return false; 257 // So the dynamic type is a value that starts at offset_to_top above 258 // the original address. 259 lldb::addr_t dynamic_addr = original_ptr + offset_to_top; 260 if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress( 261 dynamic_addr, dynamic_address)) { 262 dynamic_address.SetRawAddress(dynamic_addr); 263 } 264 return true; 265 } 266 267 TypeAndOrName ItaniumABILanguageRuntime::FixUpDynamicType( 268 const TypeAndOrName &type_and_or_name, ValueObject &static_value) { 269 CompilerType static_type(static_value.GetCompilerType()); 270 Flags static_type_flags(static_type.GetTypeInfo()); 271 272 TypeAndOrName ret(type_and_or_name); 273 if (type_and_or_name.HasType()) { 274 // The type will always be the type of the dynamic object. If our parent's 275 // type was a pointer, then our type should be a pointer to the type of the 276 // dynamic object. If a reference, then the original type should be 277 // okay... 278 CompilerType orig_type = type_and_or_name.GetCompilerType(); 279 CompilerType corrected_type = orig_type; 280 if (static_type_flags.AllSet(eTypeIsPointer)) 281 corrected_type = orig_type.GetPointerType(); 282 else if (static_type_flags.AllSet(eTypeIsReference)) 283 corrected_type = orig_type.GetLValueReferenceType(); 284 ret.SetCompilerType(corrected_type); 285 } else { 286 // If we are here we need to adjust our dynamic type name to include the 287 // correct & or * symbol 288 std::string corrected_name(type_and_or_name.GetName().GetCString()); 289 if (static_type_flags.AllSet(eTypeIsPointer)) 290 corrected_name.append(" *"); 291 else if (static_type_flags.AllSet(eTypeIsReference)) 292 corrected_name.append(" &"); 293 // the parent type should be a correctly pointer'ed or referenc'ed type 294 ret.SetCompilerType(static_type); 295 ret.SetName(corrected_name.c_str()); 296 } 297 return ret; 298 } 299 300 // Static Functions 301 LanguageRuntime * 302 ItaniumABILanguageRuntime::CreateInstance(Process *process, 303 lldb::LanguageType language) { 304 // FIXME: We have to check the process and make sure we actually know that 305 // this process supports 306 // the Itanium ABI. 307 if (language == eLanguageTypeC_plus_plus || 308 language == eLanguageTypeC_plus_plus_03 || 309 language == eLanguageTypeC_plus_plus_11 || 310 language == eLanguageTypeC_plus_plus_14) 311 return new ItaniumABILanguageRuntime(process); 312 else 313 return nullptr; 314 } 315 316 class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed { 317 public: 318 CommandObjectMultiwordItaniumABI_Demangle(CommandInterpreter &interpreter) 319 : CommandObjectParsed(interpreter, "demangle", 320 "Demangle a C++ mangled name.", 321 "language cplusplus demangle") { 322 CommandArgumentEntry arg; 323 CommandArgumentData index_arg; 324 325 // Define the first (and only) variant of this arg. 326 index_arg.arg_type = eArgTypeSymbol; 327 index_arg.arg_repetition = eArgRepeatPlus; 328 329 // There is only one variant this argument could be; put it into the 330 // argument entry. 331 arg.push_back(index_arg); 332 333 // Push the data for the first argument into the m_arguments vector. 334 m_arguments.push_back(arg); 335 } 336 337 ~CommandObjectMultiwordItaniumABI_Demangle() override = default; 338 339 protected: 340 bool DoExecute(Args &command, CommandReturnObject &result) override { 341 bool demangled_any = false; 342 bool error_any = false; 343 for (auto &entry : command.entries()) { 344 if (entry.ref().empty()) 345 continue; 346 347 // the actual Mangled class should be strict about this, but on the 348 // command line if you're copying mangled names out of 'nm' on Darwin, 349 // they will come out with an extra underscore - be willing to strip this 350 // on behalf of the user. This is the moral equivalent of the -_/-n 351 // options to c++filt 352 auto name = entry.ref(); 353 if (name.startswith("__Z")) 354 name = name.drop_front(); 355 356 Mangled mangled(name); 357 if (mangled.GuessLanguage() == lldb::eLanguageTypeC_plus_plus) { 358 ConstString demangled(mangled.GetDisplayDemangledName()); 359 demangled_any = true; 360 result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(), 361 demangled.GetCString()); 362 } else { 363 error_any = true; 364 result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n", 365 entry.ref().str().c_str()); 366 } 367 } 368 369 result.SetStatus( 370 error_any ? lldb::eReturnStatusFailed 371 : (demangled_any ? lldb::eReturnStatusSuccessFinishResult 372 : lldb::eReturnStatusSuccessFinishNoResult)); 373 return result.Succeeded(); 374 } 375 }; 376 377 class CommandObjectMultiwordItaniumABI : public CommandObjectMultiword { 378 public: 379 CommandObjectMultiwordItaniumABI(CommandInterpreter &interpreter) 380 : CommandObjectMultiword( 381 interpreter, "cplusplus", 382 "Commands for operating on the C++ language runtime.", 383 "cplusplus <subcommand> [<subcommand-options>]") { 384 LoadSubCommand( 385 "demangle", 386 CommandObjectSP( 387 new CommandObjectMultiwordItaniumABI_Demangle(interpreter))); 388 } 389 390 ~CommandObjectMultiwordItaniumABI() override = default; 391 }; 392 393 void ItaniumABILanguageRuntime::Initialize() { 394 PluginManager::RegisterPlugin( 395 GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance, 396 [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP { 397 return CommandObjectSP( 398 new CommandObjectMultiwordItaniumABI(interpreter)); 399 }); 400 } 401 402 void ItaniumABILanguageRuntime::Terminate() { 403 PluginManager::UnregisterPlugin(CreateInstance); 404 } 405 406 lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginNameStatic() { 407 static ConstString g_name("itanium"); 408 return g_name; 409 } 410 411 // PluginInterface protocol 412 lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginName() { 413 return GetPluginNameStatic(); 414 } 415 416 uint32_t ItaniumABILanguageRuntime::GetPluginVersion() { return 1; } 417 418 BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver( 419 Breakpoint *bkpt, bool catch_bp, bool throw_bp) { 420 return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false); 421 } 422 423 BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver( 424 Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions) { 425 // One complication here is that most users DON'T want to stop at 426 // __cxa_allocate_expression, but until we can do anything better with 427 // predicting unwinding the expression parser does. So we have two forms of 428 // the exception breakpoints, one for expressions that leaves out 429 // __cxa_allocate_exception, and one that includes it. The 430 // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in 431 // the runtime the former. 432 static const char *g_catch_name = "__cxa_begin_catch"; 433 static const char *g_throw_name1 = "__cxa_throw"; 434 static const char *g_throw_name2 = "__cxa_rethrow"; 435 static const char *g_exception_throw_name = "__cxa_allocate_exception"; 436 std::vector<const char *> exception_names; 437 exception_names.reserve(4); 438 if (catch_bp) 439 exception_names.push_back(g_catch_name); 440 441 if (throw_bp) { 442 exception_names.push_back(g_throw_name1); 443 exception_names.push_back(g_throw_name2); 444 } 445 446 if (for_expressions) 447 exception_names.push_back(g_exception_throw_name); 448 449 BreakpointResolverSP resolver_sp(new BreakpointResolverName( 450 bkpt, exception_names.data(), exception_names.size(), 451 eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo)); 452 453 return resolver_sp; 454 } 455 456 lldb::SearchFilterSP ItaniumABILanguageRuntime::CreateExceptionSearchFilter() { 457 Target &target = m_process->GetTarget(); 458 459 FileSpecList filter_modules; 460 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) { 461 // Limit the number of modules that are searched for these breakpoints for 462 // Apple binaries. 463 filter_modules.EmplaceBack("libc++abi.dylib"); 464 filter_modules.EmplaceBack("libSystem.B.dylib"); 465 } 466 return target.GetSearchFilterForModuleList(&filter_modules); 467 } 468 469 lldb::BreakpointSP ItaniumABILanguageRuntime::CreateExceptionBreakpoint( 470 bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) { 471 Target &target = m_process->GetTarget(); 472 FileSpecList filter_modules; 473 BreakpointResolverSP exception_resolver_sp = 474 CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions); 475 SearchFilterSP filter_sp(CreateExceptionSearchFilter()); 476 const bool hardware = false; 477 const bool resolve_indirect_functions = false; 478 return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal, 479 hardware, resolve_indirect_functions); 480 } 481 482 void ItaniumABILanguageRuntime::SetExceptionBreakpoints() { 483 if (!m_process) 484 return; 485 486 const bool catch_bp = false; 487 const bool throw_bp = true; 488 const bool is_internal = true; 489 const bool for_expressions = true; 490 491 // For the exception breakpoints set by the Expression parser, we'll be a 492 // little more aggressive and stop at exception allocation as well. 493 494 if (m_cxx_exception_bp_sp) { 495 m_cxx_exception_bp_sp->SetEnabled(true); 496 } else { 497 m_cxx_exception_bp_sp = CreateExceptionBreakpoint( 498 catch_bp, throw_bp, for_expressions, is_internal); 499 if (m_cxx_exception_bp_sp) 500 m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception"); 501 } 502 } 503 504 void ItaniumABILanguageRuntime::ClearExceptionBreakpoints() { 505 if (!m_process) 506 return; 507 508 if (m_cxx_exception_bp_sp) { 509 m_cxx_exception_bp_sp->SetEnabled(false); 510 } 511 } 512 513 bool ItaniumABILanguageRuntime::ExceptionBreakpointsAreSet() { 514 return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled(); 515 } 516 517 bool ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop( 518 lldb::StopInfoSP stop_reason) { 519 if (!m_process) 520 return false; 521 522 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint) 523 return false; 524 525 uint64_t break_site_id = stop_reason->GetValue(); 526 return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint( 527 break_site_id, m_cxx_exception_bp_sp->GetID()); 528 } 529 530 ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread( 531 ThreadSP thread_sp) { 532 if (!thread_sp->SafeToCallFunctions()) 533 return {}; 534 535 TypeSystemClang *clang_ast_context = 536 TypeSystemClang::GetScratch(m_process->GetTarget()); 537 if (!clang_ast_context) 538 return {}; 539 540 CompilerType voidstar = 541 clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); 542 543 DiagnosticManager diagnostics; 544 ExecutionContext exe_ctx; 545 EvaluateExpressionOptions options; 546 547 options.SetUnwindOnError(true); 548 options.SetIgnoreBreakpoints(true); 549 options.SetStopOthers(true); 550 options.SetTimeout(m_process->GetUtilityExpressionTimeout()); 551 options.SetTryAllThreads(false); 552 thread_sp->CalculateExecutionContext(exe_ctx); 553 554 const ModuleList &modules = m_process->GetTarget().GetImages(); 555 SymbolContextList contexts; 556 SymbolContext context; 557 558 modules.FindSymbolsWithNameAndType( 559 ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts); 560 contexts.GetContextAtIndex(0, context); 561 if (!context.symbol) { 562 return {}; 563 } 564 Address addr = context.symbol->GetAddress(); 565 566 Status error; 567 FunctionCaller *function_caller = 568 m_process->GetTarget().GetFunctionCallerForLanguage( 569 eLanguageTypeC, voidstar, addr, ValueList(), "caller", error); 570 571 ExpressionResults func_call_ret; 572 Value results; 573 func_call_ret = function_caller->ExecuteFunction(exe_ctx, nullptr, options, 574 diagnostics, results); 575 if (func_call_ret != eExpressionCompleted || !error.Success()) { 576 return ValueObjectSP(); 577 } 578 579 size_t ptr_size = m_process->GetAddressByteSize(); 580 addr_t result_ptr = results.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); 581 addr_t exception_addr = 582 m_process->ReadPointerFromMemory(result_ptr - ptr_size, error); 583 584 if (!error.Success()) { 585 return ValueObjectSP(); 586 } 587 588 lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr, 589 *m_process); 590 ValueObjectSP exception = ValueObject::CreateValueObjectFromData( 591 "exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx, 592 voidstar); 593 exception = exception->GetDynamicValue(eDynamicDontRunTarget); 594 595 return exception; 596 } 597 598 TypeAndOrName ItaniumABILanguageRuntime::GetDynamicTypeInfo( 599 const lldb_private::Address &vtable_addr) { 600 std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex); 601 DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr); 602 if (pos == m_dynamic_type_map.end()) 603 return TypeAndOrName(); 604 else 605 return pos->second; 606 } 607 608 void ItaniumABILanguageRuntime::SetDynamicTypeInfo( 609 const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) { 610 std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex); 611 m_dynamic_type_map[vtable_addr] = type_info; 612 } 613