From e514a4a4047a781e6156ca31e6f717ec2c64ce01 Mon Sep 17 00:00:00 2001
From: Eric Pouech <eric.pouech@wanadoo.fr>
Date: Sun, 2 Jun 2002 21:20:22 +0000
Subject: [PATCH] Really enter the debugger when DebugBreak(Process) is invoked
 on debuggee.

---
 debugger/break.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/debugger/break.c b/debugger/break.c
index 63f8522b5ee..4f5afe22686 100644
--- a/debugger/break.c
+++ b/debugger/break.c
@@ -799,7 +799,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
        syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE );
 
        DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n",
-	       oldval, breakpoints[wpnum].u.w.oldval);
+                    oldval, breakpoints[wpnum].u.w.oldval);
        if (syminfo.list.sourcefile != NULL)
 	  DEBUG_List(&syminfo.list, NULL, 0);
        return FALSE;
@@ -844,12 +844,20 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
     }
 
 #ifdef __i386__
-    /* If there's no breakpoint and we are not single-stepping, then we     */
-    /* must have encountered an int3 in the Windows program; let's skip it. */
+    /* If there's no breakpoint and we are not single-stepping, then
+     * either we must have encountered an int3 in the Windows program
+     * or someone is trying to stop us
+     * If the later, (no int3 opcode at current address) then stop, 
+     * otherwise, let's skip it. 
+     */
     if ((bpnum == -1) && code == EXCEPTION_BREAKPOINT)
     {
+        unsigned char   c;
+
+        if (!DEBUG_READ_MEM(&addr, &c, 1)) c = 0xCC;
         DEBUG_context.Eip++;
 	addr->off++;
+        if (c != 0xCC) return FALSE;
     }
 #endif
 
-- 
GitLab