fixed hwbp api to use UE_DRX constants instead of the indicies wrongfully

This commit is contained in:
AzuLX 2026-01-05 00:26:14 +00:00
parent dcb01c6abe
commit 4987989b34
No known key found for this signature in database
GPG Key ID: BED7E7DC23A637BC
2 changed files with 13 additions and 4 deletions

View File

@ -143,7 +143,10 @@ namespace GleeBug
//if the breakpoint was deleted during callback, clear internal stepping to prevent thread suspension
if(mProcess->breakpoints.find({ BreakpointType::Hardware, info.address }) == mProcess->breakpoints.end())
{
mThread->isInternalStepping = false;
Registers(mThread->hThread, CONTEXT_CONTROL).TrapFlag = false;
}
//delete the breakpoint if it is singleshoot
if(info.singleshoot)

View File

@ -821,6 +821,10 @@ public:
{
if(!mProcess)
return false;
//convert from UE_DRx (11-14) to slot index (0-3)
auto slot = (HardwareSlot)(IndexOfRegister - UE_DR0);
if((DWORD)slot > 3)
return false;
auto running = mIsRunning;
if(running)
{
@ -828,7 +832,7 @@ public:
thread.second->Suspend();
}
if(!mProcess->SetHardwareBreakpoint(bpxAddress,
(HardwareSlot)IndexOfRegister, [bpxCallBack](const BreakpointInfo & info)
slot, [bpxCallBack](const BreakpointInfo & info)
{
(HWBPCALLBACK(bpxCallBack))((const void*)info.address);
}, hwtypeFromTitan(bpxType), hwsizeFromTitan(bpxSize)))
@ -843,9 +847,11 @@ public:
bool DeleteHardwareBreakPoint(DWORD IndexOfRegister)
{
if(!mProcess || IndexOfRegister > 3)
//convert from UE_DRx (11-14) to slot index (0-3)
auto slot = IndexOfRegister - UE_DR0;
if(!mProcess || slot > 3)
return false;
auto address = mProcess->hardwareBreakpoints[IndexOfRegister].address;
auto address = mProcess->hardwareBreakpoints[slot].address;
return mProcess->DeleteHardwareBreakpoint(address);
}
@ -856,7 +862,7 @@ public:
HardwareSlot slot;
bool result = mProcess->GetFreeHardwareBreakpointSlot(slot);
if(result)
*RegisterIndex = (DWORD)slot;
*RegisterIndex = UE_DR0 + (DWORD)slot; //UE_DR0-UE_DR3 (11-14), not 0-3
return result;
}