예제 #1
0
void PlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
{
    if (response.resultClass == GdbResultDone) {
        // [some leading stdout here]
        // >&"        Entry point: 0x80831f0  0x08048134 - 0x08048147 is .interp\n"
        // [some trailing stdout here]
        QString msg = _(response.data.findChild("consolestreamoutput").data());
        QRegExp needle(_("\\bEntry point: 0x([0-9a-f]+)\\b"));
        if (needle.indexIn(msg) != -1) {
            m_engine->m_entryPoint =
                    "0x" + needle.cap(1).toLatin1().rightJustified(sizeof(void *) * 2, '0');
            m_engine->postCommand(_("tbreak *0x") + needle.cap(1));
            // Do nothing here - inferiorPrepared handles the sequencing.
        } else {
            emit inferiorStartFailed(_("Parsing start address failed"));
        }
    } else if (response.resultClass == GdbResultError) {
        emit inferiorStartFailed(_("Fetching start address failed"));
    }
}
예제 #2
0
void PlainGdbAdapter::handleExecRun(const GdbResponse &response)
{
    if (response.resultClass == GdbResultRunning) {
        QTC_ASSERT(state() == InferiorRunning, qDebug() << state());
        debugMessage(_("INFERIOR STARTED"));
        showStatusMessage(msgInferiorStarted());
    } else {
        QTC_ASSERT(state() == InferiorRunningRequested, qDebug() << state());
        const QString &msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
        //QTC_ASSERT(status() == InferiorRunning, /**/);
        //interruptInferior();
        emit inferiorStartFailed(msg);
    }
}
void RemoteGdbAdapter::handleTargetRemote(const GdbResponse &record)
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
    if (record.resultClass == GdbResultDone) {
        setState(InferiorStopped);
        // gdb server will stop the remote application itself.
        debugMessage(_("INFERIOR STARTED"));
        showStatusMessage(msgAttachedToStoppedInferior());
        emit inferiorPrepared();
    } else {
        // 16^error,msg="hd:5555: Connection timed out."
        QString msg = msgConnectRemoteServerFailed(
                          QString::fromLocal8Bit(record.data.findChild("msg").data()));
        emit inferiorStartFailed(msg);
    }
}
예제 #4
0
void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
    if (response.resultClass == GdbResultDone) {
#ifdef Q_OS_LINUX
        // Old gdbs do not announce the PID for programs without pthreads.
        // Note that successfully preloading the debugging helpers will
        // automatically load pthreads, so this will be unnecessary.
        if (m_engine->m_gdbVersion < 70000)
            m_engine->postCommand(_("info target"), CB(handleInfoTarget));
#endif
        emit inferiorPrepared();
    } else {
        QString msg = tr("Starting executable failed:\n") +
            QString::fromLocal8Bit(response.data.findChild("msg").data());
        emit inferiorStartFailed(msg);
    }
}
void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
    if (response.resultClass == GdbResultDone) {
        //m_breakHandler->clearBreakMarkers();

        // "target remote" does three things:
        //     (1) connects to the gdb server
        //     (2) starts the remote application
        //     (3) stops the remote application (early, e.g. in the dynamic linker)
        QString channel = startParameters().remoteChannel;
        m_engine->postCommand("target remote " + channel.toLatin1(),
                              CB(handleTargetRemote));
    } else {
        QString msg = tr("Starting remote executable failed:\n");
        msg += QString::fromLocal8Bit(response.data.findChild("msg").data());
        emit inferiorStartFailed(msg);
    }
}