Boot2Qt: Simplify runner setup

Change-Id: I86381c659eaf047fd3207c534140ad427e2770e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2024-10-01 16:57:20 +02:00
parent 5da4a80239
commit 94b63ad3b4

View File

@@ -30,9 +30,7 @@ namespace Qdb::Internal {
class QdbDeviceInferiorRunner : public RunWorker class QdbDeviceInferiorRunner : public RunWorker
{ {
public: public:
QdbDeviceInferiorRunner(RunControl *runControl, QdbDeviceInferiorRunner(RunControl *runControl, QmlDebug::QmlDebugServicesPreset qmlServices)
bool usePerf, bool useGdbServer, bool useQmlServer,
QmlDebug::QmlDebugServicesPreset qmlServices)
: RunWorker(runControl), : RunWorker(runControl),
m_qmlServices(qmlServices) m_qmlServices(qmlServices)
{ {
@@ -47,15 +45,6 @@ public:
connect(&m_launcher, &Process::readyReadStandardError, this, [this] { connect(&m_launcher, &Process::readyReadStandardError, this, [this] {
appendMessage(m_launcher.readAllStandardError(), StdErrFormat); appendMessage(m_launcher.readAllStandardError(), StdErrFormat);
}); });
if (useGdbServer)
runControl->requestDebugChannel();
if (useQmlServer)
runControl->requestQmlChannel();
if (usePerf)
runControl->requestPerfChannel();
} }
void start() override void start() override
@@ -143,8 +132,6 @@ public:
private: private:
void start() override; void start() override;
void stop() override; void stop() override;
QdbDeviceInferiorRunner *m_debuggee = nullptr;
}; };
QdbDeviceDebugSupport::QdbDeviceDebugSupport(RunControl *runControl) QdbDeviceDebugSupport::QdbDeviceDebugSupport(RunControl *runControl)
@@ -152,11 +139,15 @@ QdbDeviceDebugSupport::QdbDeviceDebugSupport(RunControl *runControl)
{ {
setId("QdbDeviceDebugSupport"); setId("QdbDeviceDebugSupport");
m_debuggee = new QdbDeviceInferiorRunner(runControl, false, isCppDebugging(), isQmlDebugging(), if (isCppDebugging())
QmlDebug::QmlDebuggerServices); runControl->requestDebugChannel();
addStartDependency(m_debuggee); if (isQmlDebugging())
runControl->requestQmlChannel();
m_debuggee->addStopDependency(this); auto debuggee = new QdbDeviceInferiorRunner(runControl, QmlDebug::QmlDebuggerServices);
addStartDependency(debuggee);
debuggee->addStopDependency(this);
} }
void QdbDeviceDebugSupport::start() void QdbDeviceDebugSupport::start()
@@ -187,12 +178,6 @@ class QdbDeviceQmlToolingSupport final : public RunWorker
{ {
public: public:
explicit QdbDeviceQmlToolingSupport(RunControl *runControl); explicit QdbDeviceQmlToolingSupport(RunControl *runControl);
private:
void start() override;
QdbDeviceInferiorRunner *m_runner = nullptr;
RunWorker *m_worker = nullptr;
}; };
QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl) QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
@@ -200,21 +185,15 @@ QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
{ {
setId("QdbDeviceQmlToolingSupport"); setId("QdbDeviceQmlToolingSupport");
runControl->requestQmlChannel();
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
m_runner = new QdbDeviceInferiorRunner(runControl, false, false, true, services); auto runner = new QdbDeviceInferiorRunner(runControl, services);
addStartDependency(m_runner); addStartDependency(runner);
addStopDependency(m_runner); addStopDependency(runner);
m_worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); auto worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
m_worker->addStartDependency(this); worker->addStartDependency(this);
addStopDependency(m_worker); addStopDependency(worker);
}
void QdbDeviceQmlToolingSupport::start()
{
QTC_ASSERT(usesQmlChannel(), reportFailure({}));
m_worker->recordData("QmlServerUrl", qmlChannel());
reportStarted();
} }
// QdbDevicePerfProfilerSupport // QdbDevicePerfProfilerSupport
@@ -226,8 +205,6 @@ public:
private: private:
void start() override; void start() override;
QdbDeviceInferiorRunner *m_profilee = nullptr;
}; };
QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runControl) QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runControl)
@@ -235,10 +212,10 @@ QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runContro
{ {
setId("QdbDevicePerfProfilerSupport"); setId("QdbDevicePerfProfilerSupport");
m_profilee = new QdbDeviceInferiorRunner(runControl, true, false, false, runControl->requestPerfChannel();
QmlDebug::NoQmlDebugServices); auto profilee = new QdbDeviceInferiorRunner(runControl, QmlDebug::NoQmlDebugServices);
addStartDependency(m_profilee); addStartDependency(profilee);
addStopDependency(m_profilee); addStopDependency(profilee);
} }
void QdbDevicePerfProfilerSupport::start() void QdbDevicePerfProfilerSupport::start()