Merge pull request #10924 from Pokechu22/symbols-missing-last-function
PPCSymbolDB: Fix getting symbol for the last function
This commit is contained in:
commit
92c7566646
|
@ -92,18 +92,20 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
||||||
Common::Symbol* PPCSymbolDB::GetSymbolFromAddr(u32 addr)
|
Common::Symbol* PPCSymbolDB::GetSymbolFromAddr(u32 addr)
|
||||||
{
|
{
|
||||||
auto it = m_functions.lower_bound(addr);
|
auto it = m_functions.lower_bound(addr);
|
||||||
if (it == m_functions.end())
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// If the address is exactly the start address of a symbol, we're done.
|
if (it != m_functions.end())
|
||||||
if (it->second.address == addr)
|
{
|
||||||
return &it->second;
|
// If the address is exactly the start address of a symbol, we're done.
|
||||||
|
if (it->second.address == addr)
|
||||||
// Otherwise, check whether the address is within the bounds of a symbol.
|
return &it->second;
|
||||||
|
}
|
||||||
if (it != m_functions.begin())
|
if (it != m_functions.begin())
|
||||||
|
{
|
||||||
|
// Otherwise, check whether the address is within the bounds of a symbol.
|
||||||
--it;
|
--it;
|
||||||
if (addr >= it->second.address && addr < it->second.address + it->second.size)
|
if (addr >= it->second.address && addr < it->second.address + it->second.size)
|
||||||
return &it->second;
|
return &it->second;
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue