Merged in Herz3h/titanengine-update (pull request #9)

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.
This commit is contained in:
mrexodia 2015-12-11 22:20:28 +01:00
commit fa184271cd
1 changed files with 26 additions and 2 deletions

View File

@ -594,7 +594,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
EngineCloseHandle(hActiveThread);
}
}
else if(ResetHwBPX) //restore hardware breakpoint
if(ResetHwBPX) //restore hardware breakpoint
{
ResetHwBPX = false;
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;
VirtualQueryEx(dbgProcessInformation.hProcess, (LPCVOID)ResetMemBPXAddress, &MemInfo, sizeof MEMORY_BASIC_INFORMATION);
@ -658,6 +658,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR0);
ResetHwBPX = true;
}
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~UE_TRAP_FLAG;
SetThreadContext(hActiveThread, &myDBGContext);
}
}
else
{
@ -680,6 +686,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR1);
ResetHwBPX = true;
}
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~UE_TRAP_FLAG;
SetThreadContext(hActiveThread, &myDBGContext);
}
}
else
{
@ -702,6 +714,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR2);
ResetHwBPX = true;
}
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~UE_TRAP_FLAG;
SetThreadContext(hActiveThread, &myDBGContext);
}
}
else
{
@ -724,6 +742,12 @@ __declspec(dllexport) void TITCALL DebugLoop()
DeleteHardwareBreakPoint(UE_DR3);
ResetHwBPX = true;
}
else
{
GetThreadContext(hActiveThread, &myDBGContext);
myDBGContext.EFlags &= ~UE_TRAP_FLAG;
SetThreadContext(hActiveThread, &myDBGContext);
}
}
else
{