Hans Leidekker : ntdll: Fix breakpoint exception address on 64-bit Linux.

Alexandre Julliard julliard at winehq.org
Wed May 15 16:18:28 CDT 2019


Module: wine
Branch: master
Commit: 4872747b271ffb8f985c6b55c66c49ebc73072a6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4872747b271ffb8f985c6b55c66c49ebc73072a6

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed May 15 14:19:41 2019 +0200

ntdll: Fix breakpoint exception address on 64-bit Linux.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/debugger.c | 10 +++++++++-
 dlls/ntdll/signal_x86_64.c     |  5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index f62a614..bd9d61b 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -638,7 +638,15 @@ static void test_debug_loop(int argc, char **argv)
         if (!ret) break;
 
         if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break;
-
+#if defined(__i386__) || defined(__x86_64__)
+        if (ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT &&
+            ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT)
+        {
+            BYTE byte = 0;
+            NtReadVirtualMemory(pi.hProcess, ev.u.Exception.ExceptionRecord.ExceptionAddress, &byte, 1, NULL);
+            ok(byte == 0xcc, "got %02x\n", byte);
+        }
+#endif
         ret = ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
         ok(ret, "ContinueDebugEvent failed, last error %#x.\n", GetLastError());
         if (!ret) break;
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 21e7098..c2151f7 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3134,7 +3134,10 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
         rec->ExceptionCode = EXCEPTION_SINGLE_STEP;
         break;
     case TRAP_BRKPT:   /* Breakpoint exception */
-        /* Check if this is actuallly icebp instruction */
+#ifdef SI_KERNEL
+    case SI_KERNEL:
+#endif
+        /* Check if this is actually icebp instruction */
         if (((unsigned char *)rec->ExceptionAddress)[-1] == 0xF1)
         {
             rec->ExceptionCode = EXCEPTION_SINGLE_STEP;




More information about the wine-cvs mailing list