From 2a8c5da0c85b1eeffde3af09c38e9cc7f7daa1cc Mon Sep 17 00:00:00 2001
From: Ulrich Weigand <weigand@informatik.uni-erlangen.de>
Date: Sun, 11 Apr 1999 17:13:43 +0000
Subject: [PATCH] Use CLIENT_DebuggerRequest to freeze/unfreeze threads.

---
 debugger/dbg.y | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/debugger/dbg.y b/debugger/dbg.y
index aabfa8e1b7e..3d90b995bb2 100644
--- a/debugger/dbg.y
+++ b/debugger/dbg.y
@@ -25,6 +25,7 @@
 #include "debugger.h"
 #include "neexe.h"
 #include "process.h"
+#include "server.h"
 #include "main.h"
 #include "expr.h"
 #include "user.h"
@@ -416,6 +417,7 @@ void mode_command(int newmode)
 static void DEBUG_Main( int signal )
 {
     static int loaded_symbols = 0;
+    static BOOL frozen = FALSE;
     static BOOL in_debugger = FALSE;
     char SymbolTableFile[256];
     int newmode;
@@ -438,6 +440,12 @@ static void DEBUG_Main( int signal )
     {
         loaded_symbols++;
 
+        if ( !frozen )
+        {
+            CLIENT_DebuggerRequest( DEBUGGER_FREEZE_ALL );
+            frozen = TRUE;
+        }
+
 	/*
 	 * Initialize the type handling stuff.
 	 */
@@ -491,6 +499,12 @@ static void DEBUG_Main( int signal )
 
         GlobalUnlock16( GetCurrentTask() );
 
+        if ( !frozen )
+        {
+            CLIENT_DebuggerRequest( DEBUGGER_FREEZE_ALL );
+            frozen = TRUE;
+        }
+
         /* Put the display in a correct state */
 	USER_Driver->pBeginDebugging();
 
@@ -498,8 +512,6 @@ static void DEBUG_Main( int signal )
         if (newmode != dbg_mode)
             fprintf(stderr,"In %d bit mode.\n", dbg_mode = newmode);
 
-        PROCESS_SuspendOtherThreads();
-
 	DEBUG_DoDisplay();
 
         if (signal != SIGTRAP)  /* This is a real crash, dump some info */
@@ -561,7 +573,12 @@ static void DEBUG_Main( int signal )
     if( dbg_exec_mode == EXEC_CONT )
       {
 	dbg_exec_count = 0;
-        PROCESS_ResumeOtherThreads();
+
+        if ( frozen )
+        {
+            CLIENT_DebuggerRequest( DEBUGGER_UNFREEZE_ALL );
+            frozen = FALSE;
+        }
       }
 
     in_debugger = FALSE;
-- 
GitLab