Debugger: Add a simple way to exclude from hashmap.

Sometimes funcs have common patterns, this is a quick way to avoid
poisoning the hashmap.
This commit is contained in:
Unknown W. Brackets 2023-04-29 10:24:35 -07:00
parent bab2461a48
commit 07d2b77c2a
3 changed files with 16 additions and 2 deletions

View File

@ -781,6 +781,7 @@ static const ConfigSetting debuggerSettings[] = {
ConfigSetting("ShowGpuProfile", &g_Config.bShowGpuProfile, false, CfgFlag::DONT_SAVE), ConfigSetting("ShowGpuProfile", &g_Config.bShowGpuProfile, false, CfgFlag::DONT_SAVE),
ConfigSetting("SkipDeadbeefFilling", &g_Config.bSkipDeadbeefFilling, false, CfgFlag::DEFAULT), ConfigSetting("SkipDeadbeefFilling", &g_Config.bSkipDeadbeefFilling, false, CfgFlag::DEFAULT),
ConfigSetting("FuncHashMap", &g_Config.bFuncHashMap, 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("MemInfoDetailed", &g_Config.bDebugMemInfoDetailed, false, CfgFlag::DEFAULT),
ConfigSetting("DrawFrameGraph", &g_Config.bDrawFrameGraph, false, CfgFlag::DEFAULT), ConfigSetting("DrawFrameGraph", &g_Config.bDrawFrameGraph, false, CfgFlag::DEFAULT),
}; };

View File

@ -484,6 +484,7 @@ public:
// Double edged sword: much easier debugging, but not accurate. // Double edged sword: much easier debugging, but not accurate.
bool bSkipDeadbeefFilling; bool bSkipDeadbeefFilling;
bool bFuncHashMap; bool bFuncHashMap;
std::string sSkipFuncHashMap;
bool bDebugMemInfoDetailed; bool bDebugMemInfoDetailed;
bool bDrawFrameGraph; bool bDrawFrameGraph;

View File

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h" #include "ppsspp_config.h"
#include <algorithm>
#include <map> #include <map>
#include <set> #include <set>
#include <unordered_map> #include <unordered_map>
@ -27,6 +28,7 @@
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
@ -940,6 +942,10 @@ skip:
return true; 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. // 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_")); 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<std::string> 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) { void RegisterFunction(u32 startAddr, u32 size, const char *name) {
std::lock_guard<std::recursive_mutex> guard(functions_lock); std::lock_guard<std::recursive_mutex> guard(functions_lock);
@ -1196,7 +1208,7 @@ skip:
for (auto iter = functions.begin(); iter != functions.end(); iter++) { for (auto iter = functions.begin(); iter != functions.end(); iter++) {
if (iter->start == startAddr) { if (iter->start == startAddr) {
// Let's just add it to the hashmap. // Let's just add it to the hashmap.
if (iter->hasHash && size > 16) { if (iter->hasHash && size > 16 && SkipFuncHash(name)) {
HashMapFunc hfun; HashMapFunc hfun;
hfun.hash = iter->hash; hfun.hash = iter->hash;
strncpy(hfun.name, name, 64); strncpy(hfun.name, name, 64);
@ -1278,7 +1290,7 @@ skip:
} }
// Functions with default names aren't very interesting either. // Functions with default names aren't very interesting either.
const std::string name = g_symbolMap->GetLabelString(f.start); const std::string name = g_symbolMap->GetLabelString(f.start);
if (IsDefaultFunction(name)) { if (IsDefaultFunction(name) || SkipFuncHash(name)) {
continue; continue;
} }