Hardware Breakpoint : Fixed a bug where when HW BP is hit and the user deletes the HW BP then resumes the execution, the Trap Flag is still set which make titanengine think the debuggee throwed a SINGLE_STEP Exception.

BP : Fixed a bug where setting a HW BP and a SW BP (could be any combination e.g SW BP then a HW BP) on same address, then removing one of the two BP when program hits the BP will remove all BPs set on that address.
This commit is contained in:
Herzeh 2015-12-11 12:50:16 +01:00
parent 51208e22f3
commit 92f5d48c85
1 changed files with 26 additions and 2 deletions

View File

@ -594,7 +594,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
EngineCloseHandle(hActiveThread); EngineCloseHandle(hActiveThread);
} }
} }
else if(ResetHwBPX) //restore hardware breakpoint if(ResetHwBPX) //restore hardware breakpoint
{ {
ResetHwBPX = false; ResetHwBPX = false;
SetHardwareBreakPoint(DebugRegisterX.DrxBreakAddress, DebugRegisterXId, DebugRegisterX.DrxBreakPointType, DebugRegisterX.DrxBreakPointSize, (LPVOID)DebugRegisterX.DrxCallBack); SetHardwareBreakPoint(DebugRegisterX.DrxBreakAddress, DebugRegisterXId, DebugRegisterX.DrxBreakPointType, DebugRegisterX.DrxBreakPointSize, (LPVOID)DebugRegisterX.DrxCallBack);
@ -613,7 +613,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
} }
} }
} }
else if(ResetMemBPX) //restore memory breakpoint if(ResetMemBPX) //restore memory breakpoint
{ {
ResetMemBPX = false; ResetMemBPX = false;
VirtualQueryEx(dbgProcessInformation.hProcess, (LPCVOID)ResetMemBPXAddress, &MemInfo, sizeof MEMORY_BASIC_INFORMATION); VirtualQueryEx(dbgProcessInformation.hProcess, (LPCVOID)ResetMemBPXAddress, &MemInfo, sizeof MEMORY_BASIC_INFORMATION);
@ -658,6 +658,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR0); DeleteHardwareBreakPoint(UE_DR0);
ResetHwBPX = true; ResetHwBPX = true;
} }
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~(1 << 8);
SetThreadContext(hActiveThread, &myDBGContext);
}
} }
else else
{ {
@ -680,6 +686,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR1); DeleteHardwareBreakPoint(UE_DR1);
ResetHwBPX = true; ResetHwBPX = true;
} }
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~(1 << 8);
SetThreadContext(hActiveThread, &myDBGContext);
}
} }
else else
{ {
@ -702,6 +714,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR2); DeleteHardwareBreakPoint(UE_DR2);
ResetHwBPX = true; ResetHwBPX = true;
} }
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~(1 << 8);
SetThreadContext(hActiveThread, &myDBGContext);
}
} }
else else
{ {
@ -724,6 +742,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR3); DeleteHardwareBreakPoint(UE_DR3);
ResetHwBPX = true; ResetHwBPX = true;
} }
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~(1 << 8);
SetThreadContext(hActiveThread, &myDBGContext);
}
} }
else else
{ {