void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError) { QList<QByteArray> lines = text.split('\n'); // lines always contains at least one item lines[0].prepend(buffer); if (!lines.last().endsWith('\n')) { // incomplete line buffer = lines.last(); lines.removeLast(); } else { buffer.clear(); } QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1()); foreach (QByteArray line, lines) { if (!line.contains(pid)) continue; if (line.endsWith('\r')) line.chop(1); line.append('\n'); if (onlyError || line.startsWith("F/") || line.startsWith("E/") || line.startsWith("D/Qt") || line.startsWith("W/")) emit remoteErrorOutput(line); else emit remoteOutput(line); } }
void AndroidRunControl::start() { m_running = true; emit started(); disconnect(m_runner, 0, this, 0); connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), SLOT(handleRemoteErrorOutput(QByteArray))); connect(m_runner, SIGNAL(remoteOutput(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); connect(m_runner, SIGNAL(remoteProcessFinished(QString)), SLOT(handleRemoteProcessFinished(QString))); appendMessage(tr("Starting remote process."), Utils::NormalMessageFormat); m_runner->start(); }
void MaemoDebugSupport::startExecution() { if (m_state == Inactive) return; ASSERT_STATE(StartingRunner); if (!useGdb() && m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) { if (!setPort(m_gdbServerPort)) return; } if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { if (!setPort(m_qmlPort)) return; } if (useGdb()) { handleAdapterSetupDone(); return; } setState(StartingRemoteProcess); m_gdbserverOutput.clear(); connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this, SLOT(handleRemoteErrorOutput(QByteArray))); connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) { connect(m_runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); } const QString &remoteExe = m_runner->remoteExecutable(); QString args = m_runner->arguments(); if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) { args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) .arg(m_qmlPort); } const QString remoteCommandLine = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly ? QString::fromLocal8Bit("%1 %2 %3").arg(m_runner->commandPrefix()).arg(remoteExe).arg(args) : QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(m_runner->commandPrefix()) .arg(m_gdbServerPort).arg(remoteExe).arg(args); connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), SLOT(handleRemoteProcessFinished(qint64))); m_runner->startExecution(remoteCommandLine.toUtf8()); }