1
0
Fork 0

DBG: improve performance of MemoryMapUpdate

This commit is contained in:
Duncan Ogilvie 2019-01-10 23:45:24 +01:00
parent e5e96f7cbb
commit d04288cbc1
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 14 additions and 8 deletions

View File

@ -181,6 +181,19 @@ void MemUpdateMap()
THREADLIST threadList; THREADLIST threadList;
ThreadGetList(&threadList); ThreadGetList(&threadList);
auto pebBase = (duint)GetPEBLocation(fdProcessInfo->hProcess); auto pebBase = (duint)GetPEBLocation(fdProcessInfo->hProcess);
std::vector<duint> stackAddrs;
for(int i = 0; i < threadList.count; i++)
{
DWORD threadId = threadList.list[i].BasicInfo.ThreadId;
// Read TEB::Tib to get stack information
NT_TIB tib;
if(!ThreadGetTib(threadList.list[i].BasicInfo.ThreadLocalBase, &tib))
continue;
// The stack will be a specific range only, not always the base address
stackAddrs.push_back((duint)tib.StackLimit);
}
for(auto & page : pageVector) for(auto & page : pageVector)
{ {
@ -229,15 +242,8 @@ void MemUpdateMap()
#endif //_WIN64 #endif //_WIN64
} }
// Mark stack
//
// Read TEB::Tib to get stack information
NT_TIB tib;
if(!ThreadGetTib(tebBase, &tib))
continue;
// The stack will be a specific range only, not always the base address // The stack will be a specific range only, not always the base address
duint stackAddr = (duint)tib.StackLimit; duint stackAddr = stackAddrs[i];
if(stackAddr >= pageBase && stackAddr < (pageBase + pageSize)) if(stackAddr >= pageBase && stackAddr < (pageBase + pageSize))
sprintf_s(page.info, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Thread %X Stack")), threadId); sprintf_s(page.info, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Thread %X Stack")), threadId);