51 const bool check_cxx =
true;
52 const bool check_objc =
false;
53 return in_value.GetCompilerType().IsPossibleDynamicType(
nullptr, check_cxx,
74 vtable_addr, eSymbolContextSymbol, sc);
76 if (symbol !=
nullptr) {
78 symbol->
GetMangled().GetDemangledName().AsCString();
83 ": static-type = '%s' has vtable symbol '%s'\n",
90 std::string lookup_name(
"::");
91 lookup_name.append(class_name);
94 const bool exact_match =
true;
99 llvm::DenseSet<SymbolFile *> searched_symbol_files;
102 searched_symbol_files, class_types);
106 if (class_types.
Empty())
109 searched_symbol_files, class_types);
111 lldb::TypeSP type_sp;
112 if (class_types.
Empty()) {
113 LLDB_LOGF(log,
"0x%16.16" PRIx64
": is not dynamic\n",
117 if (class_types.
GetSize() == 1) {
121 type_sp->GetForwardCompilerType())) {
125 ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
126 "}, type-name='%s'\n",
128 type_sp->GetID(), type_sp->GetName().GetCString());
135 for (i = 0; i < class_types.
GetSize(); i++) {
141 ": static-type = '%s' has multiple matching dynamic "
142 "types: uid={0x%" PRIx64
"}, type-name='%s'\n",
144 type_sp->GetID(), type_sp->GetName().GetCString());
149 for (i = 0; i < class_types.
GetSize(); i++) {
153 type_sp->GetForwardCompilerType())) {
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",
160 type_sp->GetID(), type_sp->GetName().GetCString());
169 ": static-type = '%s' has multiple matching dynamic "
170 "types, didn't find a C++ match\n",
198 class_type_or_name.
Clear();
216 if (process ==
nullptr)
227 vtable_address_point);
229 if (!class_type_or_name)
249 vtable_address_point - 2 * addr_byte_size;
252 if (offset_to_top_location >= vtable_address_point)
255 offset_to_top_location, addr_byte_size, INT64_MIN,
error);
257 if (offset_to_top == INT64_MIN)
261 lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
263 dynamic_addr, dynamic_address)) {
275 if (type_and_or_name.
HasType()) {
282 if (static_type_flags.
AllSet(eTypeIsPointer))
284 else if (static_type_flags.
AllSet(eTypeIsReference))
291 if (static_type_flags.
AllSet(eTypeIsPointer))
292 corrected_name.append(
" *");
293 else if (static_type_flags.
AllSet(eTypeIsReference))
294 corrected_name.append(
" &");
297 ret.
SetName(corrected_name.c_str());
322 "Demangle a C++ mangled name.",
323 "language cplusplus demangle") {
333 arg.push_back(index_arg);
336 m_arguments.push_back(arg);
343 bool demangled_any =
false;
344 bool error_any =
false;
345 for (
auto &entry : command.
entries()) {
346 if (entry.ref().empty())
354 auto name = entry.ref();
355 if (name.startswith(
"__Z"))
356 name = name.drop_front();
358 Mangled mangled(name);
360 ConstString demangled(mangled.GetDisplayDemangledName());
361 demangled_any =
true;
367 entry.ref().str().c_str());
383 interpreter,
"cplusplus",
384 "Commands for operating on the C++ language runtime.",
385 "cplusplus <subcommand> [<subcommand-options>]") {
399 return CommandObjectSP(
409 const BreakpointSP &bkpt,
bool catch_bp,
bool throw_bp) {
414 const BreakpointSP &bkpt,
bool catch_bp,
bool throw_bp,
415 bool for_expressions) {
423 static const char *g_catch_name =
"__cxa_begin_catch";
424 static const char *g_throw_name1 =
"__cxa_throw";
425 static const char *g_throw_name2 =
"__cxa_rethrow";
426 static const char *g_exception_throw_name =
"__cxa_allocate_exception";
427 std::vector<const char *> exception_names;
428 exception_names.reserve(4);
430 exception_names.push_back(g_catch_name);
433 exception_names.push_back(g_throw_name1);
434 exception_names.push_back(g_throw_name2);
438 exception_names.push_back(g_exception_throw_name);
441 bkpt, exception_names.data(), exception_names.size(),
450 FileSpecList filter_modules;
454 filter_modules.EmplaceBack(
"libc++abi.dylib");
455 filter_modules.EmplaceBack(
"libSystem.B.dylib");
456 filter_modules.EmplaceBack(
"libc++abi.1.0.dylib");
457 filter_modules.EmplaceBack(
"libc++abi.1.dylib");
463 bool catch_bp,
bool throw_bp,
bool for_expressions,
bool is_internal) {
465 FileSpecList filter_modules;
466 BreakpointResolverSP exception_resolver_sp =
469 const bool hardware =
false;
470 const bool resolve_indirect_functions =
false;
471 return target.
CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
472 hardware, resolve_indirect_functions);
479 const bool catch_bp =
false;
480 const bool throw_bp =
true;
481 const bool is_internal =
true;
482 const bool for_expressions =
true;
491 catch_bp, throw_bp, for_expressions, is_internal);
511 lldb::StopInfoSP stop_reason) {
518 uint64_t break_site_id = stop_reason->GetValue();
524 ThreadSP thread_sp) {
525 if (!thread_sp->SafeToCallFunctions())
528 TypeSystemClangSP scratch_ts_sp =
545 thread_sp->CalculateExecutionContext(exe_ctx);
566 func_call_ret = function_caller->
ExecuteFunction(exe_ctx,
nullptr, options,
567 diagnostics, results);
569 return ValueObjectSP();
577 if (!
error.Success()) {
578 return ValueObjectSP();
586 ValueObjectSP dyn_exception
590 return dyn_exception;
static llvm::raw_ostream & error(Stream &strm)
static const char * vtable_demangled_prefix
#define LLDB_LOGF(log,...)
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
bool 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.
void SetRawAddress(lldb::addr_t addr)
llvm::Triple & GetTriple()
Architecture triple accessor.
A command line argument class.
llvm::ArrayRef< ArgEntry > entries() const
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
Returns whether the breakpoint site bp_site_id has bp_id.
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.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
void SetUnwindOnError(bool unwind=false)
void SetTryAllThreads(bool try_others=true)
void SetTimeout(const Timeout< std::micro > &timeout)
void SetStopOthers(bool stop_others=true)
void SetIgnoreBreakpoints(bool ignore=false)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Process * GetProcessPtr() const
Returns a pointer to the process object.
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
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.
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
std::mutex m_dynamic_type_map_mutex
void ClearExceptionBreakpoints() override
bool ExceptionBreakpointsAreSet() override
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)
DynamicTypeCache m_dynamic_type_map
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
static llvm::StringRef GetPluginNameStatic()
TypeAndOrName GetTypeInfoFromVTableAddress(ValueObject &in_value, lldb::addr_t original_ptr, lldb::addr_t vtable_addr)
void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info)
bool CouldHaveDynamicValue(ValueObject &in_value) override
void SetExceptionBreakpoints() override
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
lldb::BreakpointSP m_cxx_exception_bp_sp
TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr)
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
A collection class for Module objects.
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.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
Resolve the symbol context for the given address. (const Address&,uint32_t,SymbolContext&)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
std::chrono::seconds GetUtilityExpressionTimeout() const
A plug-in interface definition class for debugging a process.
int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Status &error)
lldb::ByteOrder GetByteOrder() const
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetAddressByteSize() const
BreakpointSiteList & GetBreakpointSiteList()
Target & GetTarget()
Get the target object pointer for this module.
unsigned long long ULongLong(unsigned long long fail_value=0) const
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.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
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.
lldb::ModuleSP module_sp
The Module for a given query.
Symbol * symbol
The Symbol for a given query.
Address GetAddress() const
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
SectionLoadList & GetSectionLoadList()
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
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)
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
void SetName(ConstString type_name)
CompilerType GetCompilerType() const
ConstString GetName() const
void SetCompilerType(CompilerType compiler_type)
void SetTypeSP(lldb::TypeSP type_sp)
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
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()
virtual ConstString GetTypeName()
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
const ExecutionContextRef & GetExecutionContextRef() const
const Scalar & GetScalar() const
ValueType
Type that describes Value::m_value.
@ Scalar
A raw scalar value.
#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.
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.
ExpressionResults
The results of expression evaluation.
@ eReturnStatusSuccessFinishResult
@ eReturnStatusSuccessFinishNoResult
Used to build individual command argument lists.
ArgumentRepetitionType arg_repetition
lldb::CommandArgumentType arg_type