| 685 | } |
| 686 | |
| 687 | void WinDebugger::PhysSetBreakpoint(addr_target address) |
| 688 | { |
| 689 | BfLogDbg("PhysSetBreakpoint %p\n", address); |
| 690 | |
| 691 | uint8 newData = 0xCC; |
| 692 | |
| 693 | // This ensure that we have the orig image data cached |
| 694 | DbgMemoryFlags flags = mDebugTarget->ReadOrigImageData(address, NULL, 1); |
| 695 | if ((flags & DbgMemoryFlags_Execute) == 0) |
| 696 | { |
| 697 | BfLogDbg("Breakpoint ignored - execute flag NOT set in breakpoint address\n", address); |
| 698 | |
| 699 | BfLogDbg("Memory Flags = %d\n", gDebugger->GetMemoryFlags(address)); |
| 700 | |
| 701 | return; |
| 702 | } |
| 703 | |
| 704 | // Replace it with Breakpoint |
| 705 | SIZE_T dwReadBytes; |
| 706 | BOOL worked = ::WriteProcessMemory(mProcessInfo.hProcess, (void*)(intptr)address, &newData, 1, &dwReadBytes); |
| 707 | if (!worked) |
| 708 | { |
| 709 | int err = GetLastError(); |
| 710 | BfLogDbg("SetBreakpoint FAILED %p\n", address); |
| 711 | } |
| 712 | FlushInstructionCache(mProcessInfo.hProcess, (void*)(intptr)address, 1); |
| 713 | |
| 714 | { |
| 715 | uint8 mem = ReadMemory<uint8>(address); |
| 716 | BfLogDbg("Breakpoint byte %X\n", mem); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | void WinDebugger::SetBreakpoint(addr_target address, bool fromRehup) |
| 721 | { |
no test coverage detected