From 07d2b77c2ab941d263baa882bc83c6ee5fa03818 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 29 Apr 2023 10:24:35 -0700 Subject: [PATCH] Debugger: Add a simple way to exclude from hashmap. Sometimes funcs have common patterns, this is a quick way to avoid poisoning the hashmap. --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/MIPS/MIPSAnalyst.cpp | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 4a687683dc..6082487ab8 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -781,6 +781,7 @@ static const ConfigSetting debuggerSettings[] = { ConfigSetting("ShowGpuProfile", &g_Config.bShowGpuProfile, false, CfgFlag::DONT_SAVE), ConfigSetting("SkipDeadbeefFilling", &g_Config.bSkipDeadbeefFilling, false, CfgFlag::DEFAULT), ConfigSetting("FuncHashMap", &g_Config.bFuncHashMap, false, CfgFlag::DEFAULT), + ConfigSetting("SkipFuncHashMap", &g_Config.sSkipFuncHashMap, "", CfgFlag::DEFAULT), ConfigSetting("MemInfoDetailed", &g_Config.bDebugMemInfoDetailed, false, CfgFlag::DEFAULT), ConfigSetting("DrawFrameGraph", &g_Config.bDrawFrameGraph, false, CfgFlag::DEFAULT), }; diff --git a/Core/Config.h b/Core/Config.h index e871c14ebc..bf0d77e0d1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -484,6 +484,7 @@ public: // Double edged sword: much easier debugging, but not accurate. bool bSkipDeadbeefFilling; bool bFuncHashMap; + std::string sSkipFuncHashMap; bool bDebugMemInfoDetailed; bool bDrawFrameGraph; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index c7837e25f3..4cfe9a2292 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "ppsspp_config.h" +#include #include #include #include @@ -27,6 +28,7 @@ #include "Common/File/FileUtil.h" #include "Common/Log.h" +#include "Common/StringUtils.h" #include "Common/TimeUtil.h" #include "Core/Config.h" #include "Core/MemMap.h" @@ -940,6 +942,10 @@ skip: return true; } + // Un named stubs, just in case. + if (!strncmp(name, "[UNK:", strlen("[UNK:"))) + return true; + // Assume any z_un, not just the address, is a default func. return !strncmp(name, "z_un_", strlen("z_un_")) || !strncmp(name, "u_un_", strlen("u_un_")); } @@ -1189,6 +1195,12 @@ skip: } } + bool SkipFuncHash(const std::string &name) { + std::vector funcs; + SplitString(g_Config.sSkipFuncHashMap, ',', funcs); + return std::find(funcs.begin(), funcs.end(), name) != funcs.end(); + } + void RegisterFunction(u32 startAddr, u32 size, const char *name) { std::lock_guard guard(functions_lock); @@ -1196,7 +1208,7 @@ skip: for (auto iter = functions.begin(); iter != functions.end(); iter++) { if (iter->start == startAddr) { // Let's just add it to the hashmap. - if (iter->hasHash && size > 16) { + if (iter->hasHash && size > 16 && SkipFuncHash(name)) { HashMapFunc hfun; hfun.hash = iter->hash; strncpy(hfun.name, name, 64); @@ -1278,7 +1290,7 @@ skip: } // Functions with default names aren't very interesting either. const std::string name = g_symbolMap->GetLabelString(f.start); - if (IsDefaultFunction(name)) { + if (IsDefaultFunction(name) || SkipFuncHash(name)) { continue; }