void TermGdbAdapter::handleStubAttached(const GdbResponse &response) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); #ifdef Q_OS_WIN QString errorMessage; #endif // Q_OS_WIN switch (response.resultClass) { case GdbResultDone: case GdbResultRunning: #ifdef Q_OS_WIN // Resume thread that was suspended by console stub process (see stub code). if (winResumeThread(m_stubProc.applicationMainThreadID(), &errorMessage)) { showMessage(QString::fromLatin1("Inferior attached, thread %1 resumed"). arg(m_stubProc.applicationMainThreadID()), LogMisc); } else { showMessage(QString::fromLatin1("Inferior attached, unable to resume thread %1: %2"). arg(m_stubProc.applicationMainThreadID()).arg(errorMessage), LogWarning); } #else showMessage(_("INFERIOR ATTACHED")); #endif // Q_OS_WIN m_engine->handleInferiorPrepared(); #ifdef Q_OS_LINUX m_engine->postCommand("-stack-list-frames 0 0", CB(handleEntryPoint)); #endif break; case GdbResultError: m_engine->notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data.findChild("msg").data())); break; default: m_engine->notifyInferiorSetupFailed(QString::fromLatin1("Invalid response %1").arg(response.resultClass)); break; } }
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 GdbTermEngine::handleStubAttached(const GdbResponse &response) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); #ifdef Q_OS_WIN QString errorMessage; #endif // Q_OS_WIN switch (response.resultClass) { case GdbResultDone: case GdbResultRunning: #ifdef Q_OS_WIN // Resume thread that was suspended by console stub process (see stub code). if (winResumeThread(m_stubProc.applicationMainThreadID(), &errorMessage)) { showMessage(QString::fromLatin1("Inferior attached, thread %1 resumed"). arg(m_stubProc.applicationMainThreadID()), LogMisc); } else { showMessage(QString::fromLatin1("Inferior attached, unable to resume thread %1: %2"). arg(m_stubProc.applicationMainThreadID()).arg(errorMessage), LogWarning); } #else showMessage(_("INFERIOR ATTACHED")); #endif // Q_OS_WIN handleInferiorPrepared(); break; case GdbResultError: if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") { notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode)); break; } notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data.findChild("msg").data())); break; default: notifyInferiorSetupFailed(QString::fromLatin1("Invalid response %1").arg(response.resultClass)); break; } }