diff -ru3 bochs-2.1.pre3/bochs.h bochs-2.1.pre3.patched/bochs.h
--- bochs-2.1.pre3/bochs.h	2003-11-28 09:07:25.000000000 -0600
+++ bochs-2.1.pre3.patched/bochs.h	2004-01-31 17:06:29.000000000 -0600
@@ -451,6 +451,9 @@
 #ifdef MAGIC_BREAKPOINT
   bx_bool magic_break_enabled;
 #endif /* MAGIC_BREAKPOINT */
+#ifdef BX_GDBSTUB
+  bx_bool gdbstub_enabled;
+#endif
 #if BX_SUPPORT_APIC
   bx_bool apic;
   bx_bool ioapic;
diff -ru3 bochs-2.1.pre3/cpu/cpu.cc bochs-2.1.pre3.patched/cpu/cpu.cc
--- bochs-2.1.pre3/cpu/cpu.cc	2003-10-09 14:05:11.000000000 -0500
+++ bochs-2.1.pre3.patched/cpu/cpu.cc	2004-01-31 17:06:29.000000000 -0600
@@ -485,6 +485,7 @@
 
 #endif  // #if BX_DEBUGGER
 #if BX_GDBSTUB
+    if(bx_dbg.gdbstub_enabled)
     {
     unsigned int reason;
     if ((reason = bx_gdbstub_check(EIP)) != GDBSTUB_STOP_NO_REASON) {
--- bochs-2.1.pre3/main.cc	2004-02-01 11:06:32.000000000 -0600
+++ bochs-2.1.pre3.patched/main.cc	2004-02-01 11:45:31.000000000 -0600
@@ -2288,65 +2288,69 @@
     BX_PANIC (("no gui module was loaded"));
     return 0;
   }
-#if BX_GDBSTUB
-  // If using gdbstub, it will take control and call
-  // bx_init_hardware() and cpu_loop()
-  bx_gdbstub_init (argc, argv);
-#elif BX_DEBUGGER
+#if BX_DEBUGGER
   // If using the debugger, it will take control and call
   // bx_init_hardware() and cpu_loop()
   bx_dbg_main(argc, argv);
 #else
-
+#if BX_GDBSTUB
+  // If using gdbstub, it will take control and call
+  // bx_init_hardware() and cpu_loop()
+  if(bx_dbg.gdbstub_enabled) {
+    bx_gdbstub_init (argc, argv);
+  } else
+#endif
+  {
 #if BX_USE_PLEX86
-  // If plex86 is requested, open plex86 device.
-  if (plex86Open() > -1)
-    using_plex86 = 1;
-  else
-    {
-      using_plex86 = 0;
-      BX_PANIC(("Failed to open plex86 device."));
-    }
+    // If plex86 is requested, open plex86 device.
+    if (plex86Open() > -1)
+      using_plex86 = 1;
+    else
+      {
+        using_plex86 = 0;
+        BX_PANIC(("Failed to open plex86 device."));
+      }
 #endif
-  
-  bx_init_hardware();
+    
+    bx_init_hardware();
 
-  if (bx_options.load32bitOSImage.OwhichOS->get ()) {
-    void bx_load32bitOSimagehack(void);
-    bx_load32bitOSimagehack();
-    }
+    if (bx_options.load32bitOSImage.OwhichOS->get ()) {
+      void bx_load32bitOSimagehack(void);
+      bx_load32bitOSimagehack();
+      }
 
-  SIM->set_init_done (1);
+    SIM->set_init_done (1);
 
-  // update headerbar buttons since drive status can change during init
-  bx_gui->update_drive_status_buttons ();
+    // update headerbar buttons since drive status can change during init
+    bx_gui->update_drive_status_buttons ();
 
-  // The set handler for mouse_enabled does not actually update the gui
-  // until init_done is set.  This forces the set handler to be called,
-  // which sets up the mouse enabled GUI-specific stuff correctly.
-  // Not a great solution but it works. BBD
-  bx_options.Omouse_enabled->set (bx_options.Omouse_enabled->get ());
+    // The set handler for mouse_enabled does not actually update the gui
+    // until init_done is set.  This forces the set handler to be called,
+    // which sets up the mouse enabled GUI-specific stuff correctly.
+    // Not a great solution but it works. BBD
+    bx_options.Omouse_enabled->set (bx_options.Omouse_enabled->get ());
 
-  if (BX_SMP_PROCESSORS == 1) {
+    if (BX_SMP_PROCESSORS == 1) {
     // only one processor, run as fast as possible by not messing with
-    // quantums and loops.
-    BX_CPU(0)->cpu_loop(1);
-        // for one processor, the only reason for cpu_loop to return is
-        // that kill_bochs_request was set by the GUI interface.
-  } else {
-    // SMP simulation: do a few instructions on each processor, then switch
-    // to another.  Increasing quantum speeds up overall performance, but
-    // reduces granularity of synchronization between processors.
-    int processor = 0;
-    int quantum = 5;
-    while (1) {
-      // do some instructions in each processor
-      BX_CPU(processor)->cpu_loop(quantum);
-      processor = (processor+1) % BX_SMP_PROCESSORS;
-          if (BX_CPU(0)->kill_bochs_request) 
-            break;
-      if (processor == 0) 
-            BX_TICKN(quantum);
+      // quantums and loops.
+      BX_CPU(0)->cpu_loop(1);
+          // for one processor, the only reason for cpu_loop to return is
+          // that kill_bochs_request was set by the GUI interface.
+    } else {
+      // SMP simulation: do a few instructions on each processor, then switch
+      // to another.  Increasing quantum speeds up overall performance, but
+      // reduces granularity of synchronization between processors.
+      int processor = 0;
+      int quantum = 5;
+      while (1) {
+        // do some instructions in each processor
+        BX_CPU(processor)->cpu_loop(quantum);
+        processor = (processor+1) % BX_SMP_PROCESSORS;
+            if (BX_CPU(0)->kill_bochs_request) 
+              break;
+        if (processor == 0) 
+              BX_TICKN(quantum);
+      }
     }
   }
 #endif
@@ -2563,6 +2567,9 @@
 #ifdef MAGIC_BREAKPOINT
   bx_dbg.magic_break_enabled = 0;
 #endif
+#ifdef BX_GDBSTUB
+  bx_dbg.gdbstub_enabled = 0;
+#endif
 
 }
 
@@ -3838,6 +3845,27 @@
         }
       }
     }
+#ifdef BX_GDBSTUB
+  else if (!strcmp(params[0], "gdbstub")) {
+    if (num_params != 2) {
+      PARSE_ERR(("%s: gdbstub directive: wrong # args.", context));
+      }
+    if (strncmp(params[1], "enabled=", 8)) {
+      PARSE_ERR(("%s: gdbstub directive malformed.", context));
+      }
+    if (params[1][8] == '0') {
+      BX_INFO(("Disabled gdbstub"));
+      bx_dbg.gdbstub_enabled = 0;
+      }
+    else if (params[1][8] == '1') {
+      BX_INFO(("Enabled gdbstub"));
+      bx_dbg.gdbstub_enabled = 1;
+      }
+    else {
+      PARSE_ERR(("%s: gdbstub directive malformed.", context));
+      }
+    }
+#endif
 #ifdef MAGIC_BREAKPOINT
   else if (!strcmp(params[0], "magic_break")) {
     if (num_params != 2) {
