コード例 #1
0
void LldbEngineHost::nuke()
{
    stderrReady();
    showMessage(QLatin1String("Nuke engaged. Bug in Engine/IPC or incompatible IPC versions. "), LogError);
    showStatusMessage(tr("Fatal engine shutdown. Consult debugger log for details."));
    m_guestProcess->terminate();
    m_guestProcess->kill();
    notifyEngineSpontaneousShutdown();
}
コード例 #2
0
LldbEngineHost::LldbEngineHost(const DebuggerStartParameters &startParameters)
    :IPCEngineHost(startParameters), m_ssh(0)
{
    showMessage(QLatin1String("setting up coms"));
    setObjectName(QLatin1String("LLDBEngine"));

    if (startParameters.startMode == StartRemoteEngine)
    {
        m_guestProcess = 0;
        QSsh::SshRemoteProcessRunner * const runner = new QSsh::SshRemoteProcessRunner;
        connect (runner, SIGNAL(connectionError(QSsh::SshError)),
                 this, SLOT(sshConnectionError(QSsh::SshError)));
        runner->run(startParameters.serverStartScript.toUtf8(), startParameters.connParams);
        setGuestDevice(new SshIODevice(runner));
    } else  {
        m_guestProcess = new QProcess(this);

        connect(m_guestProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
                this, SLOT(finished(int,QProcess::ExitStatus)));

        connect(m_guestProcess, SIGNAL(readyReadStandardError()), this,
                SLOT(stderrReady()));


        QString a = Core::ICore::resourcePath() + QLatin1String("/qtcreator-lldb");
        if (getenv("QTC_LLDB_GUEST") != 0)
            a = QString::fromLocal8Bit(getenv("QTC_LLDB_GUEST"));

        showStatusMessage(QString(QLatin1String("starting %1")).arg(a));

        m_guestProcess->start(a, QStringList(), QIODevice::ReadWrite | QIODevice::Unbuffered);
        m_guestProcess->setReadChannel(QProcess::StandardOutput);

        if (!m_guestProcess->waitForStarted()) {
            showStatusMessage(tr("qtcreator-lldb failed to start: %1").arg(m_guestProcess->errorString()));
            notifyEngineSpontaneousShutdown();
            return;
        }

        setGuestDevice(m_guestProcess);
    }
}
コード例 #3
0
ファイル: ipcenginehost.cpp プロジェクト: pcacjr/qt-creator
void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
{
    switch (f) {
        default: {
            showMessage(QLatin1String("IPC Error: unhandled id in guest to host call"));
            const QString logMessage = tr("Fatal engine shutdown. Incompatible binary or IPC error.");
            showMessage(logMessage, LogError);
            showStatusMessage(logMessage);
    }
            nuke();
            break;
        case IPCEngineGuest::NotifyEngineSetupOk:
            notifyEngineSetupOk();
            break;
        case IPCEngineGuest::NotifyEngineSetupFailed:
            notifyEngineSetupFailed();
            break;
        case IPCEngineGuest::NotifyEngineRunFailed:
            notifyEngineRunFailed();
            break;
        case IPCEngineGuest::NotifyInferiorSetupOk:
            attemptBreakpointSynchronization();
            notifyInferiorSetupOk();
            break;
        case IPCEngineGuest::NotifyInferiorSetupFailed:
            notifyInferiorSetupFailed();
            break;
        case IPCEngineGuest::NotifyEngineRunAndInferiorRunOk:
            notifyEngineRunAndInferiorRunOk();
            break;
        case IPCEngineGuest::NotifyEngineRunAndInferiorStopOk:
            notifyEngineRunAndInferiorStopOk();
            break;
        case IPCEngineGuest::NotifyInferiorRunRequested:
            notifyInferiorRunRequested();
            break;
        case IPCEngineGuest::NotifyInferiorRunOk:
            notifyInferiorRunOk();
            break;
        case IPCEngineGuest::NotifyInferiorRunFailed:
            notifyInferiorRunFailed();
            break;
        case IPCEngineGuest::NotifyInferiorStopOk:
            notifyInferiorStopOk();
            break;
        case IPCEngineGuest::NotifyInferiorSpontaneousStop:
            notifyInferiorSpontaneousStop();
            break;
        case IPCEngineGuest::NotifyInferiorStopFailed:
            notifyInferiorStopFailed();
            break;
        case IPCEngineGuest::NotifyInferiorExited:
            notifyInferiorExited();
            break;
        case IPCEngineGuest::NotifyInferiorShutdownOk:
            notifyInferiorShutdownOk();
            break;
        case IPCEngineGuest::NotifyInferiorShutdownFailed:
            notifyInferiorShutdownFailed();
            break;
        case IPCEngineGuest::NotifyEngineSpontaneousShutdown:
            notifyEngineSpontaneousShutdown();
            break;
        case IPCEngineGuest::NotifyEngineShutdownOk:
            notifyEngineShutdownOk();
            break;
        case IPCEngineGuest::NotifyEngineShutdownFailed:
            notifyEngineShutdownFailed();
            break;
        case IPCEngineGuest::NotifyInferiorIll:
            notifyInferiorIll();
            break;
        case IPCEngineGuest::NotifyEngineIll:
            notifyEngineIll();
            break;
        case IPCEngineGuest::NotifyInferiorPid:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 pid;
                s >> pid;
                notifyInferiorPid(pid);
            }
            break;
        case IPCEngineGuest::ShowStatusMessage:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                QString msg;
                qint64 timeout;
                s >> msg;
                s >> timeout;
                showStatusMessage(msg, timeout);
            }
            break;
        case IPCEngineGuest::ShowMessage:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                QString msg;
                qint16 channel;
                qint64 timeout;
                s >> msg;
                s >> channel;
                s >> timeout;
                showMessage(msg, channel, timeout);
            }
            break;
        case IPCEngineGuest::CurrentFrameChanged:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 token;
                s >> token;

                resetLocation();
                StackHandler *sh = stackHandler();
                sh->setCurrentIndex(token);
                if (!sh->currentFrame().isUsable() || QFileInfo(sh->currentFrame().file).exists())
                    gotoLocation(Location(sh->currentFrame(), true));
                else if (!m_sourceAgents.contains(sh->currentFrame().file))
                    fetchFrameSource(token);
                foreach(SourceAgent *agent, m_sourceAgents.values())
                    agent->updateLocationMarker();
            }
            break;
        case IPCEngineGuest::CurrentThreadChanged:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 token;
                s >> token;
                threadsHandler()->setCurrentThreadId(token);
            }
            break;
        case IPCEngineGuest::ListFrames:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                StackFrames frames;
                s >> frames;
                stackHandler()->setFrames(frames);
            }
            break;
        case IPCEngineGuest::ListThreads:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                Threads threads;
                s >> threads;
                threadsHandler()->setThreads(threads);
            }
            break;
        case IPCEngineGuest::Disassembled:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                quint64 pc;
                DisassemblerLines lines;
                s >> pc;
                s >> lines;
                DisassemblerAgent *view = m_frameToDisassemblerAgent.take(pc);
                if (view)
                    view->setContents(lines);
            }
            break;
        case IPCEngineGuest::UpdateWatchData:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                bool fullCycle;
                qint64 count;
                QList<WatchData> wd;
                s >> fullCycle;
                s >> count;
                for (qint64 i = 0; i < count; ++i) {
                    WatchData d;
                    s >> d;
                    wd.append(d);
                }
                WatchHandler *wh = watchHandler();
                if (!wh)
                    break;
                wh->beginCycle(fullCycle);
                wh->insertBulkData(wd);
                wh->endCycle(fullCycle);
            }
            break;
        case IPCEngineGuest::NotifyAddBreakpointOk:
            {
                attemptBreakpointSynchronization();
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointInsertOk(id);
            }
            break;
        case IPCEngineGuest::NotifyAddBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointInsertFailed(id);
            }
            break;
        case IPCEngineGuest::NotifyRemoveBreakpointOk:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointRemoveOk(id);
            }
            break;
        case IPCEngineGuest::NotifyRemoveBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointRemoveFailed(id);
            }
            break;
        case IPCEngineGuest::NotifyChangeBreakpointOk:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointChangeOk(id);
            }
            break;
        case IPCEngineGuest::NotifyChangeBreakpointFailed:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                s >> id;
                breakHandler()->notifyBreakpointChangeFailed(id);
            }
            break;
        case IPCEngineGuest::NotifyBreakpointAdjusted:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                BreakpointId id;
                BreakpointParameters d;
                s >> id >> d;
                breakHandler()->notifyBreakpointAdjusted(id, d);
            }
            break;
        case IPCEngineGuest::FrameSourceFetched:
            {
                QDataStream s(payload);
                SET_NATIVE_BYTE_ORDER(s);
                qint64 token;
                QString path;
                QString source;
                s >> token >> path >> source;
                SourceAgent *agent = new SourceAgent(this);
                agent->setSourceProducerName(startParameters().connParams.host);
                agent->setContent(path, source);
                m_sourceAgents.insert(path, agent);
                agent->updateLocationMarker();
            }
            break;
    }
}