fixed a bug with stepping over hardware breakpoints

This commit is contained in:
Mr. eXoDia 2014-07-25 22:37:20 +02:00
parent f44b9b0310
commit d6cb3e584b
1 changed files with 126 additions and 128 deletions

View File

@ -766,30 +766,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
} }
else //no resetting needed (debugger reached hardware breakpoint or the user stepped) else //no resetting needed (debugger reached hardware breakpoint or the user stepped)
{ {
if(engineStepActive) //handle hardware breakpoints
{
DBGCode = DBG_CONTINUE;
if(engineStepCount == NULL)
{
myCustomBreakPoint = (fCustomBreakPoint)(engineStepCallBack);
__try
{
engineStepActive = false;
engineStepCallBack = NULL;
myCustomBreakPoint();
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
}
else
{
SingleStep(engineStepCount, engineStepCallBack);
}
}
else //handle hardware breakpoints
{
hActiveThread = OpenThread(THREAD_GET_CONTEXT|THREAD_SET_CONTEXT, false, DBGEvent.dwThreadId); hActiveThread = OpenThread(THREAD_GET_CONTEXT|THREAD_SET_CONTEXT, false, DBGEvent.dwThreadId);
myDBGContext.ContextFlags = CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL; myDBGContext.ContextFlags = CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL;
GetThreadContext(hActiveThread, &myDBGContext); GetThreadContext(hActiveThread, &myDBGContext);
@ -915,6 +892,27 @@ __declspec(dllexport) void TITCALL DebugLoop()
if(strstr(DisassembledString, "PUSHF")) if(strstr(DisassembledString, "PUSHF"))
PushfBPX = true; PushfBPX = true;
} }
if(engineStepActive)
{
DBGCode = DBG_CONTINUE;
if(engineStepCount == NULL)
{
myCustomBreakPoint = (fCustomBreakPoint)(engineStepCallBack);
__try
{
engineStepActive = false;
engineStepCallBack = NULL;
myCustomBreakPoint();
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
}
else
{
SingleStep(engineStepCount, engineStepCallBack);
}
} }
} }
if(DBGCode==DBG_EXCEPTION_NOT_HANDLED) //NOTE: only call the chSingleStep callback when the debuggee generated the exception if(DBGCode==DBG_EXCEPTION_NOT_HANDLED) //NOTE: only call the chSingleStep callback when the debuggee generated the exception