This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb-6.6 mingw port hangs after Ctrl-C
- From: Roland Puntaier <Roland dot Puntaier at br-automation dot com>
- To: gdb at sourceware dot org
- Date: Fri, 24 Aug 2007 10:50:45 +0200
- Subject: 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
@@ -1975,6 +1975,9 @@
memcpy (offs, symfile_objfile->section_offsets,
SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections));
+ text_addr = text_addr-symfile_objfile->sections[SECT_OFF_TEXT
(symfile_objfile)].addr;/*BUR*/
+ data_addr = data_addr-symfile_objfile->sections[SECT_OFF_DATA
(symfile_objfile)].addr;/*BUR*/
+
offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
/* This is a temporary kludge to force data and bss to use the same
offsets
@@ -2898,6 +2901,8 @@
}
/* 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 */