1
0
Fork 0

DBG: do not auto-set breakpoints on module load if their oldbytes don't match + update oldbytes when a breakpoint is enabled.

This commit is contained in:
mrexodia 2015-12-17 17:17:49 +01:00
parent 7171334e1a
commit 8e34d10712
2 changed files with 23 additions and 2 deletions

View File

@ -152,6 +152,13 @@ bool BpEnable(duint Address, BP_TYPE Type, bool Enable)
return false;
bpInfo->enabled = Enable;
//Re-read oldbytes
if (Enable && Type == BPNORMAL)
{
if (!MemRead(Address, &bpInfo->oldbytes, sizeof(bpInfo->oldbytes)))
return false;
}
return true;
}

View File

@ -522,8 +522,22 @@ bool cbSetModuleBreakpoints(const BREAKPOINT* bp)
{
case BPNORMAL:
{
if(!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
dprintf("Could not set breakpoint " fhex "! (SetBPX)\n", bp->addr);
unsigned short oldbytes;
if (MemRead(bp->addr, &oldbytes, sizeof(oldbytes)))
{
if (oldbytes != bp->oldbytes)
{
dprintf("Breakpoint " fhex " has been disabled because the bytes don't match! Expected: %02X %02X, Found: %02X %02X\n",
bp->addr,
((unsigned char*)&bp->oldbytes)[0], ((unsigned char*)&bp->oldbytes)[1],
((unsigned char*)&oldbytes)[0], ((unsigned char*)&oldbytes)[1]);
BpEnable(bp->addr, BPNORMAL, false);
}
else if (!SetBPX(bp->addr, bp->titantype, (void*)cbUserBreakpoint))
dprintf("Could not set breakpoint " fhex "! (SetBPX)\n", bp->addr);
}
else
dprintf("MemRead failed on breakpoint address" fhex "!\n", bp->addr);
}
break;