diff --git a/src/dbg/_dbgfunctions.cpp b/src/dbg/_dbgfunctions.cpp index 312178556c..348054944e 100644 --- a/src/dbg/_dbgfunctions.cpp +++ b/src/dbg/_dbgfunctions.cpp @@ -166,7 +166,6 @@ bool _getprocesslist(DBGPROCESSINFO** entries, int* count) static void _memupdatemap() { - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); } diff --git a/src/dbg/debugger.cpp b/src/dbg/debugger.cpp index db3f989216..80e89c8a15 100644 --- a/src/dbg/debugger.cpp +++ b/src/dbg/debugger.cpp @@ -35,7 +35,6 @@ static bool bSkipExceptions = false; static bool bBreakOnNextDll = false; static int ecount = 0; static std::vector ignoredExceptionRange; -static SIZE_T cachePrivateUsage = 0; static HANDLE hEvent = 0; static HANDLE hProcess = 0; static HANDLE hMemMapThread = 0; @@ -64,13 +63,8 @@ static DWORD WINAPI memMapThread(void* ptr) } if(bStopMemMapThread) break; - const SIZE_T PrivateUsage = dbggetprivateusage(fdProcessInfo->hProcess); - if(cachePrivateUsage != PrivateUsage && !dbgisrunning()) //update the memory map when the memory usage changed - { - cachePrivateUsage = PrivateUsage; - MemUpdateMap(); - GuiUpdateMemoryView(); - } + MemUpdateMap(); + GuiUpdateMemoryView(); Sleep(1000); } return 0; @@ -115,17 +109,6 @@ void dbgstop() WaitForThreadTermination(hTimeWastedCounterThread); } -SIZE_T dbggetprivateusage(HANDLE hProcess, bool update) -{ - PROCESS_MEMORY_COUNTERS_EX memoryCounters; - memoryCounters.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX); - if(!GetProcessMemoryInfo(fdProcessInfo->hProcess, (PPROCESS_MEMORY_COUNTERS)&memoryCounters, sizeof(PROCESS_MEMORY_COUNTERS_EX))) - return 0; - if(update) - cachePrivateUsage = memoryCounters.PrivateUsage; - return memoryCounters.PrivateUsage; -} - duint dbgdebuggedbase() { return pDebuggedBase; @@ -642,7 +625,6 @@ static void cbCreateProcess(CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo) dprintf("Process Started: " fhex " %s\n", base, DebugFileName); //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); @@ -764,7 +746,6 @@ static void cbCreateThread(CREATE_THREAD_DEBUG_INFO* CreateThread) if(settingboolget("Events", "ThreadStart")) { //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); //update GUI GuiSetDebugState(paused); @@ -856,7 +837,6 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll) ModLoad((duint)base, modInfo.ImageSize, modInfo.ImageName); //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); @@ -984,7 +964,6 @@ static void cbUnloadDll(UNLOAD_DLL_DEBUG_INFO* UnloadDll) ModUnload((duint)base); //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); } @@ -1057,7 +1036,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData) dputs("paused!"); SetNextDbgContinueStatus(DBG_CONTINUE); GuiSetDebugState(paused); - dbggetprivateusage(fdProcessInfo->hProcess, true); + //update memory map MemUpdateMap(); DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true); //lock @@ -1174,7 +1153,6 @@ DWORD WINAPI threadDebugLoop(void* lpParameter) varset("$hp", (duint)fdProcessInfo->hProcess, true); varset("$pid", fdProcessInfo->dwProcessId, true); ecount = 0; - cachePrivateUsage = 0; //NOTE: set custom handlers SetCustomHandler(UE_CH_CREATEPROCESS, (void*)cbCreateProcess); SetCustomHandler(UE_CH_EXITPROCESS, (void*)cbExitProcess); @@ -1438,7 +1416,6 @@ DWORD WINAPI threadAttachLoop(void* lpParameter) bFileIsDll = IsFileDLL(szFileName, 0); GuiAddRecentFile(szFileName); ecount = 0; - cachePrivateUsage = 0; //NOTE: set custom handlers SetCustomHandler(UE_CH_CREATEPROCESS, (void*)cbCreateProcess); SetCustomHandler(UE_CH_EXITPROCESS, (void*)cbExitProcess); diff --git a/src/dbg/debugger.h b/src/dbg/debugger.h index 6ea1d5a72f..8998078436 100644 --- a/src/dbg/debugger.h +++ b/src/dbg/debugger.h @@ -61,7 +61,6 @@ typedef struct _THREADNAME_INFO #pragma pack(pop) //functions -SIZE_T dbggetprivateusage(HANDLE hProcess, bool update = false); void dbginit(); void dbgstop(); duint dbgdebuggedbase(); diff --git a/src/dbg/debugger_commands.cpp b/src/dbg/debugger_commands.cpp index 72fa22e3ed..ed10a5c18c 100644 --- a/src/dbg/debugger_commands.cpp +++ b/src/dbg/debugger_commands.cpp @@ -799,7 +799,6 @@ CMDRESULT cbDebugAlloc(int argc, char* argv[]) if(mem) varset("$lastalloc", mem, true); //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); @@ -828,7 +827,6 @@ CMDRESULT cbDebugFree(int argc, char* argv[]) if(!ok) dputs("VirtualFreeEx failed"); //update memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); @@ -1869,7 +1867,6 @@ CMDRESULT cbDebugSetPageRights(int argc, char* argv[]) } //update the memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); @@ -2074,7 +2071,6 @@ CMDRESULT cbDebugSetCmdline(int argc, char* argv[]) } //update the memory map - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); diff --git a/src/dbg/instruction.cpp b/src/dbg/instruction.cpp index d385b72884..868d415a05 100644 --- a/src/dbg/instruction.cpp +++ b/src/dbg/instruction.cpp @@ -2225,7 +2225,6 @@ CMDRESULT cbInstrMeminfo(int argc, char* argv[]) } else if (argv[1][0] == 'r') { - dbggetprivateusage(fdProcessInfo->hProcess, true); MemUpdateMap(); GuiUpdateMemoryView(); dputs("memory map updated!");