mirror of https://github.com/x64dbg/TitanEngine
Merge pull request #14 from shocoman/fix-double-pushfd-bug
Fix a bug that could change a stack value after stepping into a PUSHF instruction with a singleshoot breakpoint
This commit is contained in:
commit
b862c2b36f
|
|
@ -554,12 +554,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
SetThreadContext(hActiveThread, &myDBGContext);
|
SetThreadContext(hActiveThread, &myDBGContext);
|
||||||
EngineCloseHandle(hActiveThread);
|
EngineCloseHandle(hActiveThread);
|
||||||
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)FoundBreakPoint.BreakPointAddress, FoundBreakPoint.BreakPointSize, OldProtect, &OldProtect);
|
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)FoundBreakPoint.BreakPointAddress, FoundBreakPoint.BreakPointSize, OldProtect, &OldProtect);
|
||||||
ULONG_PTR ueCurrentPosition = FoundBreakPoint.BreakPointAddress;
|
|
||||||
unsigned char instr[16];
|
|
||||||
MemoryReadSafe(dbgProcessInformation.hProcess, (void*)ueCurrentPosition, instr, sizeof(instr), 0);
|
|
||||||
char* DisassembledString = (char*)StaticDisassembleEx(ueCurrentPosition, (LPVOID)instr);
|
|
||||||
if(strstr(DisassembledString, "PUSHF"))
|
|
||||||
PushfBPX = true;
|
|
||||||
|
|
||||||
if(FoundBreakPoint.BreakPointType == UE_SINGLESHOOT)
|
if(FoundBreakPoint.BreakPointType == UE_SINGLESHOOT)
|
||||||
{
|
{
|
||||||
|
|
@ -568,6 +562,16 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
ResetBPXAddressTo = NULL;
|
ResetBPXAddressTo = NULL;
|
||||||
ResetBPX = false;
|
ResetBPX = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if the current instruction pushes the flags, erase the trap flag from the stack after its execution
|
||||||
|
ULONG_PTR ueCurrentPosition = FoundBreakPoint.BreakPointAddress;
|
||||||
|
unsigned char instr[16];
|
||||||
|
MemoryReadSafe(dbgProcessInformation.hProcess, (void*)ueCurrentPosition, instr, sizeof(instr), 0);
|
||||||
|
char* DisassembledString = (char*)StaticDisassembleEx(ueCurrentPosition, (LPVOID)instr);
|
||||||
|
if(strstr(DisassembledString, "PUSHF"))
|
||||||
|
PushfBPX = true;
|
||||||
|
}
|
||||||
|
|
||||||
//execute callback
|
//execute callback
|
||||||
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
|
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue