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 ConstString const_lookup_name(lookup_name);
86 TypeList class_types;
87 ModuleSP module_sp = vtable_info.symbol->CalculateSymbolContextModule();
88 // First look in the module that the vtable symbol came from and
89 // look for a single exact match.
90 TypeResults results;
91 TypeQuery query(const_lookup_name.GetStringRef(),
92 TypeQueryOptions::e_exact_match |
93 TypeQueryOptions::e_find_one);
94 if (module_sp) {
95 module_sp->FindTypes(query, results);
96 TypeSP type_sp = results.GetFirstType();
97 if (type_sp)
98 class_types.Insert(type_sp);
99 }
100
101 // If we didn't find a symbol, then move on to the entire module
102 // list in the target and get as many unique matches as possible
103 if (class_types.Empty()) {
104 query.SetFindOne(false);
105 m_process->GetTarget().GetImages().FindTypes(nullptr, query, results);
106 for (const auto &type_sp : results.GetTypeMap().Types())
107 class_types.Insert(type_sp);
108 }
109
110 lldb::TypeSP type_sp;
111 if (class_types.Empty()) {
112 LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",
113 in_value.GetPointerValue());
114 return TypeAndOrName();
115 }
116 if (class_types.GetSize() == 1) {
117 type_sp = class_types.GetTypeAtIndex(0);
118 if (type_sp) {
120 type_sp->GetForwardCompilerType())) {
121 LLDB_LOGF(
122 log,
123 "0x%16.16" PRIx64
124 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
125 "}, type-name='%s'\n",
126 in_value.GetPointerValue(), in_value.GetTypeName().AsCString(),
127 type_sp->GetID(), type_sp->GetName().GetCString());
128 type_info.SetTypeSP(type_sp);
129 }
130 }
131 } else {
132 size_t i;
133 if (log) {
134 for (i = 0; i < class_types.GetSize(); i++) {
135 type_sp = class_types.GetTypeAtIndex(i);
136 if (type_sp) {
137 LLDB_LOGF(
138 log,
139 "0x%16.16" PRIx64
140 ": static-type = '%s' has multiple matching dynamic "
141 "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
142 in_value.GetPointerValue(),
143 in_value.GetTypeName().AsCString(),
144 type_sp->GetID(), type_sp->GetName().GetCString());
145 }
146 }
147 }
148
149 for (i = 0; i < class_types.GetSize(); i++) {
150 type_sp = class_types.GetTypeAtIndex(i);
151 if (type_sp) {
153 type_sp->GetForwardCompilerType())) {
154 LLDB_LOGF(
155 log,
156 "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
157 "matching dynamic types, picking "
158 "this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
159 in_value.GetPointerValue(),
160 in_value.GetTypeName().AsCString(),
161 type_sp->GetID(), type_sp->GetName().GetCString());
162 type_info.SetTypeSP(type_sp);
163 }
164 }
165 }
166
167 if (log) {
168 LLDB_LOGF(log,
169 "0x%16.16" PRIx64
170 ": static-type = '%s' has multiple matching dynamic "
171 "types, didn't find a C++ match\n",
172 in_value.GetPointerValue(),
173 in_value.GetTypeName().AsCString());
174 }
175 }
176 if (type_info)
177 SetDynamicTypeInfo(vtable_info.addr, type_info);
178 return type_info;
179 }
180 }
181 return TypeAndOrName();
182}
183
185 // Check to make sure the class has a vtable.
186 CompilerType original_type = type;
187 if (type.IsPointerOrReferenceType()) {
188 CompilerType pointee_type = type.GetPointeeType();
189 if (pointee_type)
190 type = pointee_type;
191 }
192
193 // Make sure this is a class or a struct first by checking the type class
194 // bitfield that gets returned.
195 if ((type.GetTypeClass() & (eTypeClassStruct | eTypeClassClass)) == 0) {
196 return llvm::createStringError(std::errc::invalid_argument,
197 "type \"%s\" is not a class or struct or a pointer to one",
198 original_type.GetTypeName().AsCString("<invalid>"));
199 }
200
201 // Check if the type has virtual functions by asking it if it is polymorphic.
202 if (!type.IsPolymorphicClass()) {
203 return llvm::createStringError(std::errc::invalid_argument,
204 "type \"%s\" doesn't have a vtable",
205 type.GetTypeName().AsCString("<invalid>"));
206 }
207 return llvm::Error::success();
208}
209
210// This function can accept both pointers or references to classes as well as
211// instances of classes. If you are using this function during dynamic type
212// detection, only valid ValueObjects that return true to
213// CouldHaveDynamicValue(...) should call this function and \a check_type
214// should be set to false. This function is also used by ValueObjectVTable
215// and is can pass in instances of classes which is not suitable for dynamic
216// type detection, these cases should pass true for \a check_type.
217llvm::Expected<LanguageRuntime::VTableInfo>
219 bool check_type) {
220
221 CompilerType type = in_value.GetCompilerType();
222 if (check_type) {
223 if (llvm::Error err = TypeHasVTable(type))
224 return std::move(err);
225 }
226 ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
227 Process *process = exe_ctx.GetProcessPtr();
228 if (process == nullptr)
229 return llvm::createStringError(std::errc::invalid_argument,
230 "invalid process");
231
232 AddressType address_type;
233 lldb::addr_t original_ptr = LLDB_INVALID_ADDRESS;
234 if (type.IsPointerOrReferenceType())
235 original_ptr = in_value.GetPointerValue(&address_type);
236 else
237 original_ptr = in_value.GetAddressOf(/*scalar_is_load_address=*/true,
238 &address_type);
239 if (original_ptr == LLDB_INVALID_ADDRESS || address_type != eAddressTypeLoad)
240 return llvm::createStringError(std::errc::invalid_argument,
241 "failed to get the address of the value");
242
244 lldb::addr_t vtable_load_addr =
245 process->ReadPointerFromMemory(original_ptr, error);
246
247 if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS)
248 return llvm::createStringError(std::errc::invalid_argument,
249 "failed to read vtable pointer from memory at 0x%" PRIx64,
250 original_ptr);
251
252 // The vtable load address can have authentication bits with
253 // AArch64 targets on Darwin.
254 vtable_load_addr = process->FixDataAddress(vtable_load_addr);
255
256 // Find the symbol that contains the "vtable_load_addr" address
257 Address vtable_addr;
258 if (!process->GetTarget().ResolveLoadAddress(vtable_load_addr, vtable_addr))
259 return llvm::createStringError(std::errc::invalid_argument,
260 "failed to resolve vtable pointer 0x%"
261 PRIx64 "to a section", vtable_load_addr);
262
263 // Check our cache first to see if we already have this info
264 {
265 std::lock_guard<std::mutex> locker(m_mutex);
266 auto pos = m_vtable_info_map.find(vtable_addr);
267 if (pos != m_vtable_info_map.end())
268 return pos->second;
269 }
270
271 Symbol *symbol = vtable_addr.CalculateSymbolContextSymbol();
272 if (symbol == nullptr)
273 return llvm::createStringError(std::errc::invalid_argument,
274 "no symbol found for 0x%" PRIx64,
275 vtable_load_addr);
276 llvm::StringRef name = symbol->GetMangled().GetDemangledName().GetStringRef();
277 if (name.starts_with(vtable_demangled_prefix)) {
278 VTableInfo info = {vtable_addr, symbol};
279 std::lock_guard<std::mutex> locker(m_mutex);
280 auto pos = m_vtable_info_map[vtable_addr] = info;
281 return info;
282 }
283 return llvm::createStringError(std::errc::invalid_argument,
284 "symbol found that contains 0x%" PRIx64 " is not a vtable symbol",
285 vtable_load_addr);
286}
287
289 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
290 TypeAndOrName &class_type_or_name, Address &dynamic_address,
291 Value::ValueType &value_type) {
292 // For Itanium, if the type has a vtable pointer in the object, it will be at
293 // offset 0 in the object. That will point to the "address point" within the
294 // vtable (not the beginning of the vtable.) We can then look up the symbol
295 // containing this "address point" and that symbol's name demangled will
296 // contain the full class name. The second pointer above the "address point"
297 // is the "offset_to_top". We'll use that to get the start of the value
298 // object which holds the dynamic type.
299 //
300
301 class_type_or_name.Clear();
302 value_type = Value::ValueType::Scalar;
303
304 if (!CouldHaveDynamicValue(in_value))
305 return false;
306
307 // Check if we have a vtable pointer in this value. If we don't it will
308 // return an error, else it will return a valid resolved address. We don't
309 // want GetVTableInfo to check the type since we accept void * as a possible
310 // dynamic type and that won't pass the type check. We already checked the
311 // type above in CouldHaveDynamicValue(...).
312 llvm::Expected<VTableInfo> vtable_info_or_err =
313 GetVTableInfo(in_value, /*check_type=*/false);
314 if (!vtable_info_or_err) {
315 llvm::consumeError(vtable_info_or_err.takeError());
316 return false;
317 }
318
319 const VTableInfo &vtable_info = vtable_info_or_err.get();
320 class_type_or_name = GetTypeInfo(in_value, vtable_info);
321
322 if (!class_type_or_name)
323 return false;
324
325 CompilerType type = class_type_or_name.GetCompilerType();
326 // There can only be one type with a given name, so we've just found
327 // duplicate definitions, and this one will do as well as any other. We
328 // don't consider something to have a dynamic type if it is the same as
329 // the static type. So compare against the value we were handed.
330 if (!type)
331 return true;
332
333 if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) {
334 // The dynamic type we found was the same type, so we don't have a
335 // dynamic type here...
336 return false;
337 }
338
339 // The offset_to_top is two pointers above the vtable pointer.
340 Target &target = m_process->GetTarget();
341 const addr_t vtable_load_addr = vtable_info.addr.GetLoadAddress(&target);
342 if (vtable_load_addr == LLDB_INVALID_ADDRESS)
343 return false;
344 const uint32_t addr_byte_size = m_process->GetAddressByteSize();
345 const lldb::addr_t offset_to_top_location =
346 vtable_load_addr - 2 * addr_byte_size;
347 // Watch for underflow, offset_to_top_location should be less than
348 // vtable_load_addr
349 if (offset_to_top_location >= vtable_load_addr)
350 return false;
352 const int64_t offset_to_top = m_process->ReadSignedIntegerFromMemory(
353 offset_to_top_location, addr_byte_size, INT64_MIN, error);
354
355 if (offset_to_top == INT64_MIN)
356 return false;
357 // So the dynamic type is a value that starts at offset_to_top above
358 // the original address.
359 lldb::addr_t dynamic_addr = in_value.GetPointerValue() + offset_to_top;
361 dynamic_addr, dynamic_address)) {
362 dynamic_address.SetRawAddress(dynamic_addr);
363 }
364 return true;
365}
366
368 const TypeAndOrName &type_and_or_name, ValueObject &static_value) {
369 CompilerType static_type(static_value.GetCompilerType());
370 Flags static_type_flags(static_type.GetTypeInfo());
371
372 TypeAndOrName ret(type_and_or_name);
373 if (type_and_or_name.HasType()) {
374 // The type will always be the type of the dynamic object. If our parent's
375 // type was a pointer, then our type should be a pointer to the type of the
376 // dynamic object. If a reference, then the original type should be
377 // okay...
378 CompilerType orig_type = type_and_or_name.GetCompilerType();
379 CompilerType corrected_type = orig_type;
380 if (static_type_flags.AllSet(eTypeIsPointer))
381 corrected_type = orig_type.GetPointerType();
382 else if (static_type_flags.AllSet(eTypeIsReference))
383 corrected_type = orig_type.GetLValueReferenceType();
384 ret.SetCompilerType(corrected_type);
385 } else {
386 // If we are here we need to adjust our dynamic type name to include the
387 // correct & or * symbol
388 std::string corrected_name(type_and_or_name.GetName().GetCString());
389 if (static_type_flags.AllSet(eTypeIsPointer))
390 corrected_name.append(" *");
391 else if (static_type_flags.AllSet(eTypeIsReference))
392 corrected_name.append(" &");
393 // the parent type should be a correctly pointer'ed or referenc'ed type
394 ret.SetCompilerType(static_type);
395 ret.SetName(corrected_name.c_str());
396 }
397 return ret;
398}
399
400// Static Functions
403 lldb::LanguageType language) {
404 // FIXME: We have to check the process and make sure we actually know that
405 // this process supports
406 // the Itanium ABI.
407 if (language == eLanguageTypeC_plus_plus ||
408 language == eLanguageTypeC_plus_plus_03 ||
409 language == eLanguageTypeC_plus_plus_11 ||
410 language == eLanguageTypeC_plus_plus_14)
411 return new ItaniumABILanguageRuntime(process);
412 else
413 return nullptr;
414}
415
417public:
420 interpreter, "demangle", "Demangle a C++ mangled name.",
421 "language cplusplus demangle [<mangled-name> ...]") {
422 AddSimpleArgumentList(eArgTypeSymbol, eArgRepeatPlus);
423 }
424
426
427protected:
428 void DoExecute(Args &command, CommandReturnObject &result) override {
429 bool demangled_any = false;
430 bool error_any = false;
431 for (auto &entry : command.entries()) {
432 if (entry.ref().empty())
433 continue;
434
435 // the actual Mangled class should be strict about this, but on the
436 // command line if you're copying mangled names out of 'nm' on Darwin,
437 // they will come out with an extra underscore - be willing to strip this
438 // on behalf of the user. This is the moral equivalent of the -_/-n
439 // options to c++filt
440 auto name = entry.ref();
441 if (name.starts_with("__Z"))
442 name = name.drop_front();
443
444 Mangled mangled(name);
446 ConstString demangled(mangled.GetDisplayDemangledName());
447 demangled_any = true;
448 result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(),
449 demangled.GetCString());
450 } else {
451 error_any = true;
452 result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",
453 entry.ref().str().c_str());
454 }
455 }
456
457 result.SetStatus(
458 error_any ? lldb::eReturnStatusFailed
461 }
462};
463
465public:
468 interpreter, "cplusplus",
469 "Commands for operating on the C++ language runtime.",
470 "cplusplus <subcommand> [<subcommand-options>]") {
471 LoadSubCommand(
472 "demangle",
475 }
476
478};
479
482 GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance,
483 [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
484 return CommandObjectSP(
485 new CommandObjectMultiwordItaniumABI(interpreter));
486 });
487}
488
491}
492
494 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) {
495 return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);
496}
497
499 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp,
500 bool for_expressions) {
501 // One complication here is that most users DON'T want to stop at
502 // __cxa_allocate_expression, but until we can do anything better with
503 // predicting unwinding the expression parser does. So we have two forms of
504 // the exception breakpoints, one for expressions that leaves out
505 // __cxa_allocate_exception, and one that includes it. The
506 // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in
507 // the runtime the former.
508 static const char *g_catch_name = "__cxa_begin_catch";
509 static const char *g_throw_name1 = "__cxa_throw";
510 static const char *g_throw_name2 = "__cxa_rethrow";
511 static const char *g_exception_throw_name = "__cxa_allocate_exception";
512 std::vector<const char *> exception_names;
513 exception_names.reserve(4);
514 if (catch_bp)
515 exception_names.push_back(g_catch_name);
516
517 if (throw_bp) {
518 exception_names.push_back(g_throw_name1);
519 exception_names.push_back(g_throw_name2);
520 }
521
522 if (for_expressions)
523 exception_names.push_back(g_exception_throw_name);
524
526 bkpt, exception_names.data(), exception_names.size(),
527 eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));
528
529 return resolver_sp;
530}
531
533 Target &target = m_process->GetTarget();
534
535 FileSpecList filter_modules;
536 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
537 // Limit the number of modules that are searched for these breakpoints for
538 // Apple binaries.
539 filter_modules.EmplaceBack("libc++abi.dylib");
540 filter_modules.EmplaceBack("libSystem.B.dylib");
541 filter_modules.EmplaceBack("libc++abi.1.0.dylib");
542 filter_modules.EmplaceBack("libc++abi.1.dylib");
543 }
544 return target.GetSearchFilterForModuleList(&filter_modules);
545}
546
548 bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {
549 Target &target = m_process->GetTarget();
550 FileSpecList filter_modules;
551 BreakpointResolverSP exception_resolver_sp =
552 CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions);
554 const bool hardware = false;
555 const bool resolve_indirect_functions = false;
556 return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
557 hardware, resolve_indirect_functions);
558}
559
561 if (!m_process)
562 return;
563
564 const bool catch_bp = false;
565 const bool throw_bp = true;
566 const bool is_internal = true;
567 const bool for_expressions = true;
568
569 // For the exception breakpoints set by the Expression parser, we'll be a
570 // little more aggressive and stop at exception allocation as well.
571
573 m_cxx_exception_bp_sp->SetEnabled(true);
574 } else {
576 catch_bp, throw_bp, for_expressions, is_internal);
578 m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
579 }
580}
581
583 if (!m_process)
584 return;
585
587 m_cxx_exception_bp_sp->SetEnabled(false);
588 }
589}
590
592 return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled();
593}
594
596 lldb::StopInfoSP stop_reason) {
597 if (!m_process)
598 return false;
599
600 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
601 return false;
602
603 uint64_t break_site_id = stop_reason->GetValue();
605 break_site_id, m_cxx_exception_bp_sp->GetID());
606}
607
609 ThreadSP thread_sp) {
610 if (!thread_sp->SafeToCallFunctions())
611 return {};
612
613 TypeSystemClangSP scratch_ts_sp =
615 if (!scratch_ts_sp)
616 return {};
617
618 CompilerType voidstar =
619 scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
620
621 DiagnosticManager diagnostics;
622 ExecutionContext exe_ctx;
624
625 options.SetUnwindOnError(true);
626 options.SetIgnoreBreakpoints(true);
627 options.SetStopOthers(true);
629 options.SetTryAllThreads(false);
630 thread_sp->CalculateExecutionContext(exe_ctx);
631
632 const ModuleList &modules = m_process->GetTarget().GetImages();
633 SymbolContextList contexts;
634 SymbolContext context;
635
637 ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts);
638 contexts.GetContextAtIndex(0, context);
639 if (!context.symbol) {
640 return {};
641 }
642 Address addr = context.symbol->GetAddress();
643
645 FunctionCaller *function_caller =
647 eLanguageTypeC, voidstar, addr, ValueList(), "caller", error);
648
649 ExpressionResults func_call_ret;
650 Value results;
651 func_call_ret = function_caller->ExecuteFunction(exe_ctx, nullptr, options,
652 diagnostics, results);
653 if (func_call_ret != eExpressionCompleted || !error.Success()) {
654 return ValueObjectSP();
655 }
656
657 size_t ptr_size = m_process->GetAddressByteSize();
658 addr_t result_ptr = results.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
659 addr_t exception_addr =
660 m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);
661
662 if (!error.Success()) {
663 return ValueObjectSP();
664 }
665
666 lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,
667 *m_process);
669 "exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx,
670 voidstar);
671 ValueObjectSP dyn_exception
672 = exception->GetDynamicValue(eDynamicDontRunTarget);
673 // If we succeed in making a dynamic value, return that:
674 if (dyn_exception)
675 return dyn_exception;
676
677 return exception;
678}
679
681 const lldb_private::Address &vtable_addr) {
682 std::lock_guard<std::mutex> locker(m_mutex);
683 DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
684 if (pos == m_dynamic_type_map.end())
685 return TypeAndOrName();
686 else
687 return pos->second;
688}
689
691 const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
692 std::lock_guard<std::mutex> locker(m_mutex);
693 m_dynamic_type_map[vtable_addr] = type_info;
694}
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:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:313
void SetRawAddress(lldb::addr_t addr)
Definition: Address.h:454
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:342
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:899
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,...
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:188
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:197
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:214
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:334
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:367
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:355
void SetStopOthers(bool stop_others=true)
Definition: Target.h:371
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:338
"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:85
void EmplaceBack(Args &&...args)
Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
Definition: FileSpecList.h:146
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:262
lldb::LanguageType GuessLanguage() const
Try to guess the language from the mangling.
Definition: Mangled.cpp:381
ConstString GetDisplayDemangledName() const
Display demangled name get accessor.
Definition: Mangled.cpp:312
A collection class for Module objects.
Definition: ModuleList.h:103
void FindTypes(Module *search_first, const TypeQuery &query, lldb_private::TypeResults &results) const
Find types using a type-matching object that contains all search parameters.
Definition: ModuleList.cpp:587
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:527
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:319
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
StopPointSiteList< lldb_private::BreakpointSite > & GetBreakpointSiteList()
Definition: Process.cpp:1576
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
Definition: Process.cpp:2091
lldb::addr_t FixDataAddress(lldb::addr_t pc)
Definition: Process.cpp:5748
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3400
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2102
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3404
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1277
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:34
Symbol * symbol
The Symbol for a given query.
lldb::ModuleSP CalculateSymbolContextModule() override
Definition: Symbol.cpp:449
Mangled & GetMangled()
Definition: Symbol.h:146
Address GetAddress() const
Definition: Symbol.h:88
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:592
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:2538
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:395
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
Definition: Target.cpp:3111
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:972
const ArchSpec & GetArchitecture() const
Definition: Target.h:1014
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:712
void SetName(ConstString type_name)
Definition: Type.cpp:872
CompilerType GetCompilerType() const
Definition: Type.h:726
ConstString GetName() const
Definition: Type.cpp:864
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:892
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:884
bool HasType() const
Definition: Type.h:744
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
void Insert(const lldb::TypeSP &type)
Definition: TypeList.cpp:27
TypeIterable Types() const
Definition: TypeMap.h:49
A class that contains all state required for type lookups.
Definition: Type.h:96
void SetFindOne(bool b)
Definition: Type.h:272
This class tracks the state and results of a TypeQuery.
Definition: Type.h:304
TypeMap & GetTypeMap()
Definition: Type.h:346
lldb::TypeSP GetFirstType() const
Definition: Type.h:345
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
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:410
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
Definition: lldb-forward.h:320
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:438
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
Definition: lldb-forward.h:325
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:472
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:313
ExpressionResults
The results of expression evaluation.
@ eExpressionCompleted
std::shared_ptr< lldb_private::Type > TypeSP
Definition: lldb-forward.h:449
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
Definition: lldb-forward.h:458
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
Definition: lldb-forward.h:419
uint64_t addr_t
Definition: lldb-types.h:79
@ eStopReasonBreakpoint
@ eDynamicDontRunTarget
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365
Symbol * symbol
Address of the vtable's virtual function table.
DataExtractor GetAsData(lldb::ByteOrder byte_order=lldb::eByteOrderInvalid) const