From b93e02ad7360aefcf6da35791e8f9f59ca4061aa Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 14 Mar 2021 15:10:35 -0700 Subject: [PATCH] Debugger: Ignore small memory info by default. The ini can be updated to enable higher resolution data. Allocations are always at least 0x100, so this is still pretty useful. --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/Debugger/MemBlockInfo.cpp | 25 ++++++++++++++----------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 08bd436f48..16a75c3a41 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1053,6 +1053,7 @@ static ConfigSetting debuggerSettings[] = { ConfigSetting("ShowGpuProfile", &g_Config.bShowGpuProfile, false, false), ConfigSetting("SkipDeadbeefFilling", &g_Config.bSkipDeadbeefFilling, false), ConfigSetting("FuncHashMap", &g_Config.bFuncHashMap, false), + ConfigSetting("MemInfoDetailed", &g_Config.bDebugMemInfoDetailed, false), ConfigSetting("DrawFrameGraph", &g_Config.bDrawFrameGraph, false), ConfigSetting(false), diff --git a/Core/Config.h b/Core/Config.h index ef3dc7c7e9..061b90f241 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -467,6 +467,7 @@ public: // Double edged sword: much easier debugging, but not accurate. bool bSkipDeadbeefFilling; bool bFuncHashMap; + bool bDebugMemInfoDetailed; bool bDrawFrameGraph; // Volatile development settings diff --git a/Core/Debugger/MemBlockInfo.cpp b/Core/Debugger/MemBlockInfo.cpp index 4f4a5f909f..e60f209edd 100644 --- a/Core/Debugger/MemBlockInfo.cpp +++ b/Core/Debugger/MemBlockInfo.cpp @@ -22,6 +22,7 @@ #include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" +#include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/MemBlockInfo.h" @@ -366,18 +367,20 @@ void NotifyMemInfoPC(MemBlockFlags flags, uint32_t start, uint32_t size, uint32_ // Clear the uncached and kernel bits. start &= ~0xC0000000; - PendingNotifyMem info{ flags, start, size }; - info.ticks = CoreTiming::GetTicks(); - info.pc = pc; - size_t copyLength = strLength; - if (copyLength >= sizeof(info.tag)) { - copyLength = sizeof(info.tag) - 1; - } - memcpy(info.tag, tagStr, copyLength); - info.tag[copyLength] = 0; - bool needFlush = false; - { + // When the setting is off, we skip smaller info to keep things fast. + if (g_Config.bDebugMemInfoDetailed || size >= 0x100) { + PendingNotifyMem info{ flags, start, size }; + info.ticks = CoreTiming::GetTicks(); + info.pc = pc; + + size_t copyLength = strLength; + if (copyLength >= sizeof(info.tag)) { + copyLength = sizeof(info.tag) - 1; + } + memcpy(info.tag, tagStr, copyLength); + info.tag[copyLength] = 0; + std::lock_guard guard(pendingMutex); pendingNotifies.push_back(info); needFlush = pendingNotifies.size() > MAX_PENDING_NOTIFIES;