本文整理汇总了C++中lldb::ValueObjectSP::GetChildMemberWithName方法的典型用法代码示例。如果您正苦于以下问题:C++ ValueObjectSP::GetChildMemberWithName方法的具体用法?C++ ValueObjectSP::GetChildMemberWithName怎么用?C++ ValueObjectSP::GetChildMemberWithName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lldb::ValueObjectSP
的用法示例。
在下文中一共展示了ValueObjectSP::GetChildMemberWithName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: member__f_
CPPLanguageRuntime::LibCppStdFunctionCallableInfo
CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(
lldb::ValueObjectSP &valobj_sp) {
LibCppStdFunctionCallableInfo optional_info;
if (!valobj_sp)
return optional_info;
// Member __f_ has type __base*, the contents of which will hold:
// 1) a vtable entry which may hold type information needed to discover the
// lambda being called
// 2) possibly hold a pointer to the callable object
// e.g.
//
// (lldb) frame var -R f_display
// (std::__1::function<void (int)>) f_display = {
// __buf_ = {
// …
// }
// __f_ = 0x00007ffeefbffa00
// }
// (lldb) memory read -fA 0x00007ffeefbffa00
// 0x7ffeefbffa00: ... `vtable for std::__1::__function::__func<void (*) ...
// 0x7ffeefbffa08: ... `print_num(int) at std_function_cppreference_exam ...
//
// We will be handling five cases below, std::function is wrapping:
//
// 1) a lambda we know at compile time. We will obtain the name of the lambda
// from the first template pameter from __func's vtable. We will look up
// the lambda's operator()() and obtain the line table entry.
// 2) a lambda we know at runtime. A pointer to the lambdas __invoke method
// will be stored after the vtable. We will obtain the lambdas name from
// this entry and lookup operator()() and obtain the line table entry.
// 3) a callable object via operator()(). We will obtain the name of the
// object from the first template parameter from __func's vtable. We will
// look up the objectc operator()() and obtain the line table entry.
// 4) a member function. A pointer to the function will stored after the
// we will obtain the name from this pointer.
// 5) a free function. A pointer to the function will stored after the vtable
// we will obtain the name from this pointer.
ValueObjectSP member__f_(
valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
if (member__f_) {
ValueObjectSP sub_member__f_(
member__f_->GetChildMemberWithName(ConstString("__f_"), true));
if (sub_member__f_)
member__f_ = sub_member__f_;
}
lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
optional_info.member__f_pointer_value = member__f_pointer_value;
ExecutionContext exe_ctx(valobj_sp->GetExecutionContextRef());
Process *process = exe_ctx.GetProcessPtr();
if (process == nullptr)
return optional_info;
uint32_t address_size = process->GetAddressByteSize();
Status status;
// First item pointed to by __f_ should be the pointer to the vtable for
// a __base object.
lldb::addr_t vtable_address =
process->ReadPointerFromMemory(member__f_pointer_value, status);
if (status.Fail())
return optional_info;
lldb::addr_t address_after_vtable = member__f_pointer_value + address_size;
// As commened above we may not have a function pointer but if we do we will
// need it.
lldb::addr_t possible_function_address =
process->ReadPointerFromMemory(address_after_vtable, status);
if (status.Fail())
return optional_info;
Target &target = process->GetTarget();
if (target.GetSectionLoadList().IsEmpty())
return optional_info;
Address vtable_addr_resolved;
SymbolContext sc;
Symbol *symbol;
if (!target.GetSectionLoadList().ResolveLoadAddress(vtable_address,
vtable_addr_resolved))
return optional_info;
target.GetImages().ResolveSymbolContextForAddress(
vtable_addr_resolved, eSymbolContextEverything, sc);
symbol = sc.symbol;
if (symbol == nullptr)
return optional_info;
//.........这里部分代码省略.........