From 490ce02fb3f8edc40b6e7e82c445a6687e9361d0 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 8 Jul 2023 12:50:02 +0200 Subject: [PATCH] Also implement #14 for UD2 breakpoints --- TitanEngine/TitanEngine.Debugger.DebugLoop.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp b/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp index 54541f4..571a5d0 100644 --- a/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp +++ b/TitanEngine/TitanEngine.Debugger.DebugLoop.cpp @@ -1317,6 +1317,16 @@ __declspec(dllexport) void TITCALL DebugLoop() ResetBPXAddressTo = NULL; 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 myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);