Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-04-26 16:56:06 -0400
committerJohn Cortell2010-04-26 16:56:06 -0400
commitea7d84d9f85fbc2838c988866fa2605e61fdbf46 (patch)
tree80bfe71b541a3ebc731528d6105f82a6fb2d598c /core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
parent4aee96ae0b602b96e2cafac1381f3f00816bc96d (diff)
downloadorg.eclipse.cdt-ea7d84d9f85fbc2838c988866fa2605e61fdbf46.tar.gz
org.eclipse.cdt-ea7d84d9f85fbc2838c988866fa2605e61fdbf46.tar.xz
org.eclipse.cdt-ea7d84d9f85fbc2838c988866fa2605e61fdbf46.zip
Bug 304096: Fix interrupting Cygwin gdb for both DSF-GDB and CDI-GDB. Send a real CTRL-C; don't use 'kill -SIGINT'
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
index 097d7d2ee9c..a78ccb27227 100644
--- a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
+++ b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
@@ -44,6 +44,7 @@ typedef struct _procInfo {
HANDLE eventWait;
HANDLE eventTerminate; // signaled when Spawner.terminate() is called; more forceful terminate request (SIGTERM signal in UNIX world)
HANDLE eventKill; // signaled when Spawner.kill() is called; most forceful terminate request (SIGKILL signal in UNIX world)
+ HANDLE eventCtrlc; // signaled when Spawner.interruptCTRLC() is called; like interrupt() but sends CTRL-C in all cases, even when inferior is a Cygwin program
} procInfo_t, * pProcInfo_t;
static int procCounter = 0; // Number of running processes
@@ -75,6 +76,7 @@ typedef enum {
SIG_INT,
SIG_KILL = 9,
SIG_TERM = 15,
+ CTRLC = 1000 // special, Windows only. Sends CTRL-C in all cases, even when inferior is a Cygwin program
} signals;
extern CRITICAL_SECTION cs;
@@ -148,6 +150,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
wchar_t eventWaitName[20];
wchar_t eventTerminateName[20];
wchar_t eventKillName[20];
+ wchar_t eventCtrlcName[20];
#ifdef DEBUG_MONITOR
wchar_t buffer[1000];
#endif
@@ -220,13 +223,15 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
swprintf(eventWaitName, L"SAWait%p", pCurProcInfo);
swprintf(eventTerminateName, L"SATerm%p", pCurProcInfo);
swprintf(eventKillName, L"SAKill%p", pCurProcInfo);
+ swprintf(eventCtrlcName, L"SACtrlc%p", pCurProcInfo);
pCurProcInfo->eventBreak = CreateEventW(NULL, FALSE, FALSE, eventBreakName);
pCurProcInfo->eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
pCurProcInfo->eventTerminate = CreateEventW(NULL, FALSE, FALSE, eventTerminateName);
pCurProcInfo->eventKill = CreateEventW(NULL, FALSE, FALSE, eventKillName);
+ pCurProcInfo->eventCtrlc = CreateEventW(NULL, FALSE, FALSE, eventCtrlcName);
- swprintf(szCmdLine, L"\"%sstarter.exe\" %i %i %s %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName, eventKillName);
+ swprintf(szCmdLine, L"\"%sstarter.exe\" %i %i %s %s %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName, eventKillName, eventCtrlcName);
nPos = wcslen(szCmdLine);
// Prepare command line
@@ -699,6 +704,11 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise
SetEvent(pCurProcInfo -> eventBreak);
ret = (WaitForSingleObject(pCurProcInfo -> eventWait, 100) == WAIT_OBJECT_0);
break;
+ case CTRLC:
+ ResetEvent(pCurProcInfo -> eventWait);
+ SetEvent(pCurProcInfo -> eventCtrlc);
+ ret = (WaitForSingleObject(pCurProcInfo -> eventWait, 100) == WAIT_OBJECT_0);
+ break;
default:
break;
}
@@ -861,6 +871,12 @@ void cleanUpProcBlock(pProcInfo_t pCurProcInfo)
pCurProcInfo -> eventKill = 0;
}
+ if(0 != pCurProcInfo -> eventCtrlc)
+ {
+ CloseHandle(pCurProcInfo -> eventCtrlc);
+ pCurProcInfo -> eventCtrlc = 0;
+ }
+
pCurProcInfo -> pid = 0;
}

Back to the top