mirror of https://github.com/x64dbg/GleeBug
some small fixes + remove BreakpointInfo.enabled
This commit is contained in:
parent
b76d500c42
commit
98ff237193
|
|
@ -69,6 +69,7 @@ namespace GleeBug
|
|||
HardwareSlot slot;
|
||||
HardwareType type;
|
||||
HardwareSize size;
|
||||
bool enabled;
|
||||
} hardware;
|
||||
struct
|
||||
{
|
||||
|
|
@ -84,7 +85,6 @@ namespace GleeBug
|
|||
struct BreakpointInfo
|
||||
{
|
||||
ptr address;
|
||||
bool enabled;
|
||||
bool singleshoot;
|
||||
BreakpointType type;
|
||||
BreakpointInternalInfo internal;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ namespace GleeBug
|
|||
return;
|
||||
const auto info = foundInfo->second;
|
||||
|
||||
if (!info.enabled)
|
||||
return; //not a valid software breakpoint
|
||||
|
||||
//set continue status
|
||||
mContinueStatus = DBG_CONTINUE;
|
||||
|
||||
|
|
@ -142,7 +139,7 @@ namespace GleeBug
|
|||
if (foundInfo == mProcess->breakpoints.end())
|
||||
return; //not a valid hardware breakpoint
|
||||
const auto info = foundInfo->second;
|
||||
if (info.internal.hardware.slot != breakpointSlot || !info.enabled)
|
||||
if (info.internal.hardware.slot != breakpointSlot)
|
||||
return; //not a valid hardware breakpoint
|
||||
|
||||
//set continue status
|
||||
|
|
@ -238,10 +235,6 @@ namespace GleeBug
|
|||
//TODO: think about what happens with multiple breakpoints in one page where only one is disabled
|
||||
//There is really no problem about this because enabled is a property of a range and ranges do not overlap.
|
||||
const auto info = foundInfo->second;
|
||||
if (!info.enabled)
|
||||
return;
|
||||
|
||||
printf("memory breakpoint: 0x%p (size: %d)\n", info.address, info.internal.memory.size);
|
||||
|
||||
//TODO: check if the right type is accessed (ExceptionInformation[0])
|
||||
//FIXED:
|
||||
|
|
@ -434,10 +427,6 @@ namespace GleeBug
|
|||
//TODO: think about what happens with multiple breakpoints in one page where only one is disabled
|
||||
//There is really no problem about this because enabled is a property of a range and ranges do not overlap.
|
||||
const auto info = foundInfo->second;
|
||||
if (!info.enabled)
|
||||
return;
|
||||
|
||||
printf("memory breakpoint: 0x%p (size: %d)\n", info.address, info.internal.memory.size);
|
||||
|
||||
//TODO: check if the right type is accessed (ExceptionInformation[0])
|
||||
//FIXED:
|
||||
|
|
@ -452,8 +441,6 @@ namespace GleeBug
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Access = 1,
|
||||
Read = 2,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ namespace GleeBug
|
|||
//setup the breakpoint information struct
|
||||
BreakpointInfo info = {};
|
||||
info.address = address;
|
||||
info.enabled = true;
|
||||
info.singleshoot = singleshoot;
|
||||
info.type = BreakpointType::Software;
|
||||
|
||||
|
|
@ -64,13 +63,10 @@ namespace GleeBug
|
|||
return false;
|
||||
const auto & info = found->second;
|
||||
|
||||
//restore the breakpoint bytes if the breakpoint is enabled
|
||||
if (info.enabled)
|
||||
{
|
||||
if (!MemWriteUnsafe(address, info.internal.software.oldbytes, info.internal.software.size))
|
||||
return false;
|
||||
FlushInstructionCache(hProcess, nullptr, 0);
|
||||
}
|
||||
//restore the breakpoint bytes
|
||||
if (!MemWriteUnsafe(address, info.internal.software.oldbytes, info.internal.software.size))
|
||||
return false;
|
||||
FlushInstructionCache(hProcess, nullptr, 0);
|
||||
|
||||
//remove the breakpoint from the maps
|
||||
softwareBreakpointReferences.erase(info.address);
|
||||
|
|
@ -84,7 +80,7 @@ namespace GleeBug
|
|||
//find a free hardware breakpoint slot
|
||||
for (int i = 0; i < HWBP_COUNT; i++)
|
||||
{
|
||||
if (!hardwareBreakpoints[i].enabled)
|
||||
if (!hardwareBreakpoints[i].internal.hardware.enabled)
|
||||
{
|
||||
slot = HardwareSlot(i);
|
||||
return true;
|
||||
|
|
@ -122,7 +118,6 @@ namespace GleeBug
|
|||
//setup the breakpoint information struct
|
||||
BreakpointInfo info = {};
|
||||
info.address = address;
|
||||
info.enabled = true;
|
||||
info.singleshoot = singleshoot;
|
||||
info.type = BreakpointType::Hardware;
|
||||
info.internal.hardware.slot = slot;
|
||||
|
|
@ -160,7 +155,7 @@ namespace GleeBug
|
|||
const auto & info = found->second;
|
||||
|
||||
//delete the hardware breakpoint from the internal buffer
|
||||
hardwareBreakpoints[int(info.internal.hardware.slot)].enabled = false;
|
||||
hardwareBreakpoints[int(info.internal.hardware.slot)].internal.hardware.enabled = false;
|
||||
|
||||
//delete the hardware breakpoint from the registers
|
||||
bool success = true;
|
||||
|
|
@ -333,7 +328,6 @@ namespace GleeBug
|
|||
//setup the breakpoint information struct
|
||||
BreakpointInfo info = {};
|
||||
info.address = address;
|
||||
info.enabled = true;
|
||||
info.singleshoot = singleshoot;
|
||||
info.type = BreakpointType::Memory;
|
||||
info.internal.memory.type = type;
|
||||
|
|
@ -386,8 +380,8 @@ namespace GleeBug
|
|||
if (data.Refcount)
|
||||
{
|
||||
//TODO: properly determine the new protection flag
|
||||
//Are there any other protections left?
|
||||
//If so add the guard
|
||||
//Are there any other protections left?
|
||||
//If so add the guard
|
||||
if (data.Type & ~uint32(info.internal.memory.type))
|
||||
data.NewProtect = data.OldProtect | PAGE_GUARD;
|
||||
Protect = data.NewProtect;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ namespace GleeBug
|
|||
{
|
||||
DWORD dwOldProtect;
|
||||
auto vps = VirtualProtectEx(hProcess, LPVOID(address), size, newProtect, &dwOldProtect);
|
||||
printf("MemProtect(0x%p, 0x%X, %08X, %08X) = %d\n", address, size, newProtect, dwOldProtect, vps);
|
||||
if (!vps)
|
||||
return false;
|
||||
if (oldProtect)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace GleeBug
|
|||
permanentDep(false)
|
||||
{
|
||||
for (int i = 0; i < HWBP_COUNT; i++)
|
||||
hardwareBreakpoints[i].enabled = false;
|
||||
hardwareBreakpoints[i].internal.hardware.enabled = false;
|
||||
}
|
||||
|
||||
void Process::StepOver(const StepCallback & cbStep)
|
||||
|
|
|
|||
Loading…
Reference in New Issue