| 13498 | } |
| 13499 | |
| 13500 | void WinDebugger::ReserveHotTargetMemory(int size) |
| 13501 | { |
| 13502 | HotTargetMemory hotTargetMemory; |
| 13503 | hotTargetMemory.mOffset = 0; |
| 13504 | hotTargetMemory.mSize = 0; |
| 13505 | hotTargetMemory.mPtr = NULL; |
| 13506 | |
| 13507 | if (size > 0) |
| 13508 | { |
| 13509 | // In 64-bit mode we have a reserved region on program load that we commit here because the offsets |
| 13510 | // must be within 32-bits of the original EXE image, but in 32-bit mode we don't reserve anything |
| 13511 | // until here |
| 13512 | #ifdef BF_DBG_32 |
| 13513 | //hotTargetMemory.mSize = std::max(1024 * 1024, size); |
| 13514 | BF_ASSERT((size & (mPageSize - 1)) == 0); |
| 13515 | hotTargetMemory.mSize = size; |
| 13516 | hotTargetMemory.mPtr = (addr_target)(intptr)VirtualAllocEx(mProcessInfo.hProcess, NULL, hotTargetMemory.mSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); |
| 13517 | mDebugTarget->mHotHeap->AddTrackedRegion(hotTargetMemory.mPtr, hotTargetMemory.mSize); |
| 13518 | #else |
| 13519 | hotTargetMemory.mSize = size; |
| 13520 | hotTargetMemory.mPtr = mDebugTarget->mHotHeap->Alloc(size); |
| 13521 | BF_ASSERT(hotTargetMemory.mPtr != 0); |
| 13522 | auto ptr = ::VirtualAllocEx(mProcessInfo.hProcess, (void*)(intptr)hotTargetMemory.mPtr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); |
| 13523 | BF_ASSERT(ptr == (void*)(intptr)hotTargetMemory.mPtr); |
| 13524 | #endif |
| 13525 | } |
| 13526 | |
| 13527 | BfLogDbg("ReserveHotTargetMemory %p %d\n", hotTargetMemory.mPtr, hotTargetMemory.mSize); |
| 13528 | int err = GetLastError(); |
| 13529 | mHotTargetMemory.push_back(hotTargetMemory); |
| 13530 | } |
| 13531 | |
| 13532 | addr_target WinDebugger::AllocHotTargetMemory(int size, bool canExecute, bool canWrite, int* outAllocSize) |
| 13533 | { |
no test coverage detected