本文整理汇总了C++中ObjCLanguageRuntime::LookupRuntimeSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjCLanguageRuntime::LookupRuntimeSymbol方法的具体用法?C++ ObjCLanguageRuntime::LookupRuntimeSymbol怎么用?C++ ObjCLanguageRuntime::LookupRuntimeSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjCLanguageRuntime
的用法示例。
在下文中一共展示了ObjCLanguageRuntime::LookupRuntimeSymbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bare_name_cs
uint64_t
IRExecutionUnit::MemoryManager::getSymbolAddress(const std::string &Name)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
SymbolContextList sc_list;
ExecutionContextScope *exe_scope = m_parent.GetBestExecutionContextScope();
lldb::TargetSP target_sp = exe_scope->CalculateTarget();
const char *name = Name.c_str();
ConstString bare_name_cs(name);
ConstString name_cs;
if (name[0] == '_')
name_cs = ConstString(name + 1);
if (!target_sp)
{
if (log)
log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <no target>",
Name.c_str());
m_parent.ReportSymbolLookupError(name_cs);
return 0xbad0bad0;
}
uint32_t num_matches = 0;
lldb::ProcessSP process_sp = exe_scope->CalculateProcess();
if (!name_cs.IsEmpty())
{
target_sp->GetImages().FindSymbolsWithNameAndType(name_cs, lldb::eSymbolTypeAny, sc_list);
num_matches = sc_list.GetSize();
}
if (!num_matches)
{
target_sp->GetImages().FindSymbolsWithNameAndType(bare_name_cs, lldb::eSymbolTypeAny, sc_list);
num_matches = sc_list.GetSize();
}
lldb::addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
for (uint32_t i=0; i<num_matches && (symbol_load_addr == 0 || symbol_load_addr == LLDB_INVALID_ADDRESS); i++)
{
SymbolContext sym_ctx;
sc_list.GetContextAtIndex(i, sym_ctx);
symbol_load_addr = sym_ctx.symbol->ResolveCallableAddress(*target_sp);
if (symbol_load_addr == LLDB_INVALID_ADDRESS)
symbol_load_addr = sym_ctx.symbol->GetAddress().GetLoadAddress(target_sp.get());
}
if (symbol_load_addr == LLDB_INVALID_ADDRESS && process_sp && name_cs)
{
// Try the Objective-C language runtime.
ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
if (runtime)
symbol_load_addr = runtime->LookupRuntimeSymbol(name_cs);
}
if (symbol_load_addr == LLDB_INVALID_ADDRESS)
{
if (log)
log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
name);
m_parent.ReportSymbolLookupError(bare_name_cs);
return 0xbad0bad0;
}
if (log)
log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
name,
symbol_load_addr);
if (symbol_load_addr == 0)
return 0xbad00add;
return symbol_load_addr;
}