Boot2Qt: Replace last occurrence of ApplicationLauncher

Change-Id: I6fc7fd9ac1b44110a8a2247412f6a432e043a69e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-05-05 12:45:39 +02:00
parent ba97c741c8
commit 80eac74106

View File

@@ -34,6 +34,7 @@
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcprocess.h>
#include <utils/url.h> #include <utils/url.h>
using namespace Debugger; using namespace Debugger;
@@ -55,12 +56,16 @@ public:
{ {
setId("QdbDebuggeeRunner"); setId("QdbDebuggeeRunner");
connect(&m_launcher, &ApplicationLauncher::started, connect(&m_launcher, &QtcProcess::started, this, &RunWorker::reportStarted);
this, &RunWorker::reportStarted); connect(&m_launcher, &QtcProcess::finished, this, &RunWorker::reportStopped);
connect(&m_launcher, &ApplicationLauncher::finished,
this, &RunWorker::reportStopped); connect(&m_launcher, &QtcProcess::readyReadStandardOutput, [this] {
connect(&m_launcher, &ApplicationLauncher::appendMessage, appendMessage(QString::fromUtf8(m_launcher.readAllStandardOutput()), StdOutFormat);
this, &RunWorker::appendMessage); });
connect(&m_launcher, &QtcProcess::readyReadStandardError, [this] {
appendMessage(QString::fromUtf8(m_launcher.readAllStandardError()), StdErrFormat);
});
m_portsGatherer = new DebugServerPortsGatherer(runControl); m_portsGatherer = new DebugServerPortsGatherer(runControl);
m_portsGatherer->setUseGdbServer(useGdbServer || usePerf); m_portsGatherer->setUseGdbServer(useGdbServer || usePerf);
m_portsGatherer->setUseQmlServer(useQmlServer); m_portsGatherer->setUseQmlServer(useQmlServer);
@@ -82,14 +87,17 @@ public:
Runnable r = runnable(); Runnable r = runnable();
QString args; CommandLine cmd;
cmd.setExecutable(device()->mapToGlobalPath(FilePath::fromString(Constants::AppcontrollerFilepath)));
if (m_useGdbServer) { if (m_useGdbServer) {
args.append(" --debug-gdb"); cmd.addArg("--debug-gdb");
lowerPort = upperPort = gdbServerPort; lowerPort = upperPort = gdbServerPort;
} }
if (m_useQmlServer) { if (m_useQmlServer) {
args.append(" --debug-qml --qml-debug-services "); cmd.addArg("--debug-qml");
args.append(QmlDebug::qmlDebugServices(m_qmlServices)); cmd.addArg("--qml-debug-services");
cmd.addArg(QmlDebug::qmlDebugServices(m_qmlServices));
lowerPort = upperPort = qmlServerPort; lowerPort = upperPort = qmlServerPort;
} }
if (m_useGdbServer && m_useQmlServer) { if (m_useGdbServer && m_useQmlServer) {
@@ -106,24 +114,21 @@ public:
QString args = Utils::transform(perfRecordArgs.toStringList(), [](QString arg) { QString args = Utils::transform(perfRecordArgs.toStringList(), [](QString arg) {
return arg.replace(',', ",,"); return arg.replace(',', ",,");
}).join(','); }).join(',');
args.append(QString(" --profile-perf %1").arg(args)); cmd.addArg("--profile-perf");
cmd.addArg(args);
lowerPort = upperPort = perfPort; lowerPort = upperPort = perfPort;
} }
args.append(QString(" --port-range %1-%2 ").arg(lowerPort).arg(upperPort)); cmd.addArg("--port-range");
// FIXME: Breaks with spaces! cmd.addArg(QString("%1-%2").arg(lowerPort).arg(upperPort));
args.append(r.command.executable().toString()); cmd.addCommandLineAsArgs(r.command);
args.append(" ");
args.append(r.command.arguments());
r.command.setArguments(args); m_launcher.setCommand(cmd);
r.command.setExecutable(FilePath::fromString(Constants::AppcontrollerFilepath)); m_launcher.setWorkingDirectory(r.workingDirectory);
r.device = device(); m_launcher.setEnvironment(r.environment);
m_launcher.setRunnable(r);
m_launcher.start(); m_launcher.start();
} }
void stop() override { m_launcher.stop(); } void stop() override { m_launcher.close(); }
private: private:
Debugger::DebugServerPortsGatherer *m_portsGatherer = nullptr; Debugger::DebugServerPortsGatherer *m_portsGatherer = nullptr;
@@ -131,7 +136,7 @@ private:
bool m_useGdbServer; bool m_useGdbServer;
bool m_useQmlServer; bool m_useQmlServer;
QmlDebug::QmlDebugServicesPreset m_qmlServices; QmlDebug::QmlDebugServicesPreset m_qmlServices;
ApplicationLauncher m_launcher; QtcProcess m_launcher;
}; };