diff --git a/Source/Core/Common/Logging/Log.h b/Source/Core/Common/Logging/Log.h index 7db7b39c9b..6c50789b9d 100644 --- a/Source/Core/Common/Logging/Log.h +++ b/Source/Core/Common/Logging/Log.h @@ -52,6 +52,7 @@ enum LOG_TYPE POWERPC, SERIALINTERFACE, SP1, + SYMBOLS, VIDEO, VIDEOINTERFACE, WII_IPC, diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index a4c7adb49a..fcf606ad0b 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -120,6 +120,7 @@ LogManager::LogManager() m_log[LogTypes::POWERPC] = {"PowerPC", "IBM CPU"}; m_log[LogTypes::SERIALINTERFACE] = {"SI", "Serial Interface (SI)"}; m_log[LogTypes::SP1] = {"SP1", "Serial Port 1"}; + m_log[LogTypes::SYMBOLS] = {"SYMBOLS", "Symbols"}; m_log[LogTypes::VIDEO] = {"Video", "Video Backend"}; m_log[LogTypes::VIDEOINTERFACE] = {"VI", "Video Interface (VI)"}; m_log[LogTypes::WIIMOTE] = {"Wiimote", "Wiimote"}; diff --git a/Source/Core/Core/Debugger/RSO.cpp b/Source/Core/Core/Debugger/RSO.cpp index 9a5c77563e..52cdaa0a9d 100644 --- a/Source/Core/Core/Debugger/RSO.cpp +++ b/Source/Core/Core/Debugger/RSO.cpp @@ -331,7 +331,7 @@ void RSOView::LoadImports() { std::size_t size = m_header.GetImportsSize(); if (size % sizeof(RSOImport) != 0) - WARN_LOG(OSHLE, "RSO Imports Table has an incoherent size (%08zx)", size); + WARN_LOG(SYMBOLS, "RSO Imports Table has an incoherent size (%08zx)", size); m_imports.Load(m_header.GetImportsOffset(), size / sizeof(RSOImport)); } @@ -339,7 +339,7 @@ void RSOView::LoadExports() { std::size_t size = m_header.GetExportsSize(); if (size % sizeof(RSOExport) != 0) - WARN_LOG(OSHLE, "RSO Exports Table has an incoherent size (%08zx)", size); + WARN_LOG(SYMBOLS, "RSO Exports Table has an incoherent size (%08zx)", size); m_exports.Load(m_header.GetExportsOffset(), size / sizeof(RSOExport)); } @@ -347,7 +347,7 @@ void RSOView::LoadInternals() { std::size_t size = m_header.GetInternalsSize(); if (size % sizeof(RSOInternalsEntry) != 0) - WARN_LOG(OSHLE, "RSO Internals Relocation Table has an incoherent size (%08zx)", size); + WARN_LOG(SYMBOLS, "RSO Internals Relocation Table has an incoherent size (%08zx)", size); m_imports.Load(m_header.GetInternalsOffset(), size / sizeof(RSOInternalsEntry)); } @@ -355,7 +355,7 @@ void RSOView::LoadExternals() { std::size_t size = m_header.GetExternalsSize(); if (size % sizeof(RSOExternalsEntry) != 0) - WARN_LOG(OSHLE, "RSO Externals Relocation Table has an incoherent size (%08zx)", size); + WARN_LOG(SYMBOLS, "RSO Externals Relocation Table has an incoherent size (%08zx)", size); m_imports.Load(m_header.GetExternalsOffset(), size / sizeof(RSOExternalsEntry)); } @@ -393,7 +393,7 @@ void RSOView::Apply(PPCSymbolDB* symbol_db) const } } } - DEBUG_LOG(OSHLE, "RSO(%s): %zu symbols applied", GetName().c_str(), GetExportsCount()); + DEBUG_LOG(SYMBOLS, "RSO(%s): %zu symbols applied", GetName().c_str(), GetExportsCount()); } u32 RSOView::GetNextEntry() const @@ -530,9 +530,9 @@ u32 RSOView::GetProlog() const { u32 section_index = m_header.GetPrologSectionIndex(); if (section_index == 0) - WARN_LOG(OSHLE, "RSO doesn't have a prolog function"); + WARN_LOG(SYMBOLS, "RSO doesn't have a prolog function"); else if (section_index >= m_sections.Count()) - WARN_LOG(OSHLE, "RSO prolog section index out of bound"); + WARN_LOG(SYMBOLS, "RSO prolog section index out of bound"); else return GetSection(section_index).offset + m_header.GetPrologSectionOffset(); return 0; @@ -542,9 +542,9 @@ u32 RSOView::GetEpilog() const { u32 section_index = m_header.GetEpilogSectionIndex(); if (section_index == 0) - WARN_LOG(OSHLE, "RSO doesn't have an epilog function"); + WARN_LOG(SYMBOLS, "RSO doesn't have an epilog function"); else if (section_index >= m_sections.Count()) - WARN_LOG(OSHLE, "RSO epilog section index out of bound"); + WARN_LOG(SYMBOLS, "RSO epilog section index out of bound"); else return GetSection(section_index).offset + m_header.GetEpilogSectionOffset(); return 0; @@ -554,9 +554,9 @@ u32 RSOView::GetUnresolved() const { u32 section_index = m_header.GetUnresolvedSectionIndex(); if (section_index == 0) - WARN_LOG(OSHLE, "RSO doesn't have a unresolved function"); + WARN_LOG(SYMBOLS, "RSO doesn't have a unresolved function"); else if (section_index >= m_sections.Count()) - WARN_LOG(OSHLE, "RSO unresolved section index out of bound"); + WARN_LOG(SYMBOLS, "RSO unresolved section index out of bound"); else return GetSection(section_index).offset + m_header.GetUnresolvedSectionOffset(); return 0; @@ -567,7 +567,7 @@ bool RSOChainView::Load(u32 address) // Load node RSOView node; node.LoadHeader(address); - DEBUG_LOG(OSHLE, "RSOChain node name: %s", node.GetName().c_str()); + DEBUG_LOG(SYMBOLS, "RSOChain node name: %s", node.GetName().c_str()); m_chain.emplace_front(std::move(node)); if (LoadNextChain(m_chain.front()) && LoadPrevChain(m_chain.front())) @@ -613,8 +613,8 @@ bool RSOChainView::LoadNextChain(const RSOView& view) if (prev_address != next_node.GetPrevEntry()) { - ERROR_LOG(OSHLE, "RSOChain has an incoherent previous link %08x != %08x in %s", prev_address, - next_node.GetPrevEntry(), next_node.GetName().c_str()); + ERROR_LOG(SYMBOLS, "RSOChain has an incoherent previous link %08x != %08x in %s", + prev_address, next_node.GetPrevEntry(), next_node.GetName().c_str()); return false; } @@ -638,7 +638,7 @@ bool RSOChainView::LoadPrevChain(const RSOView& view) if (next_address != prev_node.GetNextEntry()) { - ERROR_LOG(OSHLE, "RSOChain has an incoherent next link %08x != %08x in %s", next_address, + ERROR_LOG(SYMBOLS, "RSOChain has an incoherent next link %08x != %08x in %s", next_address, prev_node.GetNextEntry(), prev_node.GetName().c_str()); return false; } diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index f7cf78eb09..8c3423218b 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -194,7 +194,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size) bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size) { - ASSERT_MSG(OSHLE, func.analyzed, "The function wasn't previously analyzed!"); + ASSERT_MSG(SYMBOLS, func.analyzed, "The function wasn't previously analyzed!"); func.analyzed = false; return AnalyzeFunction(start_addr, func, max_size); @@ -399,7 +399,7 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db) { if (func.second.address == 4) { - WARN_LOG(OSHLE, "Weird function"); + WARN_LOG(SYMBOLS, "Weird function"); continue; } AnalyzeFunction2(&(func.second)); @@ -449,10 +449,11 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db) else unniceSize /= numUnNice; - INFO_LOG(OSHLE, "Functions analyzed. %i leafs, %i nice, %i unnice." - "%i timer, %i rfi. %i are branchless leafs.", + INFO_LOG(SYMBOLS, "Functions analyzed. %i leafs, %i nice, %i unnice." + "%i timer, %i rfi. %i are branchless leafs.", numLeafs, numNice, numUnNice, numTimer, numRFI, numStraightLeaf); - INFO_LOG(OSHLE, "Average size: %i (leaf), %i (nice), %i(unnice)", leafSize, niceSize, unniceSize); + INFO_LOG(SYMBOLS, "Average size: %i (leaf), %i (nice), %i(unnice)", leafSize, niceSize, + unniceSize); } static bool isCmp(const CodeOp& a) diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index 3025bec3ca..a71f3722d2 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -133,7 +133,7 @@ void PPCSymbolDB::FillInCallers() } else { - // LOG(OSHLE, "FillInCallers tries to fill data in an unknown function 0x%08x.", + // LOG(SYMBOLS, "FillInCallers tries to fill data in an unknown function 0x%08x.", // FunctionAddress); // TODO - analyze the function instead. } @@ -147,19 +147,19 @@ void PPCSymbolDB::PrintCalls(u32 funcAddr) const if (iter != functions.end()) { const Symbol& f = iter->second; - DEBUG_LOG(OSHLE, "The function %s at %08x calls:", f.name.c_str(), f.address); + DEBUG_LOG(SYMBOLS, "The function %s at %08x calls:", f.name.c_str(), f.address); for (const SCall& call : f.calls) { XFuncMap::const_iterator n = functions.find(call.function); if (n != functions.end()) { - DEBUG_LOG(CONSOLE, "* %08x : %s", call.callAddress, n->second.name.c_str()); + DEBUG_LOG(SYMBOLS, "* %08x : %s", call.callAddress, n->second.name.c_str()); } } } else { - WARN_LOG(CONSOLE, "Symbol does not exist"); + WARN_LOG(SYMBOLS, "Symbol does not exist"); } } @@ -169,13 +169,13 @@ void PPCSymbolDB::PrintCallers(u32 funcAddr) const if (iter != functions.end()) { const Symbol& f = iter->second; - DEBUG_LOG(CONSOLE, "The function %s at %08x is called by:", f.name.c_str(), f.address); + DEBUG_LOG(SYMBOLS, "The function %s at %08x is called by:", f.name.c_str(), f.address); for (const SCall& caller : f.callers) { XFuncMap::const_iterator n = functions.find(caller.function); if (n != functions.end()) { - DEBUG_LOG(CONSOLE, "* %08x : %s", caller.callAddress, n->second.name.c_str()); + DEBUG_LOG(SYMBOLS, "* %08x : %s", caller.callAddress, n->second.name.c_str()); } } } diff --git a/Source/Core/Core/PowerPC/SignatureDB/CSVSignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB/CSVSignatureDB.cpp index 08373847be..12fe486e46 100644 --- a/Source/Core/Core/PowerPC/SignatureDB/CSVSignatureDB.cpp +++ b/Source/Core/Core/PowerPC/SignatureDB/CSVSignatureDB.cpp @@ -50,7 +50,7 @@ bool CSVSignatureDB::Load(const std::string& file_path) } else { - WARN_LOG(OSHLE, "CSV database failed to parse line %zu", i); + WARN_LOG(SYMBOLS, "CSV database failed to parse line %zu", i); } } @@ -63,7 +63,7 @@ bool CSVSignatureDB::Save(const std::string& file_path) const if (!f) { - ERROR_LOG(OSHLE, "CSV database save failed"); + ERROR_LOG(SYMBOLS, "CSV database save failed"); return false; } for (const auto& func : m_database) @@ -75,6 +75,6 @@ bool CSVSignatureDB::Save(const std::string& file_path) const func.second.object_name.c_str()); } - INFO_LOG(OSHLE, "CSV database save successful"); + INFO_LOG(SYMBOLS, "CSV database save successful"); return true; } diff --git a/Source/Core/Core/PowerPC/SignatureDB/DSYSignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB/DSYSignatureDB.cpp index db1b82d47b..411dd3544f 100644 --- a/Source/Core/Core/PowerPC/SignatureDB/DSYSignatureDB.cpp +++ b/Source/Core/Core/PowerPC/SignatureDB/DSYSignatureDB.cpp @@ -54,7 +54,7 @@ bool DSYSignatureDB::Save(const std::string& file_path) const if (!f) { - ERROR_LOG(OSHLE, "Database save failed"); + ERROR_LOG(SYMBOLS, "Database save failed"); return false; } u32 fcount = static_cast(m_database.size()); @@ -69,6 +69,6 @@ bool DSYSignatureDB::Save(const std::string& file_path) const f.WriteArray(&temp, 1); } - INFO_LOG(OSHLE, "Database save successful"); + INFO_LOG(SYMBOLS, "Database save successful"); return true; } diff --git a/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp index 80617f0ab3..1076a0dcdc 100644 --- a/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp +++ b/Source/Core/Core/PowerPC/SignatureDB/MEGASignatureDB.cpp @@ -38,7 +38,7 @@ bool GetCode(MEGASignature* sig, std::istringstream* iss) } else { - WARN_LOG(OSHLE, "MEGA database failed to parse code"); + WARN_LOG(SYMBOLS, "MEGA database failed to parse code"); return false; } } @@ -84,13 +84,13 @@ bool GetRefs(MEGASignature* sig, std::istringstream* iss) if (ptr == endptr || offset > std::numeric_limits::max()) { - WARN_LOG(OSHLE, "MEGA database failed to parse reference %u offset", ref_count); + WARN_LOG(SYMBOLS, "MEGA database failed to parse reference %u offset", ref_count); return false; } if (!GetFunctionName(iss, &ref)) { - WARN_LOG(OSHLE, "MEGA database failed to parse reference %u name", ref_count); + WARN_LOG(SYMBOLS, "MEGA database failed to parse reference %u name", ref_count); return false; } sig->refs.emplace_back(static_cast(offset), std::move(ref)); @@ -145,7 +145,7 @@ bool MEGASignatureDB::Load(const std::string& file_path) } else { - WARN_LOG(OSHLE, "MEGA database failed to parse line %zu", i); + WARN_LOG(SYMBOLS, "MEGA database failed to parse line %zu", i); } } return true; @@ -153,7 +153,7 @@ bool MEGASignatureDB::Load(const std::string& file_path) bool MEGASignatureDB::Save(const std::string& file_path) const { - ERROR_LOG(OSHLE, "MEGA database save unsupported yet."); + ERROR_LOG(SYMBOLS, "MEGA database save unsupported yet."); return false; } @@ -167,7 +167,7 @@ void MEGASignatureDB::Apply(PPCSymbolDB* symbol_db) const if (Compare(symbol.address, symbol.size, sig)) { symbol.name = sig.name; - INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", sig.name.c_str(), symbol.address, + INFO_LOG(SYMBOLS, "Found %s at %08x (size: %08x)!", sig.name.c_str(), symbol.address, symbol.size); break; } @@ -178,12 +178,12 @@ void MEGASignatureDB::Apply(PPCSymbolDB* symbol_db) const void MEGASignatureDB::Populate(const PPCSymbolDB* func_db, const std::string& filter) { - ERROR_LOG(OSHLE, "MEGA database can't be populated yet."); + ERROR_LOG(SYMBOLS, "MEGA database can't be populated yet."); } bool MEGASignatureDB::Add(u32 startAddr, u32 size, const std::string& name) { - ERROR_LOG(OSHLE, "Can't add symbol to MEGA database yet."); + ERROR_LOG(SYMBOLS, "Can't add symbol to MEGA database yet."); return false; } @@ -191,7 +191,7 @@ void MEGASignatureDB::List() const { for (const auto& entry : m_signatures) { - DEBUG_LOG(OSHLE, "%s : %zu bytes", entry.name.c_str(), entry.code.size() * sizeof(u32)); + DEBUG_LOG(SYMBOLS, "%s : %zu bytes", entry.name.c_str(), entry.code.size() * sizeof(u32)); } - INFO_LOG(OSHLE, "%zu functions known in current MEGA database.", m_signatures.size()); + INFO_LOG(SYMBOLS, "%zu functions known in current MEGA database.", m_signatures.size()); } diff --git a/Source/Core/Core/PowerPC/SignatureDB/SignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB/SignatureDB.cpp index 4c6479a4ce..ccd0338c5c 100644 --- a/Source/Core/Core/PowerPC/SignatureDB/SignatureDB.cpp +++ b/Source/Core/Core/PowerPC/SignatureDB/SignatureDB.cpp @@ -109,10 +109,10 @@ void HashSignatureDB::List() const { for (const auto& entry : m_database) { - DEBUG_LOG(OSHLE, "%s : %i bytes, hash = %08x", entry.second.name.c_str(), entry.second.size, + DEBUG_LOG(SYMBOLS, "%s : %i bytes, hash = %08x", entry.second.name.c_str(), entry.second.size, entry.first); } - INFO_LOG(OSHLE, "%zu functions known in current database.", m_database.size()); + INFO_LOG(SYMBOLS, "%zu functions known in current database.", m_database.size()); } void HashSignatureDB::Clear() @@ -130,12 +130,12 @@ void HashSignatureDB::Apply(PPCSymbolDB* symbol_db) const function->Rename(entry.second.name); if (entry.second.size == static_cast(function->size)) { - INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(), + INFO_LOG(SYMBOLS, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(), function->address, function->size); } else { - ERROR_LOG(OSHLE, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!", + ERROR_LOG(SYMBOLS, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!", entry.second.name.c_str(), function->address, function->size, entry.second.size); } }