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