void GdbRemoteServerEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); const QString remoteExecutable = startParameters().remoteExecutable; if (!remoteExecutable.isEmpty()) { // Cannot use -exec-run for QNX gdb 7.4 as it does not support path parameter for the MI call const bool useRun = m_isQnxGdb && m_gdbVersion > 70300; const QByteArray command = useRun ? "run" : "-exec-run"; postCommand(command + " " + remoteExecutable.toLocal8Bit(), GdbEngine::RunRequest, CB(handleExecRun)); } else { notifyEngineRunAndInferiorStopOk(); continueInferiorInternal(); } }
void GdbTermEngine::handleStubAttached(const DebuggerResponse &response) { // InferiorStopOk can happen if the "*stopped" in response to the // 'attach' comes in before its '^done' QTC_ASSERT(state() == EngineRunRequested || state() == InferiorStopOk, qDebug() << state()); switch (response.resultClass) { case ResultDone: case ResultRunning: if (runParameters().toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS) { QString errorMessage; // Resume thread that was suspended by console stub process (see stub code). const qint64 mainThreadId = m_stubProc.applicationMainThreadID(); if (winResumeThread(mainThreadId, &errorMessage)) { showMessage(QString::fromLatin1("Inferior attached, thread %1 resumed"). arg(mainThreadId), LogMisc); } else { showMessage(QString::fromLatin1("Inferior attached, unable to resume thread %1: %2"). arg(mainThreadId).arg(errorMessage), LogWarning); } notifyEngineRunAndInferiorStopOk(); continueInferiorInternal(); } else { showMessage(_("INFERIOR ATTACHED AND RUNNING")); //notifyEngineRunAndInferiorRunOk(); // Wait for the upcoming *stopped and handle it there. } break; case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { showMessage(msgPtraceError(runParameters().startMode)); notifyEngineRunFailed(); break; } showMessage(QString::fromLocal8Bit(response.data["msg"].data())); notifyEngineIll(); break; default: showMessage(QString::fromLatin1("Invalid response %1").arg(response.resultClass)); notifyEngineIll(); break; } }
void GdbAttachEngine::handleAttach(const DebuggerResponse &response) { QTC_ASSERT(state() == EngineRunRequested || state() == InferiorStopOk, qDebug() << state()); switch (response.resultClass) { case ResultDone: case ResultRunning: showMessage(_("INFERIOR ATTACHED")); if (state() == EngineRunRequested) { // Happens e.g. for "Attach to unstarted application" // We will get a '*stopped' later that we'll interpret as 'spontaneous' // So acknowledge the current state and put a delayed 'continue' in the pipe. showMessage(tr("Attached to running application"), StatusBar); notifyEngineRunAndInferiorRunOk(); } else { // InferiorStopOk, e.g. for "Attach to running application". // The *stopped came in between sending the 'attach' and // receiving its '^done'. if (runParameters().continueAfterAttach) continueInferiorInternal(); } break; case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { QString msg = msgPtraceError(runParameters().startMode); showStatusMessage(tr("Failed to attach to application: %1").arg(msg)); Core::AsynchronousMessageBox::warning(tr("Debugger Error"), msg); notifyEngineIll(); break; } // if msg != "ptrace: ..." fall through default: showStatusMessage(tr("Failed to attach to application: %1") .arg(QString::fromLocal8Bit(response.data["msg"].data()))); notifyEngineIll(); } }
void GdbTermEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); notifyEngineRunAndInferiorStopOk(); continueInferiorInternal(); }