Piotr Caban : ntdll: Fix x64 single step exception detection on macOS.

Alexandre Julliard julliard at winehq.org
Mon Jul 11 15:51:38 CDT 2022


Module: wine
Branch: master
Commit: 6f9cc9a0836b45ae55f602a20a4375c086e60c76
URL:    https://gitlab.winehq.org/wine/wine/-/commit/6f9cc9a0836b45ae55f602a20a4375c086e60c76

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Jul  7 21:20:01 2022 +0200

ntdll: Fix x64 single step exception detection on macOS.

On macOS si_code is always set to TRAP_BRKPT.

---

 dlls/ntdll/unix/signal_x86_64.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 6c87e347eac..54353e50e3d 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -2693,22 +2693,12 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
     rec.ExceptionAddress = (void *)RIP_sig(ucontext);
     save_context( &context, sigcontext );
 
-    switch (siginfo->si_code)
+    switch (TRAP_sig(ucontext))
     {
-    case TRAP_TRACE:  /* Single-step exception */
-    case 4 /* TRAP_HWBKPT */: /* Hardware breakpoint exception */
+    case TRAP_x86_TRCTRAP:
         rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
         break;
-    case TRAP_BRKPT:   /* Breakpoint exception */
-#ifdef SI_KERNEL
-    case SI_KERNEL:
-#endif
-        /* Check if this is actually icebp instruction */
-        if (((unsigned char *)RIP_sig(ucontext))[-1] == 0xF1)
-        {
-            rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
-            break;
-        }
+    case TRAP_x86_BPTFLT:
         rec.ExceptionAddress = (char *)rec.ExceptionAddress - 1;  /* back up over the int3 instruction */
         /* fall through */
     default:




More information about the wine-cvs mailing list