LLDB mainline
ItaniumABILanguageRuntime.cpp
Go to the documentation of this file.
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
10
13#include "lldb/Core/Mangled.h"
14#include "lldb/Core/Module.h"
24#include "lldb/Symbol/Symbol.h"
27#include "lldb/Target/Process.h"
31#include "lldb/Target/Target.h"
32#include "lldb/Target/Thread.h"
35#include "lldb/Utility/Log.h"
36#include "lldb/Utility/Scalar.h"
37#include "lldb/Utility/Status.h"
38
39#include <vector>
40
41using namespace lldb;
42using namespace lldb_private;
43
45
46static const char *vtable_demangled_prefix = "vtable for ";
47
49
50bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
51 const bool check_cxx = true;
52 const bool check_objc = false;
53 return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx,
54 check_objc);
55}
56
58 ValueObject &in_value, const VTableInfo &vtable_info) {
59 if (vtable_info.addr.IsSectionOffset()) {
60 // See if we have cached info for this type already
61 TypeAndOrName type_info = GetDynamicTypeInfo(vtable_info.addr);
62 if (type_info)
63 return type_info;
64
65 if (vtable_info.symbol) {
67 llvm::StringRef symbol_name =
69 LLDB_LOGF(log,
70 "0x%16.16" PRIx64
71 ": static-type = '%s' has vtable symbol '%s'\n",
72 in_value.GetPointerValue(),
73 in_value.GetTypeName().GetCString(),
74 symbol_name.str().c_str());
75 // We are a C++ class, that's good. Get the class name and look it
76 // up:
77 llvm::StringRef class_name = symbol_name;
78 class_name.consume_front(vtable_demangled_prefix);
79 // We know the class name is absolute, so tell FindTypes that by
80 // prefixing it with the root namespace:
81 std::string lookup_name("::");
82 lookup_name.append(class_name.data(), class_name.size());
83
84 type_info.SetName(class_name);
85 const bool exact_match = true;
86 TypeList class_types;
87
88 // First look in the module that the vtable symbol came from and
89 // look for a single exact match.
90 llvm::DenseSet<SymbolFile *> searched_symbol_files;
91 ModuleSP module_sp = vtable_info.symbol->CalculateSymbolContextModule();
92 if (module_sp)
93 module_sp->FindTypes(ConstString(lookup_name), exact_match, 1,
94 searched_symbol_files, class_types);
95
96 // If we didn't find a symbol, then move on to the entire module
97 // list in the target and get as many unique matches as possible
98 Target &target = m_process->GetTarget();
99 if (class_types.Empty())
100 target.GetImages().FindTypes(nullptr, ConstString(lookup_name),
101 exact_match, UINT32_MAX,
102 searched_symbol_files, class_types);
103
104 lldb::TypeSP type_sp;
105 if (class_types.Empty()) {
106 LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",
107 in_value.GetPointerValue());
108 return TypeAndOrName();
109 }
110 if (class_types.GetSize() == 1) {
111 type_sp = class_types.GetTypeAtIndex(0);
112 if (type_sp) {
114 type_sp->GetForwardCompilerType())) {
115 LLDB_LOGF(
116 log,
117 "0x%16.16" PRIx64
118 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
119 "}, type-name='%s'\n",
120 in_value.GetPointerValue(), in_value.GetTypeName().AsCString(),
121 type_sp->GetID(), type_sp->GetName().GetCString());
122 type_info.SetTypeSP(type_sp);
123 }
124 }
125 } else {
126 size_t i;
127 if (log) {
128 for (i = 0; i < class_types.GetSize(); i++) {
129 type_sp = class_types.GetTypeAtIndex(i);
130 if (type_sp) {
131 LLDB_LOGF(
132 log,
133 "0x%16.16" PRIx64
134 ": static-type = '%s' has multiple matching dynamic "
135 "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
136 in_value.GetPointerValue(),
137 in_value.GetTypeName().AsCString(),
138 type_sp->GetID(), type_sp->GetName().GetCString());
139 }
140 }
141 }
142
143 for (i = 0; i < class_types.GetSize(); i++) {
144 type_sp = class_types.GetTypeAtIndex(i);
145 if (type_sp) {
147 type_sp->GetForwardCompilerType())) {
148 LLDB_LOGF(
149 log,
150 "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
151 "matching dynamic types, picking "
152 "this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
153 in_value.GetPointerValue(),
154 in_value.GetTypeName().AsCString(),
155 type_sp->GetID(), type_sp->GetName().GetCString());
156 type_info.SetTypeSP(type_sp);
157 }
158 }
159 }
160
161 if (log) {
162 LLDB_LOGF(log,
163 "0x%16.16" PRIx64
164 ": static-type = '%s' has multiple matching dynamic "
165 "types, didn't find a C++ match\n",
166 in_value.GetPointerValue(),
167 in_value.GetTypeName().AsCString());
168 }
169 }
170 if (type_info)
171 SetDynamicTypeInfo(vtable_info.addr, type_info);
172 return type_info;
173 }
174 }
175 return TypeAndOrName();
176}
177
179 // Check to make sure the class has a vtable.
180 CompilerType original_type = type;
181 if (type.IsPointerOrReferenceType()) {
182 CompilerType pointee_type = type.GetPointeeType();
183 if (pointee_type)
184 type = pointee_type;
185 }
186
187 // Make sure this is a class or a struct first by checking the type class
188 // bitfield that gets returned.
189 if ((type.GetTypeClass() & (eTypeClassStruct | eTypeClassClass)) == 0) {
190 return llvm::createStringError(std::errc::invalid_argument,
191 "type \"%s\" is not a class or struct or a pointer to one",
192 original_type.GetTypeName().AsCString("<invalid>"));
193 }
194
195 // Check if the type has virtual functions by asking it if it is polymorphic.
196 if (!type.IsPolymorphicClass()) {
197 return llvm::createStringError(std::errc::invalid_argument,
198 "type \"%s\" doesn't have a vtable",
199 type.GetTypeName().AsCString("<invalid>"));
200 }
201 return llvm::Error::success();
202}
203
204// This function can accept both pointers or references to classes as well as
205// instances of classes. If you are using this function during dynamic type
206// detection, only valid ValueObjects that return true to
207// CouldHaveDynamicValue(...) should call this function and \a check_type
208// should be set to false. This function is also used by ValueObjectVTable
209// and is can pass in instances of classes which is not suitable for dynamic
210// type detection, these cases should pass true for \a check_type.
211llvm::Expected<LanguageRuntime::VTableInfo>
213 bool check_type) {
214
215 CompilerType type = in_value.GetCompilerType();
216 if (check_type) {
217 if (llvm::Error err = TypeHasVTable(type))
218 return std::move(err);
219 }
220 ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
221 Process *process = exe_ctx.GetProcessPtr();
222 if (process == nullptr)
223 return llvm::createStringError(std::errc::invalid_argument,
224 "invalid process");
225
226 AddressType address_type;
227 lldb::addr_t original_ptr = LLDB_INVALID_ADDRESS;
228 if (type.IsPointerOrReferenceType())
229 original_ptr = in_value.GetPointerValue(&address_type);
230 else
231 original_ptr = in_value.GetAddressOf(/*scalar_is_load_address=*/true,
232 &address_type);
233 if (original_ptr == LLDB_INVALID_ADDRESS || address_type != eAddressTypeLoad)
234 return llvm::createStringError(std::errc::invalid_argument,
235 "failed to get the address of the value");
236
238 lldb::addr_t vtable_load_addr =
239 process->ReadPointerFromMemory(original_ptr, error);
240
241 if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS)
242 return llvm::createStringError(std::errc::invalid_argument,
243 "failed to read vtable pointer from memory at 0x%" PRIx64,
244 original_ptr);
245
246 // The vtable load address can have authentication bits with
247 // AArch64 targets on Darwin.
248 vtable_load_addr = process->FixDataAddress(vtable_load_addr);
249
250 // Find the symbol that contains the "vtable_load_addr" address
251 Address vtable_addr;
252 if (!process->GetTarget().ResolveLoadAddress(vtable_load_addr, vtable_addr))
253 return llvm::createStringError(std::errc::invalid_argument,
254 "failed to resolve vtable pointer 0x%"
255 PRIx64 "to a section", vtable_load_addr);
256
257 // Check our cache first to see if we already have this info
258 {
259 std::lock_guard<std::mutex> locker(m_mutex);
260 auto pos = m_vtable_info_map.find(vtable_addr);
261 if (pos != m_vtable_info_map.end())
262 return pos->second;
263 }
264
265 Symbol *symbol = vtable_addr.CalculateSymbolContextSymbol();
266 if (symbol == nullptr)
267 return llvm::createStringError(std::errc::invalid_argument,
268 "no symbol found for 0x%" PRIx64,
269 vtable_load_addr);
270 llvm::StringRef name = symbol->GetMangled().GetDemangledName().GetStringRef();
271 if (name.startswith(vtable_demangled_prefix)) {
272 VTableInfo info = {vtable_addr, symbol};
273 std::lock_guard<std::mutex> locker(m_mutex);
274 auto pos = m_vtable_info_map[vtable_addr] = info;
275 return info;
276 }
277 return llvm::createStringError(std::errc::invalid_argument,
278 "symbol found that contains 0x%" PRIx64 " is not a vtable symbol",
279 vtable_load_addr);
280}
281
283 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
284 TypeAndOrName &class_type_or_name, Address &dynamic_address,
285 Value::ValueType &value_type) {
286 // For Itanium, if the type has a vtable pointer in the object, it will be at
287 // offset 0 in the object. That will point to the "address point" within the
288 // vtable (not the beginning of the vtable.) We can then look up the symbol
289 // containing this "address point" and that symbol's name demangled will
290 // contain the full class name. The second pointer above the "address point"
291 // is the "offset_to_top". We'll use that to get the start of the value
292 // object which holds the dynamic type.
293 //
294
295 class_type_or_name.Clear();
296 value_type = Value::ValueType::Scalar;
297
298 if (!CouldHaveDynamicValue(in_value))
299 return false;
300
301 // Check if we have a vtable pointer in this value. If we don't it will
302 // return an error, else it will return a valid resolved address. We don't
303 // want GetVTableInfo to check the type since we accept void * as a possible
304 // dynamic type and that won't pass the type check. We already checked the
305 // type above in CouldHaveDynamicValue(...).
306 llvm::Expected<VTableInfo> vtable_info_or_err =
307 GetVTableInfo(in_value, /*check_type=*/false);
308 if (!vtable_info_or_err) {
309 llvm::consumeError(vtable_info_or_err.takeError());
310 return false;
311 }
312
313 const VTableInfo &vtable_info = vtable_info_or_err.get();
314 class_type_or_name = GetTypeInfo(in_value, vtable_info);
315
316 if (!class_type_or_name)
317 return false;
318
319 CompilerType type = class_type_or_name.GetCompilerType();
320 // There can only be one type with a given name, so we've just found
321 // duplicate definitions, and this one will do as well as any other. We
322 // don't consider something to have a dynamic type if it is the same as
323 // the static type. So compare against the value we were handed.
324 if (!type)
325 return true;
326
327 if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) {
328 // The dynamic type we found was the same type, so we don't have a
329 // dynamic type here...
330 return false;
331 }
332
333 // The offset_to_top is two pointers above the vtable pointer.
334 Target &target = m_process->GetTarget();
335 const addr_t vtable_load_addr = vtable_info.addr.GetLoadAddress(&target);
336 if (vtable_load_addr == LLDB_INVALID_ADDRESS)
337 return false;
338 const uint32_t addr_byte_size = m_process->GetAddressByteSize();
339 const lldb::addr_t offset_to_top_location =
340 vtable_load_addr - 2 * addr_byte_size;
341 // Watch for underflow, offset_to_top_location should be less than
342 // vtable_load_addr
343 if (offset_to_top_location >= vtable_load_addr)
344 return false;
346 const int64_t offset_to_top = m_process->ReadSignedIntegerFromMemory(
347 offset_to_top_location, addr_byte_size, INT64_MIN, error);
348
349 if (offset_to_top == INT64_MIN)
350 return false;
351 // So the dynamic type is a value that starts at offset_to_top above
352 // the original address.
353 lldb::addr_t dynamic_addr = in_value.GetPointerValue() + offset_to_top;
355 dynamic_addr, dynamic_address)) {
356 dynamic_address.SetRawAddress(dynamic_addr);
357 }
358 return true;
359}
360
362 const TypeAndOrName &type_and_or_name, ValueObject &static_value) {
363 CompilerType static_type(static_value.GetCompilerType());
364 Flags static_type_flags(static_type.GetTypeInfo());
365
366 TypeAndOrName ret(type_and_or_name);
367 if (type_and_or_name.HasType()) {
368 // The type will always be the type of the dynamic object. If our parent's
369 // type was a pointer, then our type should be a pointer to the type of the
370 // dynamic object. If a reference, then the original type should be
371 // okay...
372 CompilerType orig_type = type_and_or_name.GetCompilerType();
373 CompilerType corrected_type = orig_type;
374 if (static_type_flags.AllSet(eTypeIsPointer))
375 corrected_type = orig_type.GetPointerType();
376 else if (static_type_flags.AllSet(eTypeIsReference))
377 corrected_type = orig_type.GetLValueReferenceType();
378 ret.SetCompilerType(corrected_type);
379 } else {
380 // If we are here we need to adjust our dynamic type name to include the
381 // correct & or * symbol
382 std::string corrected_name(type_and_or_name.GetName().GetCString());
383 if (static_type_flags.AllSet(eTypeIsPointer))
384 corrected_name.append(" *");
385 else if (static_type_flags.AllSet(eTypeIsReference))
386 corrected_name.append(" &");
387 // the parent type should be a correctly pointer'ed or referenc'ed type
388 ret.SetCompilerType(static_type);
389 ret.SetName(corrected_name.c_str());
390 }
391 return ret;
392}
393
394// Static Functions
397 lldb::LanguageType language) {
398 // FIXME: We have to check the process and make sure we actually know that
399 // this process supports
400 // the Itanium ABI.
401 if (language == eLanguageTypeC_plus_plus ||
402 language == eLanguageTypeC_plus_plus_03 ||
403 language == eLanguageTypeC_plus_plus_11 ||
404 language == eLanguageTypeC_plus_plus_14)
405 return new ItaniumABILanguageRuntime(process);
406 else
407 return nullptr;
408}
409
411public:
414 interpreter, "demangle", "Demangle a C++ mangled name.",
415 "language cplusplus demangle [<mangled-name> ...]") {
417 CommandArgumentData index_arg;
418
419 // Define the first (and only) variant of this arg.
420 index_arg.arg_type = eArgTypeSymbol;
421 index_arg.arg_repetition = eArgRepeatPlus;
422
423 // There is only one variant this argument could be; put it into the
424 // argument entry.
425 arg.push_back(index_arg);
426
427 // Push the data for the first argument into the m_arguments vector.
428 m_arguments.push_back(arg);
429 }
430
432
433protected:
434 void DoExecute(Args &command, CommandReturnObject &result) override {
435 bool demangled_any = false;
436 bool error_any = false;
437 for (auto &entry : command.entries()) {
438 if (entry.ref().empty())
439 continue;
440
441 // the actual Mangled class should be strict about this, but on the
442 // command line if you're copying mangled names out of 'nm' on Darwin,
443 // they will come out with an extra underscore - be willing to strip this
444 // on behalf of the user. This is the moral equivalent of the -_/-n
445 // options to c++filt
446 auto name = entry.ref();
447 if (name.startswith("__Z"))
448 name = name.drop_front();
449
450 Mangled mangled(name);
452 ConstString demangled(mangled.GetDisplayDemangledName());
453 demangled_any = true;
454 result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(),
455 demangled.GetCString());
456 } else {
457 error_any = true;
458 result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",
459 entry.ref().str().c_str());
460 }
461 }
462
463 result.SetStatus(
464 error_any ? lldb::eReturnStatusFailed
467 }
468};
469
471public:
474 interpreter, "cplusplus",
475 "Commands for operating on the C++ language runtime.",
476 "cplusplus <subcommand> [<subcommand-options>]") {
477 LoadSubCommand(
478 "demangle",
481 }
482
484};
485
488 GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance,
489 [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
490 return CommandObjectSP(
491 new CommandObjectMultiwordItaniumABI(interpreter));
492 });
493}
494
497}
498
500 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) {
501 return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);
502}
503
505 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp,
506 bool for_expressions) {
507 // One complication here is that most users DON'T want to stop at
508 // __cxa_allocate_expression, but until we can do anything better with
509 // predicting unwinding the expression parser does. So we have two forms of
510 // the exception breakpoints, one for expressions that leaves out
511 // __cxa_allocate_exception, and one that includes it. The
512 // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in
513 // the runtime the former.
514 static const char *g_catch_name = "__cxa_begin_catch";
515 static const char *g_throw_name1 = "__cxa_throw";
516 static const char *g_throw_name2 = "__cxa_rethrow";
517 static const char *g_exception_throw_name = "__cxa_allocate_exception";
518 std::vector<const char *> exception_names;
519 exception_names.reserve(4);
520 if (catch_bp)
521 exception_names.push_back(g_catch_name);
522
523 if (throw_bp) {
524 exception_names.push_back(g_throw_name1);
525 exception_names.push_back(g_throw_name2);
526 }
527
528 if (for_expressions)
529 exception_names.push_back(g_exception_throw_name);
530
532 bkpt, exception_names.data(), exception_names.size(),
533 eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));
534
535 return resolver_sp;
536}
537
539 Target &target = m_process->GetTarget();
540
541 FileSpecList filter_modules;
542 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
543 // Limit the number of modules that are searched for these breakpoints for
544 // Apple binaries.
545 filter_modules.EmplaceBack("libc++abi.dylib");
546 filter_modules.EmplaceBack("libSystem.B.dylib");
547 filter_modules.EmplaceBack("libc++abi.1.0.dylib");
548 filter_modules.EmplaceBack("libc++abi.1.dylib");
549 }
550 return target.GetSearchFilterForModuleList(&filter_modules);
551}
552
554 bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {
555 Target &target = m_process->GetTarget();
556 FileSpecList filter_modules;
557 BreakpointResolverSP exception_resolver_sp =
558 CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions);
560 const bool hardware = false;
561 const bool resolve_indirect_functions = false;
562 return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
563 hardware, resolve_indirect_functions);
564}
565
567 if (!m_process)
568 return;
569
570 const bool catch_bp = false;
571 const bool throw_bp = true;
572 const bool is_internal = true;
573 const bool for_expressions = true;
574
575 // For the exception breakpoints set by the Expression parser, we'll be a
576 // little more aggressive and stop at exception allocation as well.
577
579 m_cxx_exception_bp_sp->SetEnabled(true);
580 } else {
582 catch_bp, throw_bp, for_expressions, is_internal);
584 m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
585 }
586}
587
589 if (!m_process)
590 return;
591
593 m_cxx_exception_bp_sp->SetEnabled(false);
594 }
595}
596
598 return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled();
599}
600
602 lldb::StopInfoSP stop_reason) {
603 if (!m_process)
604 return false;
605
606 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
607 return false;
608
609 uint64_t break_site_id = stop_reason->GetValue();
611 break_site_id, m_cxx_exception_bp_sp->GetID());
612}
613
615 ThreadSP thread_sp) {
616 if (!thread_sp->SafeToCallFunctions())
617 return {};
618
619 TypeSystemClangSP scratch_ts_sp =
621 if (!scratch_ts_sp)
622 return {};
623
624 CompilerType voidstar =
625 scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
626
627 DiagnosticManager diagnostics;
628 ExecutionContext exe_ctx;
630
631 options.SetUnwindOnError(true);
632 options.SetIgnoreBreakpoints(true);
633 options.SetStopOthers(true);
635 options.SetTryAllThreads(false);
636 thread_sp->CalculateExecutionContext(exe_ctx);
637
638 const ModuleList &modules = m_process->GetTarget().GetImages();
639 SymbolContextList contexts;
640 SymbolContext context;
641
643 ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts);
644 contexts.GetContextAtIndex(0, context);
645 if (!context.symbol) {
646 return {};
647 }
648 Address addr = context.symbol->GetAddress();
649
651 FunctionCaller *function_caller =
653 eLanguageTypeC, voidstar, addr, ValueList(), "caller", error);
654
655 ExpressionResults func_call_ret;
656 Value results;
657 func_call_ret = function_caller->ExecuteFunction(exe_ctx, nullptr, options,
658 diagnostics, results);
659 if (func_call_ret != eExpressionCompleted || !error.Success()) {
660 return ValueObjectSP();
661 }
662
663 size_t ptr_size = m_process->GetAddressByteSize();
664 addr_t result_ptr = results.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
665 addr_t exception_addr =
666 m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);
667
668 if (!error.Success()) {
669 return ValueObjectSP();
670 }
671
672 lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,
673 *m_process);
675 "exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx,
676 voidstar);
677 ValueObjectSP dyn_exception
678 = exception->GetDynamicValue(eDynamicDontRunTarget);
679 // If we succeed in making a dynamic value, return that:
680 if (dyn_exception)
681 return dyn_exception;
682
683 return exception;
684}
685
687 const lldb_private::Address &vtable_addr) {
688 std::lock_guard<std::mutex> locker(m_mutex);
689 DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
690 if (pos == m_dynamic_type_map.end())
691 return TypeAndOrName();
692 else
693 return pos->second;
694}
695
697 const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
698 std::lock_guard<std::mutex> locker(m_mutex);
699 m_dynamic_type_map[vtable_addr] = type_info;
700}
static llvm::raw_ostream & error(Stream &strm)
static char ID
Definition: HostInfoBase.h:37
static const char * vtable_demangled_prefix
#define LLDB_LOGF(log,...)
Definition: Log.h:349
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
Definition: PluginManager.h:25
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectMultiwordItaniumABI_Demangle(CommandInterpreter &interpreter)
~CommandObjectMultiwordItaniumABI_Demangle() override=default
~CommandObjectMultiwordItaniumABI() override=default
CommandObjectMultiwordItaniumABI(CommandInterpreter &interpreter)
A section + offset based address class.
Definition: Address.h:59
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:311
void SetRawAddress(lldb::addr_t addr)
Definition: Address.h:444
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:332
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:893
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
A command line argument class.
Definition: Args.h:33
llvm::ArrayRef< ArgEntry > entries() const
Definition: Args.h:128
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
std::vector< CommandArgumentData > CommandArgumentEntry
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendMessageWithFormat(const char *format,...) __attribute__((format(printf
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
lldb::TypeClass GetTypeClass() const
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
bool IsPointerOrReferenceType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
Definition: ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:182
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:191
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:205
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:332
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:365
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:353
void SetStopOthers(bool stop_others=true)
Definition: Target.h:369
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:336
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Process * GetProcessPtr() const
Returns a pointer to the process object.
A file collection class.
Definition: FileSpecList.h:24
void EmplaceBack(Args &&...args)
Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
Definition: FileSpecList.h:85
A class to manage flags.
Definition: Flags.h:22
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
Definition: Flags.h:83
Encapsulates a function that can be called.
lldb::ExpressionResults ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager, Value &results)
Run the function this FunctionCaller was created with.
llvm::Error TypeHasVTable(CompilerType compiler_type)
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) override
lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal)
TypeAndOrName GetTypeInfo(ValueObject &in_value, const VTableInfo &vtable_info)
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
lldb::SearchFilterSP CreateExceptionSearchFilter() override
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info)
bool CouldHaveDynamicValue(ValueObject &in_value) override
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr)
llvm::Expected< LanguageRuntime::VTableInfo > GetVTableInfo(ValueObject &in_value, bool check_type) override
Get the vtable information for a given value.
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
A class that handles mangled names.
Definition: Mangled.h:33
ConstString GetDemangledName() const
Demangled name get accessor.
Definition: Mangled.cpp:260
lldb::LanguageType GuessLanguage() const
Try to guess the language from the mangling.
Definition: Mangled.cpp:379
ConstString GetDisplayDemangledName() const
Display demangled name get accessor.
Definition: Mangled.cpp:310
A collection class for Module objects.
Definition: ModuleList.h:82
void FindTypes(Module *search_first, ConstString name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet< SymbolFile * > &searched_symbol_files, TypeList &types) const
Find types by name.
Definition: ModuleList.cpp:560
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:500
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition: Process.cpp:318
A plug-in interface definition class for debugging a process.
Definition: Process.h:339
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
Definition: Process.cpp:1567
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
Definition: Process.cpp:2082
lldb::addr_t FixDataAddress(lldb::addr_t pc)
Definition: Process.cpp:5730
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3394
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2093
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3398
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1272
Process * m_process
Definition: Runtime.h:29
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:335
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
An error handling class.
Definition: Status.h:44
bool StopPointSiteContainsBreakpoint(typename StopPointSite::SiteID, lldb::break_id_t bp_id)
Returns whether the BreakpointSite site_id has a BreakpointLocation that is part of Breakpoint bp_id.
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
Symbol * symbol
The Symbol for a given query.
lldb::ModuleSP CalculateSymbolContextModule() override
Definition: Symbol.cpp:441
Mangled & GetMangled()
Definition: Symbol.h:145
Address GetAddress() const
Definition: Symbol.h:87
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:591
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
Definition: Target.cpp:2540
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition: Target.cpp:394
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
Definition: Target.cpp:3113
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:970
const ArchSpec & GetArchitecture() const
Definition: Target.h:1012
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:403
void SetName(ConstString type_name)
Definition: Type.cpp:743
CompilerType GetCompilerType() const
Definition: Type.h:417
ConstString GetName() const
Definition: Type.cpp:735
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:763
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:755
bool HasType() const
Definition: Type.h:435
uint32_t GetSize() const
Definition: TypeList.cpp:60
bool Empty() const
Definition: TypeList.h:37
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
Definition: TypeList.cpp:66
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
static bool IsCXXClassType(const CompilerType &type)
lldb::addr_t GetPointerValue(AddressType *address_type=nullptr)
CompilerType GetCompilerType()
Definition: ValueObject.h:352
virtual ConstString GetTypeName()
Definition: ValueObject.h:365
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr)
const ExecutionContextRef & GetExecutionContextRef() const
Definition: ValueObject.h:330
const Scalar & GetScalar() const
Definition: Value.h:112
ValueType
Type that describes Value::m_value.
Definition: Value.h:41
@ Scalar
A raw scalar value.
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:314
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
Definition: lldb-forward.h:406
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
Definition: lldb-forward.h:316
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:434
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
Definition: lldb-forward.h:321
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:467
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
Definition: lldb-forward.h:309
ExpressionResults
The results of expression evaluation.
@ eExpressionCompleted
std::shared_ptr< lldb_private::Type > TypeSP
Definition: lldb-forward.h:445
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
Definition: lldb-forward.h:454
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
Definition: lldb-forward.h:415
uint64_t addr_t
Definition: lldb-types.h:79
@ eStopReasonBreakpoint
@ eDynamicDontRunTarget
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:361
Used to build individual command argument lists.
Definition: CommandObject.h:93
Symbol * symbol
Address of the vtable's virtual function table.
DataExtractor GetAsData(lldb::ByteOrder byte_order=lldb::eByteOrderInvalid) const