Merge pull request #5914 from sepalani/rso-data

RSO: Import data symbols
This commit is contained in:
Leo Lam 2017-08-11 21:02:28 +08:00 committed by GitHub
commit 5767309670
1 changed files with 10 additions and 4 deletions

View File

@ -371,7 +371,6 @@ void RSOView::LoadAll(u32 address)
void RSOView::Apply(PPCSymbolDB* symbol_db) const void RSOView::Apply(PPCSymbolDB* symbol_db) const
{ {
std::size_t count = 0;
for (const RSOExport& rso_export : GetExports()) for (const RSOExport& rso_export : GetExports())
{ {
u32 address = GetExportAddress(rso_export); u32 address = GetExportAddress(rso_export);
@ -380,14 +379,21 @@ void RSOView::Apply(PPCSymbolDB* symbol_db) const
Symbol* symbol = symbol_db->AddFunction(address); Symbol* symbol = symbol_db->AddFunction(address);
if (!symbol) if (!symbol)
symbol = symbol_db->GetSymbolFromAddr(address); symbol = symbol_db->GetSymbolFromAddr(address);
const std::string export_name = GetExportName(rso_export);
if (symbol) if (symbol)
{ {
symbol->name = GetExportName(rso_export); // Function symbol
count += 1; symbol->name = export_name;
}
else
{
// Data symbol
symbol_db->AddKnownSymbol(address, 0, export_name, Symbol::Type::Data);
} }
} }
} }
DEBUG_LOG(OSHLE, "RSO(%s): %zu/%zu symbols applied", GetName().c_str(), count, GetExportsCount()); DEBUG_LOG(OSHLE, "RSO(%s): %zu symbols applied", GetName().c_str(), GetExportsCount());
} }
u32 RSOView::GetNextEntry() const u32 RSOView::GetNextEntry() const