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