void TermGdbAdapter::interruptInferior() { const qint64 attachedPID = m_engine->inferiorPid(); QTC_ASSERT(attachedPID > 0, return); if (!interruptProcess(attachedPID)) showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); }
void PlainGdbAdapter::interruptInferior() { const qint64 attachedPID = m_engine->inferiorPid(); if (attachedPID <= 0) { debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED")); return; } if (!interruptProcess(attachedPID)) debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); }
void LocalPlainGdbAdapter::interruptInferior() { const qint64 attachedPID = m_engine->inferiorPid(); if (attachedPID <= 0) { showMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED")); return; } if (interruptProcess(attachedPID)) { showMessage(_("INTERRUPTED %1").arg(attachedPID)); } else { showMessage(_("CANNOT INTERRUPT %1").arg(attachedPID)); m_engine->notifyInferiorStopFailed(); } }
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise (JNIEnv * env, jobject process, jint uid, jint signal) { jint ret = 0; HANDLE hProc; pProcInfo_t pCurProcInfo = findProcInfo(uid); #ifdef DEBUG_MONITOR wchar_t buffer[100]; #endif if(NULL == pCurProcInfo) { if(SIG_INT == signal) { // Try another way return interruptProcess(uid) ; } return -1; } #ifdef DEBUG_MONITOR swprintf(buffer, _T("Spawner received signal %i for process %i\n"), signal, pCurProcInfo -> pid); OutputDebugStringW(buffer); #endif hProc = OpenProcess(SYNCHRONIZE, 0, pCurProcInfo -> pid); if(NULL == hProc) return -1; switch(signal) { case SIG_NOOP: // Wait 0 msec -just check if the process has been still running ret = ((WAIT_TIMEOUT == WaitForSingleObject(hProc, 0)) ? 0 : -1); break; case SIG_HUP: // Temporary do nothing ret = 0; break; case SIG_TERM: #ifdef DEBUG_MONITOR swprintf(buffer, _T("Spawner received TERM signal for process %i\n"), pCurProcInfo -> pid); OutputDebugStringW(buffer); #endif SetEvent(pCurProcInfo -> eventTerminate); #ifdef DEBUG_MONITOR OutputDebugStringW(_T("Spawner signaled TERM event\n")); #endif ret = 0; break; case SIG_KILL: #ifdef DEBUG_MONITOR swprintf(buffer, _T("Spawner received KILL signal for process %i\n"), pCurProcInfo -> pid); OutputDebugStringW(buffer); #endif SetEvent(pCurProcInfo -> eventKill); #ifdef DEBUG_MONITOR OutputDebugStringW(_T("Spawner signaled KILL event\n")); #endif ret = 0; break; case SIG_INT: ResetEvent(pCurProcInfo -> eventWait); 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; } CloseHandle(hProc); return ret; }