This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb-6.6 mingw port hangs after Ctrl-C


Thanks fo the hints.

Here is the kludge I hacked (added/changed lines are marked with 
ChCtrlCRemote):

--- gdb-6.6-mingw/gdb/ser-mingw.c       Tue Oct 10 16:23:11 2006
+++ ../gdb-6.6-mingw/gdb/ser-mingw.c    Fri Aug 24 10:37:07 2007
@@ -886,7 +886,7 @@
 
   while (1)
     {
-      HANDLE wait_events[2];
+      HANDLE wait_events[3];//ChCtrlCRemote: HANDLE wait_events[2];
       WSANETWORKEVENTS events;
 
       SetEvent (state->have_stopped);
@@ -901,8 +901,11 @@
 
       wait_events[0] = state->stop_select;
       wait_events[1] = state->sock_event;
+      wait_events[2] = state->exit_select;//ChCtrlCRemote
 
-      event_index = WaitForMultipleObjects (2, wait_events, FALSE, 
INFINITE);
+      event_index = WaitForMultipleObjects (3, wait_events, FALSE, 
INFINITE);//ChCtrlCRemote: event_index = WaitForMultipleObjects (2, 
wait_events, FALSE, INFINITE);
+      if (event_index-WAIT_OBJECT_0==2)//ChCtrlCRemote
+        return 0;//ChCtrlCRemote
 
       if (event_index == WAIT_OBJECT_0
          || WaitForSingleObject (state->stop_select, 0) == WAIT_OBJECT_0)
--- gdb-6.6-mingw/gdb/ser-base.c        Fri Feb 10 23:01:43 2006
+++ ../gdb-6.6-mingw/gdb/ser-base.c     Fri Aug 24 10:34:16 2007
@@ -178,6 +178,11 @@
   reschedule (scb);
 }
 
+extern HANDLE evt_stop_wait;//ChCtrlCRemote
+#include <exceptions.h>//ChCtrlCRemote
+#include <target.h>//ChCtrlCRemote
+#define DATA_BUFSIZE 4096//ChCtrlCRemote
+
 /* Wait for input on scb, with timeout seconds.  Returns 0 on success,
    otherwise SERIAL_TIMEOUT or SERIAL_ERROR. */
 
@@ -271,6 +276,13 @@
          status = SERIAL_TIMEOUT;
          break;
        }
+
+      if 
(WaitForSingleObject(evt_stop_wait,0)==WAIT_OBJECT_0)//ChCtrlCRemote
+      {//ChCtrlCRemote
+          target_mourn_inferior ();//ChCtrlCRemote
+          deprecated_throw_reason (RETURN_QUIT);//ChCtrlCRemote
+      }//ChCtrlCRemote
+ 
     }
 
   if (status < 0)
--- gdb-6.6-mingw/gdb/remote.c  Tue Nov 14 22:40:19 2006
+++ ../gdb-6.6-mingw/gdb/remote.c       Fri Aug 24 10:32:59 2007
 /* Ask the user what to do when an interrupt is received.  */
+#include <windows.h>//ChCtrlCRemote
+HANDLE evt_stop_wait=0;//ChCtrlCRemote
 
 static void
 interrupt_query (void)
@@ -2907,6 +2912,8 @@
   if (query ("Interrupted while waiting for the program.\n\
 Give up (and stop debugging it)? "))
     {
+      SetEvent(evt_stop_wait);//ChCtrlCRemote
+      return;//ChCtrlCRemote
       target_mourn_inferior ();
       deprecated_throw_reason (RETURN_QUIT);
     }
@@ -6144,6 +6151,8 @@
 void
 _initialize_remote (void)
 {
+  evt_stop_wait=CreateEvent(NULL,FALSE,FALSE,NULL);//ChCtrlCRemote
+
   struct remote_state *rs;
 
   /* architecture specific data */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]