ntdll: fix single stepping over popf instruction

Peter Beutner p.beutner at gmx.net
Sun Dec 3 13:30:06 CST 2006


---
 dlls/ntdll/signal_i386.c     |   12 ++++++++----
 dlls/ntdll/tests/exception.c |    4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 8166124..28824fc 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -1019,11 +1019,15 @@ static void WINAPI raise_trap_exception(
         {
             context->ContextFlags = CONTEXT_DEBUG_REGISTERS;
             NtGetContextThread(GetCurrentThread(), context);
-            /* do we really have a bp from a debug register ?
-             * if not, then someone did a kill(SIGTRAP) on us, and we
-             * shall return a breakpoint, not a single step exception
+            /* we have either:
+             *    - a bp from a debug register
+             *    - a single step interrupt at popf instruction, which just has
+             *      removed the TF.
+             *    - someone did a kill(SIGTRAP) on us, and we shall return
+             *      a breakpoint, not a single step exception
              */
-            if (!(context->Dr6 & 0xf)) rec->ExceptionCode = EXCEPTION_BREAKPOINT;
+            if ( !(context->Dr6 & 0xf) && !(context->Dr6 & 0x4000) )
+                rec->ExceptionCode = EXCEPTION_BREAKPOINT;
             context->ContextFlags |= CONTEXT_FULL;  /* restore flags */
         }
     }
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index ec86579..9e729a4 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -265,8 +265,8 @@ static DWORD single_step_handler( EXCEPT
     else {
         /* show that the last single step exception on the popf instruction
          * (which removed the TF bit), still is a EXCEPTION_SINGLE_STEP exception */
-        todo_wine { ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
-            "exception is not EXCEPTION_SINGLE_STEP: %x\n", rec->ExceptionCode); };
+        ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
+            "exception is not EXCEPTION_SINGLE_STEP: %x\n", rec->ExceptionCode);
     }
 
     return ExceptionContinueExecution;
-- 
1.4.3.4




More information about the wine-patches mailing list