Ejemplo n.º 1
0
void GdbAttachEngine::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    // Task 254674 does not want to remove them
    //qq->breakHandler()->removeAllBreakpoints();
    handleInferiorPrepared();
}
Ejemplo n.º 2
0
void GdbTermEngine::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    const qint64 attachedPID = m_stubProc.applicationPID();
    const qint64 attachedMainThreadID = m_stubProc.applicationMainThreadID();
    notifyInferiorPid(attachedPID);
    const QString msg = (attachedMainThreadID != -1)
            ? QString::fromLatin1("Going to attach to %1 (%2)").arg(attachedPID).arg(attachedMainThreadID)
            : QString::fromLatin1("Going to attach to %1").arg(attachedPID);
    showMessage(msg, LogMisc);
    handleInferiorPrepared();
}
Ejemplo n.º 3
0
void GdbPlainEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    if (response.resultClass == ResultDone) {
        handleInferiorPrepared();
    } else {
        QString msg = response.data["msg"].data();
        // Extend the message a bit in unknown cases.
        if (!msg.endsWith("File format not recognized"))
            msg = tr("Starting executable failed:") + '\n' + msg;
        notifyInferiorSetupFailed(msg);
    }
}
void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &record)
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    if (record.resultClass == GdbResultDone) {
        // gdb server will stop the remote application itself.
        showMessage(_("INFERIOR STARTED"));
        showMessage(msgAttachedToStoppedInferior(), StatusBar);
        handleInferiorPrepared();
    } else {
        // 16^error,msg="hd:5555: Connection timed out."
        QString msg = msgConnectRemoteServerFailed(
            QString::fromLocal8Bit(record.data.findChild("msg").data()));
        notifyInferiorSetupFailed(msg);
    }
}
Ejemplo n.º 5
0
void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
{
    CHECK_STATE(InferiorSetupRequested);
    QString core = coreFileName();
    if (response.resultClass == ResultDone) {
        showMessage(tr("Symbols found."), StatusBar);
        handleInferiorPrepared();
    } else {
        QString msg = tr("No symbols found in core file <i>%1</i>.").arg(core)
            + _(" ") + tr("This can be caused by a path length limitation "
                          "in the core file.")
            + _(" ") + tr("Try to specify the binary using the "
                          "<i>Debug->Start Debugging->Attach to Core</i> dialog.");
        notifyInferiorSetupFailed(msg);
    }
}
Ejemplo n.º 6
0
void GdbCoreEngine::handleTargetCore(const GdbResponse &response)
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    if (response.resultClass == GdbResultDone) {
        showMessage(tr("Attached to core."), StatusBar);
        handleInferiorPrepared();
        // Due to the auto-solib-add off setting, we don't have any
        // symbols yet. Load them in order of importance.
        reloadStack(true);
        reloadModulesInternal();
        postCommand("p 5", CB(handleRoundTrip));
        return;
    }
    QString msg = tr("Attach to core \"%1\" failed:")
        .arg(startParameters().coreFile)
        + QLatin1Char('\n')
        + QString::fromLocal8Bit(response.data["msg"].data());
    notifyInferiorSetupFailed(msg);
}
Ejemplo n.º 7
0
void GdbAttachEngine::handleAttach(const GdbResponse &response)
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    switch (response.resultClass) {
    case GdbResultDone:
    case GdbResultRunning:
        showMessage(_("INFERIOR ATTACHED"));
        showMessage(msgAttachedToStoppedInferior(), StatusBar);
        handleInferiorPrepared();
        break;
    case GdbResultError:
        if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
            notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
            break;
        }
        // if msg != "ptrace: ..." fall through
    default:
        QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
        notifyInferiorSetupFailed(msg);
    }
}
void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
{
    QTC_ASSERT(m_isQnxGdb, qDebug() << m_isQnxGdb);
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    if (response.resultClass == GdbResultDone) {
        // gdb server will stop the remote application itself.
        showMessage(_("INFERIOR STARTED"));
        showMessage(msgAttachedToStoppedInferior(), StatusBar);

        const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
        if (pid > -1) {
            postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
        } else {
            handleInferiorPrepared();
        }
    } else {
        // 16^error,msg="hd:5555: Connection timed out."
        QString msg = msgConnectRemoteServerFailed(
            QString::fromLocal8Bit(response.data.findChild("msg").data()));
        notifyInferiorSetupFailed(msg);
    }
}
Ejemplo n.º 9
0
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;
    }
}