mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-08 00:52:54 +00:00
Make sure we can lookup re-exported symbols after recent changes to lldb_private::Symbol.
Recently lldb_private::Symbol was changed so the old code: Address &Symbol::GetAddress(); Is now: Address Symbol::GetAddress(); And the Address object that is returned will be invalid for non-address based symbols. When we have re-exported symbols this code would now fail: const Address sym_address = sym_ctx.symbol->GetAddress(); if (!sym_address.IsValid()) continue; symbol_load_addr = sym_ctx.symbol->ResolveCallableAddress(*target_sp); if (symbol_load_addr == LLDB_INVALID_ADDRESS) { symbol_load_addr = sym_address.GetLoadAddress(target_sp.get()); } It used to return an Address reference to the value of the re-exported symbol that contained no section and a zero value for Address.m_offset (since the original symbol in the symbol table had a value of zero). When a reference was returned, this meant the "sym_address.IsValid()" would return true because the Address.m_offset was not LLDB_INVALID_ADDRESS, it was zero. This was working by mistake. The Symbol::ResolveCallableAddress(...) actually checks for reexported symbols and whole bunch of other cases and resolves the address correctly, so we should let it do its thing and not cut it off before it can resolve the address with the "if (!sym_address.IsValid()) continue;". llvm-svn: 241282
This commit is contained in:
parent
4e7212177f
commit
d6171a74f0
@ -676,20 +676,10 @@ IRExecutionUnit::MemoryManager::getSymbolAddress(const std::string &Name)
|
||||
SymbolContext sym_ctx;
|
||||
sc_list.GetContextAtIndex(i, sym_ctx);
|
||||
|
||||
if (sym_ctx.symbol->GetType() == lldb::eSymbolTypeUndefined)
|
||||
continue;
|
||||
|
||||
const Address sym_address = sym_ctx.symbol->GetAddress();
|
||||
|
||||
if (!sym_address.IsValid())
|
||||
continue;
|
||||
|
||||
symbol_load_addr = sym_ctx.symbol->ResolveCallableAddress(*target_sp);
|
||||
|
||||
|
||||
if (symbol_load_addr == LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
symbol_load_addr = sym_address.GetLoadAddress(target_sp.get());
|
||||
}
|
||||
symbol_load_addr = sym_ctx.symbol->GetAddress().GetLoadAddress(target_sp.get());
|
||||
}
|
||||
|
||||
if (symbol_load_addr == LLDB_INVALID_ADDRESS && process_sp && name_cs)
|
||||
|
Loading…
Reference in New Issue
Block a user