Fix cross-page memory breakpoint page tracking

This commit is contained in:
Duncan Ogilvie 2026-04-13 15:11:09 +02:00
parent e0a457965f
commit 95f66412b6
1 changed files with 5 additions and 3 deletions

View File

@ -298,12 +298,13 @@ namespace GleeBug
};
std::vector<TempMemoryBreakpointData> breakpointData;
{
breakpointData.reserve(size / PAGE_SIZE);
breakpointData.reserve(BYTES_TO_PAGES((address - PAGE_ALIGN(address)) + size));
TempMemoryBreakpointData tempData;
MemoryBreakpointData data;
data.Type = uint32(type);
auto alignedAddress = PAGE_ALIGN(address);
for(auto page = alignedAddress; page < alignedAddress + ROUND_TO_PAGES(size); page += PAGE_SIZE)
auto alignedEnd = PAGE_ALIGN(address + size - 1);
for(auto page = alignedAddress; page <= alignedEnd; page += PAGE_SIZE)
{
MEMORY_BASIC_INFORMATION mbi;
if(!VirtualQueryEx(hProcess, LPCVOID(page), &mbi, sizeof(mbi)))
@ -382,7 +383,8 @@ namespace GleeBug
//delete the memory breakpoint from the pages
bool success = true;
auto alignedAddress = PAGE_ALIGN(info.address);
for(auto page = alignedAddress; page < alignedAddress + ROUND_TO_PAGES(info.internal.memory.size); page += PAGE_SIZE)
auto alignedEnd = PAGE_ALIGN(info.address + info.internal.memory.size - 1);
for(auto page = alignedAddress; page <= alignedEnd; page += PAGE_SIZE)
{
auto foundData = memoryBreakpointPages.find(page);
if(foundData == memoryBreakpointPages.end())