Only debug 1 thread at a time
Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c

Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c
--- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c	2005-11-14 15:35:41 UTC (rev 19224)
+++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c	2005-11-14 16:36:26 UTC (rev 19225)
@@ -103,6 +103,8 @@
 static PETHREAD GspDbgThread;
 static PETHREAD GspEnumThread;
 
+static FAST_MUTEX GspLock;
+
 extern LIST_ENTRY PsActiveProcessHead;
 KD_PORT_INFORMATION GdbPortInfo = { 2, 115200, 0 }; /* FIXME hardcoded for COM2, 115200 baud */
 
@@ -1137,6 +1139,9 @@
     }
   else
     {
+      /* Can only debug 1 thread at a time... */
+      ExAcquireFastMutex(&GspLock);
+
       /* Make sure we're debugging the current thread. */
       if (NULL != GspDbgThread)
         {
@@ -1390,6 +1395,7 @@
                     GspDbgThread = NULL;
                   }
 
+                ExReleaseFastMutex(&GspLock);
                 return kdContinue;
                 break;
               }
@@ -1538,6 +1544,8 @@
 
   if (BootPhase == 0)
     {
+      ExInitializeFastMutex(&GspLock);
+
       /* Write out the functions that we support for now */
       WrapperTable->KdpInitRoutine = KdpGdbStubInit;
       WrapperTable->KdpPrintRoutine = KdpGdbDebugPrint;