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"
22#include "lldb/Symbol/Symbol.h"
25#include "lldb/Target/Process.h"
29#include "lldb/Target/Target.h"
30#include "lldb/Target/Thread.h"
33#include "lldb/Utility/Log.h"
34#include "lldb/Utility/Scalar.h"
35#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
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().address,
73 in_value.GetTypeName().GetCString(), symbol_name.str().c_str());
74 // We are a C++ class, that's good. Get the class name and look it
75 // up:
76 llvm::StringRef class_name = symbol_name;
77 class_name.consume_front(vtable_demangled_prefix);
78 // We know the class name is absolute, so tell FindTypes that by
79 // prefixing it with the root namespace:
80 std::string lookup_name("::");
81 lookup_name.append(class_name.data(), class_name.size());
82
83 type_info.SetName(class_name);
84 ConstString const_lookup_name(lookup_name);
85 TypeList class_types;
86 ModuleSP module_sp = vtable_info.symbol->CalculateSymbolContextModule();
87 // First look in the module that the vtable symbol came from and
88 // look for a single exact match.
89 TypeResults results;
90 TypeQuery query(const_lookup_name.GetStringRef(),
91 TypeQueryOptions::e_exact_match |
92 TypeQueryOptions::e_strict_namespaces |
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().address);
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(log,
122 "0x%16.16" PRIx64
123 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
124 "}, type-name='%s'\n",
125 in_value.GetPointerValue().address,
126 in_value.GetTypeName().AsCString(), type_sp->GetID(),
127 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(log,
138 "0x%16.16" PRIx64
139 ": static-type = '%s' has multiple matching dynamic "
140 "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
141 in_value.GetPointerValue().address,
142 in_value.GetTypeName().AsCString(), type_sp->GetID(),
143 type_sp->GetName().GetCString());
144 }
145 }
146 }
147
148 for (i = 0; i < class_types.GetSize(); i++) {
149 type_sp = class_types.GetTypeAtIndex(i);
150 if (type_sp) {
152 type_sp->GetForwardCompilerType())) {
153 LLDB_LOGF(log,
154 "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
155 "matching dynamic types, picking "
156 "this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
157 in_value.GetPointerValue().address,
158 in_value.GetTypeName().AsCString(), type_sp->GetID(),
159 type_sp->GetName().GetCString());
160 type_info.SetTypeSP(type_sp);
161 }
162 }
163 }
164
165 if (log) {
166 LLDB_LOGF(log,
167 "0x%16.16" PRIx64
168 ": static-type = '%s' has multiple matching dynamic "
169 "types, didn't find a C++ match\n",
170 in_value.GetPointerValue().address,
171 in_value.GetTypeName().AsCString());
172 }
173 }
174 if (type_info)
175 SetDynamicTypeInfo(vtable_info.addr, type_info);
176 return type_info;
177 }
178 }
179 return TypeAndOrName();
180}
181
183 // Check to make sure the class has a vtable.
184 CompilerType original_type = type;
185 if (type.IsPointerOrReferenceType()) {
186 CompilerType pointee_type = type.GetPointeeType();
187 if (pointee_type)
188 type = pointee_type;
189 }
190
191 // Make sure this is a class or a struct first by checking the type class
192 // bitfield that gets returned.
193 if ((type.GetTypeClass() & (eTypeClassStruct | eTypeClassClass)) == 0) {
194 return llvm::createStringError(std::errc::invalid_argument,
195 "type \"%s\" is not a class or struct or a pointer to one",
196 original_type.GetTypeName().AsCString("<invalid>"));
197 }
198
199 // Check if the type has virtual functions by asking it if it is polymorphic.
200 if (!type.IsPolymorphicClass()) {
201 return llvm::createStringError(std::errc::invalid_argument,
202 "type \"%s\" doesn't have a vtable",
203 type.GetTypeName().AsCString("<invalid>"));
204 }
205 return llvm::Error::success();
206}
207
208// This function can accept both pointers or references to classes as well as
209// instances of classes. If you are using this function during dynamic type
210// detection, only valid ValueObjects that return true to
211// CouldHaveDynamicValue(...) should call this function and \a check_type
212// should be set to false. This function is also used by ValueObjectVTable
213// and is can pass in instances of classes which is not suitable for dynamic
214// type detection, these cases should pass true for \a check_type.
215llvm::Expected<LanguageRuntime::VTableInfo>
217 bool check_type) {
218
219 CompilerType type = in_value.GetCompilerType();
220 if (check_type) {
221 if (llvm::Error err = TypeHasVTable(type))
222 return std::move(err);
223 }
224 ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
225 Process *process = exe_ctx.GetProcessPtr();
226 if (process == nullptr)
227 return llvm::createStringError(std::errc::invalid_argument,
228 "invalid process");
229
230 auto [original_ptr, address_type] =
232 ? in_value.GetPointerValue()
233 : in_value.GetAddressOf(/*scalar_is_load_address=*/true);
234 if (original_ptr == LLDB_INVALID_ADDRESS || address_type != eAddressTypeLoad)
235 return llvm::createStringError(std::errc::invalid_argument,
236 "failed to get the address of the value");
237
239 lldb::addr_t vtable_load_addr =
240 process->ReadPointerFromMemory(original_ptr, error);
241
242 if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS)
243 return llvm::createStringError(std::errc::invalid_argument,
244 "failed to read vtable pointer from memory at 0x%" PRIx64,
245 original_ptr);
246
247 // The vtable load address can have authentication bits with
248 // AArch64 targets on Darwin.
249 vtable_load_addr = process->FixDataAddress(vtable_load_addr);
250
251 // Find the symbol that contains the "vtable_load_addr" address
252 Address vtable_addr;
253 if (!process->GetTarget().ResolveLoadAddress(vtable_load_addr, vtable_addr))
254 return llvm::createStringError(std::errc::invalid_argument,
255 "failed to resolve vtable pointer 0x%"
256 PRIx64 "to a section", vtable_load_addr);
257
258 // Check our cache first to see if we already have this info
259 {
260 std::lock_guard<std::mutex> locker(m_mutex);
261 auto pos = m_vtable_info_map.find(vtable_addr);
262 if (pos != m_vtable_info_map.end())
263 return pos->second;
264 }
265
266 Symbol *symbol = vtable_addr.CalculateSymbolContextSymbol();
267 if (symbol == nullptr)
268 return llvm::createStringError(std::errc::invalid_argument,
269 "no symbol found for 0x%" PRIx64,
270 vtable_load_addr);
271 llvm::StringRef name = symbol->GetMangled().GetDemangledName().GetStringRef();
272 if (name.starts_with(vtable_demangled_prefix)) {
273 VTableInfo info = {vtable_addr, symbol};
274 std::lock_guard<std::mutex> locker(m_mutex);
275 auto pos = m_vtable_info_map[vtable_addr] = info;
276 return info;
277 }
278 return llvm::createStringError(std::errc::invalid_argument,
279 "symbol found that contains 0x%" PRIx64 " is not a vtable symbol",
280 vtable_load_addr);
281}
282
284 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
285 TypeAndOrName &class_type_or_name, Address &dynamic_address,
286 Value::ValueType &value_type, llvm::ArrayRef<uint8_t> &local_buffer) {
287 // For Itanium, if the type has a vtable pointer in the object, it will be at
288 // offset 0 in the object. That will point to the "address point" within the
289 // vtable (not the beginning of the vtable.) We can then look up the symbol
290 // containing this "address point" and that symbol's name demangled will
291 // contain the full class name. The second pointer above the "address point"
292 // is the "offset_to_top". We'll use that to get the start of the value
293 // object which holds the dynamic type.
294 //
295
296 class_type_or_name.Clear();
297 value_type = Value::ValueType::Scalar;
298
299 if (!CouldHaveDynamicValue(in_value))
300 return false;
301
302 // Check if we have a vtable pointer in this value. If we don't it will
303 // return an error, else it will return a valid resolved address. We don't
304 // want GetVTableInfo to check the type since we accept void * as a possible
305 // dynamic type and that won't pass the type check. We already checked the
306 // type above in CouldHaveDynamicValue(...).
307 llvm::Expected<VTableInfo> vtable_info_or_err =
308 GetVTableInfo(in_value, /*check_type=*/false);
309 if (!vtable_info_or_err) {
310 llvm::consumeError(vtable_info_or_err.takeError());
311 return false;
312 }
313
314 const VTableInfo &vtable_info = vtable_info_or_err.get();
315 class_type_or_name = GetTypeInfo(in_value, vtable_info);
316
317 if (!class_type_or_name)
318 return false;
319
320 CompilerType type = class_type_or_name.GetCompilerType();
321 // There can only be one type with a given name, so we've just found
322 // duplicate definitions, and this one will do as well as any other. We
323 // don't consider something to have a dynamic type if it is the same as
324 // the static type. So compare against the value we were handed.
325 if (!type)
326 return true;
327
328 if (TypeSystemClang::AreTypesSame(in_value.GetCompilerType(), type)) {
329 // The dynamic type we found was the same type, so we don't have a
330 // dynamic type here...
331 return false;
332 }
333
334 // The offset_to_top is two pointers above the vtable pointer.
335 Target &target = m_process->GetTarget();
336 const addr_t vtable_load_addr = vtable_info.addr.GetLoadAddress(&target);
337 if (vtable_load_addr == LLDB_INVALID_ADDRESS)
338 return false;
339 const uint32_t addr_byte_size = m_process->GetAddressByteSize();
340 const lldb::addr_t offset_to_top_location =
341 vtable_load_addr - 2 * addr_byte_size;
342 // Watch for underflow, offset_to_top_location should be less than
343 // vtable_load_addr
344 if (offset_to_top_location >= vtable_load_addr)
345 return false;
347 const int64_t offset_to_top = target.ReadSignedIntegerFromMemory(
348 offset_to_top_location, addr_byte_size, INT64_MIN, error);
349
350 if (offset_to_top == INT64_MIN)
351 return false;
352 // So the dynamic type is a value that starts at offset_to_top above
353 // the original address.
354 lldb::addr_t dynamic_addr =
355 in_value.GetPointerValue().address + offset_to_top;
356 if (!m_process->GetTarget().ResolveLoadAddress(
357 dynamic_addr, dynamic_address)) {
358 dynamic_address.SetRawAddress(dynamic_addr);
359 }
360 return true;
361}
362
364 const TypeAndOrName &type_and_or_name, ValueObject &static_value) {
365 CompilerType static_type(static_value.GetCompilerType());
366 Flags static_type_flags(static_type.GetTypeInfo());
367
368 TypeAndOrName ret(type_and_or_name);
369 if (type_and_or_name.HasType()) {
370 // The type will always be the type of the dynamic object. If our parent's
371 // type was a pointer, then our type should be a pointer to the type of the
372 // dynamic object. If a reference, then the original type should be
373 // okay...
374 CompilerType orig_type = type_and_or_name.GetCompilerType();
375 CompilerType corrected_type = orig_type;
376 if (static_type_flags.AllSet(eTypeIsPointer))
377 corrected_type = orig_type.GetPointerType();
378 else if (static_type_flags.AllSet(eTypeIsReference))
379 corrected_type = orig_type.GetLValueReferenceType();
380 ret.SetCompilerType(corrected_type);
381 } else {
382 // If we are here we need to adjust our dynamic type name to include the
383 // correct & or * symbol
384 std::string corrected_name(type_and_or_name.GetName().GetCString());
385 if (static_type_flags.AllSet(eTypeIsPointer))
386 corrected_name.append(" *");
387 else if (static_type_flags.AllSet(eTypeIsReference))
388 corrected_name.append(" &");
389 // the parent type should be a correctly pointer'ed or referenc'ed type
390 ret.SetCompilerType(static_type);
391 ret.SetName(corrected_name.c_str());
392 }
393 return ret;
394}
395
396// Static Functions
399 lldb::LanguageType language) {
400 // FIXME: We have to check the process and make sure we actually know that
401 // this process supports
402 // the Itanium ABI.
403 if (language == eLanguageTypeC_plus_plus ||
404 language == eLanguageTypeC_plus_plus_03 ||
405 language == eLanguageTypeC_plus_plus_11 ||
406 language == eLanguageTypeC_plus_plus_14)
407 return new ItaniumABILanguageRuntime(process);
408 else
409 return nullptr;
410}
411
413public:
416 interpreter, "demangle", "Demangle a C++ mangled name.",
417 "language cplusplus demangle [<mangled-name> ...]") {
419 }
420
422
423protected:
424 void DoExecute(Args &command, CommandReturnObject &result) override {
425 bool demangled_any = false;
426 bool error_any = false;
427 for (auto &entry : command.entries()) {
428 if (entry.ref().empty())
429 continue;
430
431 // the actual Mangled class should be strict about this, but on the
432 // command line if you're copying mangled names out of 'nm' on Darwin,
433 // they will come out with an extra underscore - be willing to strip this
434 // on behalf of the user. This is the moral equivalent of the -_/-n
435 // options to c++filt
436 auto name = entry.ref();
437 if (name.starts_with("__Z"))
438 name = name.drop_front();
439
440 Mangled mangled(name);
442 ConstString demangled(mangled.GetDisplayDemangledName());
443 demangled_any = true;
444 result.AppendMessageWithFormat("%s ---> %s\n", entry.c_str(),
445 demangled.GetCString());
446 } else {
447 error_any = true;
448 result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",
449 entry.ref().str().c_str());
450 }
451 }
452
453 result.SetStatus(
454 error_any ? lldb::eReturnStatusFailed
457 }
458};
459
461public:
464 interpreter, "cplusplus",
465 "Commands for operating on the C++ language runtime.",
466 "cplusplus <subcommand> [<subcommand-options>]") {
468 "demangle",
471 }
472
474};
475
478 GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance,
479 [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
480 return CommandObjectSP(
481 new CommandObjectMultiwordItaniumABI(interpreter));
482 });
483}
484
488
490 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp) {
491 return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);
492}
493
495 const BreakpointSP &bkpt, bool catch_bp, bool throw_bp,
496 bool for_expressions) {
497 // One complication here is that most users DON'T want to stop at
498 // __cxa_allocate_expression, but until we can do anything better with
499 // predicting unwinding the expression parser does. So we have two forms of
500 // the exception breakpoints, one for expressions that leaves out
501 // __cxa_allocate_exception, and one that includes it. The
502 // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in
503 // the runtime the former.
504 static const char *g_catch_name = "__cxa_begin_catch";
505 static const char *g_throw_name1 = "__cxa_throw";
506 static const char *g_throw_name2 = "__cxa_rethrow";
507 static const char *g_exception_throw_name = "__cxa_allocate_exception";
508 std::vector<const char *> exception_names;
509 exception_names.reserve(4);
510 if (catch_bp)
511 exception_names.push_back(g_catch_name);
512
513 if (throw_bp) {
514 exception_names.push_back(g_throw_name1);
515 exception_names.push_back(g_throw_name2);
516 }
517
518 if (for_expressions)
519 exception_names.push_back(g_exception_throw_name);
520
522 bkpt, exception_names.data(), exception_names.size(),
523 eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));
524
525 return resolver_sp;
526}
527
529 Target &target = m_process->GetTarget();
530
531 FileSpecList filter_modules;
532 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
533 // Limit the number of modules that are searched for these breakpoints for
534 // Apple binaries.
535 filter_modules.EmplaceBack("libc++abi.dylib");
536 filter_modules.EmplaceBack("libSystem.B.dylib");
537 filter_modules.EmplaceBack("libc++abi.1.0.dylib");
538 filter_modules.EmplaceBack("libc++abi.1.dylib");
539 }
540 return target.GetSearchFilterForModuleList(&filter_modules);
541}
542
544 bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {
545 Target &target = m_process->GetTarget();
546 FileSpecList filter_modules;
547 BreakpointResolverSP exception_resolver_sp =
548 CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions);
550 const bool hardware = false;
551 const bool resolve_indirect_functions = false;
552 return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
553 hardware, resolve_indirect_functions);
554}
555
557 if (!m_process)
558 return;
559
560 const bool catch_bp = false;
561 const bool throw_bp = true;
562 const bool is_internal = true;
563 const bool for_expressions = true;
564
565 // For the exception breakpoints set by the Expression parser, we'll be a
566 // little more aggressive and stop at exception allocation as well.
567
569 m_cxx_exception_bp_sp->SetEnabled(true);
570 } else {
572 catch_bp, throw_bp, for_expressions, is_internal);
574 m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
575 }
576}
577
579 if (!m_process)
580 return;
581
583 m_cxx_exception_bp_sp->SetEnabled(false);
584 }
585}
586
590
592 lldb::StopInfoSP stop_reason) {
593 if (!m_process)
594 return false;
595
596 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
597 return false;
598
599 uint64_t break_site_id = stop_reason->GetValue();
600 return m_process->GetBreakpointSiteList().StopPointSiteContainsBreakpoint(
601 break_site_id, m_cxx_exception_bp_sp->GetID());
602}
603
605 ThreadSP thread_sp) {
606 if (!thread_sp->SafeToCallFunctions())
607 return {};
608
609 TypeSystemClangSP scratch_ts_sp =
611 if (!scratch_ts_sp)
612 return {};
613
614 CompilerType voidstar =
615 scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
616
617 DiagnosticManager diagnostics;
618 ExecutionContext exe_ctx;
620
621 options.SetUnwindOnError(true);
622 options.SetIgnoreBreakpoints(true);
623 options.SetStopOthers(true);
624 options.SetTimeout(m_process->GetUtilityExpressionTimeout());
625 options.SetTryAllThreads(false);
626 thread_sp->CalculateExecutionContext(exe_ctx);
627
628 const ModuleList &modules = m_process->GetTarget().GetImages();
629 SymbolContextList contexts;
630 SymbolContext context;
631
633 ConstString("__cxa_current_exception_type"), eSymbolTypeCode, contexts);
634 contexts.GetContextAtIndex(0, context);
635 if (!context.symbol) {
636 return {};
637 }
638 Address addr = context.symbol->GetAddress();
639
641 FunctionCaller *function_caller =
642 m_process->GetTarget().GetFunctionCallerForLanguage(
643 eLanguageTypeC, voidstar, addr, ValueList(), "caller", error);
644
645 ExpressionResults func_call_ret;
646 Value results;
647 func_call_ret = function_caller->ExecuteFunction(exe_ctx, nullptr, options,
648 diagnostics, results);
649 if (func_call_ret != eExpressionCompleted || !error.Success()) {
650 return ValueObjectSP();
651 }
652
653 size_t ptr_size = m_process->GetAddressByteSize();
654 addr_t result_ptr = results.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
655 addr_t exception_addr =
656 m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);
657
658 if (!error.Success()) {
659 return ValueObjectSP();
660 }
661
662 lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,
663 *m_process);
665 "exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx,
666 voidstar);
667 ValueObjectSP dyn_exception
668 = exception->GetDynamicValue(eDynamicDontRunTarget);
669 // If we succeed in making a dynamic value, return that:
670 if (dyn_exception)
671 return dyn_exception;
672
673 return exception;
674}
675
677 const lldb_private::Address &vtable_addr) {
678 std::lock_guard<std::mutex> locker(m_mutex);
679 DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
680 if (pos == m_dynamic_type_map.end())
681 return TypeAndOrName();
682 else
683 return pos->second;
684}
685
687 const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
688 std::lock_guard<std::mutex> locker(m_mutex);
689 m_dynamic_type_map[vtable_addr] = type_info;
690}
static llvm::raw_ostream & error(Stream &strm)
static char ID
static const char * vtable_demangled_prefix
#define LLDB_LOGF(log,...)
Definition Log.h:376
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
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:301
void SetRawAddress(lldb::addr_t addr)
Definition Address.h:447
bool IsSectionOffset() const
Check if an address is section offset.
Definition Address.h:342
Symbol * CalculateSymbolContextSymbol() const
Definition Address.cpp:888
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:468
A command line argument class.
Definition Args.h:33
llvm::ArrayRef< ArgEntry > entries() const
Definition Args.h:132
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectMultiword(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
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.
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.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
void SetUnwindOnError(bool unwind=false)
Definition Target.h:371
void SetTryAllThreads(bool try_others=true)
Definition Target.h:404
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:392
void SetStopOthers(bool stop_others=true)
Definition Target.h:408
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:375
"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.
void EmplaceBack(Args &&...args)
Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
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.
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
This call should return true if it could set the name and/or the type Sets address to the address of ...
llvm::Error TypeHasVTable(CompilerType compiler_type)
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:34
ConstString GetDemangledName() const
Demangled name get accessor.
Definition Mangled.cpp:284
lldb::LanguageType GuessLanguage() const
Try to guess the language from the mangling.
Definition Mangled.cpp:425
ConstString GetDisplayDemangledName() const
Display demangled name get accessor.
Definition Mangled.cpp:354
A collection class for Module objects.
Definition ModuleList.h:104
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A plug-in interface definition class for debugging a process.
Definition Process.h:357
lldb::addr_t FixDataAddress(lldb::addr_t pc)
Definition Process.cpp:5962
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition Process.cpp:2260
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1270
Process * m_process
Definition Runtime.h:29
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition Scalar.cpp:365
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:118
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.
Symbol * symbol
The Symbol for a given query.
lldb::ModuleSP CalculateSymbolContextModule() override
Definition Symbol.cpp:408
Mangled & GetMangled()
Definition Symbol.h:147
Address GetAddress() const
Definition Symbol.h:89
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:682
int64_t ReadSignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, int64_t fail_value, Status &error, bool force_live_memory=false)
Definition Target.cpp:2287
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3285
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:481
const ArchSpec & GetArchitecture() const
Definition Target.h:1056
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition Type.h:779
void SetName(ConstString type_name)
Definition Type.cpp:902
CompilerType GetCompilerType() const
Definition Type.h:793
ConstString GetName() const
Definition Type.cpp:894
void SetCompilerType(CompilerType compiler_type)
Definition Type.cpp:922
void SetTypeSP(lldb::TypeSP type_sp)
Definition Type.cpp:914
bool HasType() const
Definition Type.h:811
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:50
A class that contains all state required for type lookups.
Definition Type.h:104
void SetFindOne(bool b)
Definition Type.h:299
This class tracks the state and results of a TypeQuery.
Definition Type.h:344
TypeMap & GetTypeMap()
Definition Type.h:386
lldb::TypeSP GetFirstType() const
Definition Type.h:385
static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers=false)
static bool IsCXXClassType(const CompilerType &type)
CompilerType GetCompilerType()
virtual ConstString GetTypeName()
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
const ExecutionContextRef & GetExecutionContextRef() const
virtual AddrAndType GetAddressOf(bool scalar_is_load_address=true)
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
Definition Value.h:113
ValueType
Type that describes Value::m_value.
Definition Value.h:41
@ Scalar
A raw scalar value.
Definition Value.h:45
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
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
ExpressionResults
The results of expression evaluation.
@ eExpressionCompleted
std::shared_ptr< lldb_private::Type > TypeSP
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
@ eStopReasonBreakpoint
@ eDynamicDontRunTarget
std::shared_ptr< lldb_private::Module > ModuleSP
Symbol * symbol
Address of the vtable's virtual function table.
DataExtractor GetAsData(lldb::ByteOrder byte_order=lldb::eByteOrderInvalid) const