some small fixes + remove BreakpointInfo.enabled

This commit is contained in:
mrexodia 2017-02-24 18:25:47 +01:00
parent b76d500c42
commit 98ff237193
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
5 changed files with 11 additions and 31 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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)
{
//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;

View File

@ -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)

View File

@ -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)