From 1ebd3c1750a9044f753eaff5e343543c1983910f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 1 Oct 2024 13:31:07 +0200 Subject: [PATCH] ProjectExplorer: Dissolve SubChannelProvider The channels can be extracted directly once the PortGatherer is finished, before the start() of the RunWorkerTree. Also, manager the one debug and one qml channel for the whole runworker tree centrally in RunControl. There is quite some potential for clean up left. Change-Id: I2d877d34958cb67aa324c9b5a6f1529872b74b16 Reviewed-by: Christian Kandeler --- src/plugins/android/androiddebugsupport.cpp | 1 - src/plugins/boot2qt/qdbdevicedebugsupport.cpp | 55 ++++----- src/plugins/debugger/debuggerruncontrol.cpp | 92 +++----------- src/plugins/debugger/debuggerruncontrol.h | 20 --- .../projectexplorerconstants.h | 1 + src/plugins/projectexplorer/runcontrol.cpp | 116 +++++++++++++++++- src/plugins/projectexplorer/runcontrol.h | 21 ++++ src/plugins/qnx/qnxdebugsupport.cpp | 14 +-- .../appmanagerruncontrol.cpp | 49 +++----- .../genericlinuxdeviceconfigurationwidget.cpp | 6 +- .../remotelinux/remotelinux_constants.h | 1 - 11 files changed, 204 insertions(+), 172 deletions(-) diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 21907120243..3414be69482 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -178,7 +178,6 @@ void AndroidDebugSupport::start() if (isQmlDebugging()) { qCDebug(androidDebugSupportLog) << "QML debugging enabled. QML server: " << m_runner->qmlServer().toDisplayString(); - setQmlServer(m_runner->qmlServer()); //TODO: Not sure if these are the right paths. if (qtVersion) addSearchDirectory(qtVersion->qmlPath()); diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp index 90584d16f96..e5808388921 100644 --- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp +++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp @@ -48,20 +48,14 @@ public: appendMessage(m_launcher.readAllStandardError(), StdErrFormat); }); - if (useGdbServer) { - m_debugChannelProvider = new SubChannelProvider(runControl); - addStartDependency(m_debugChannelProvider); - } + if (useGdbServer) + runControl->requestDebugChannel(); - if (useQmlServer) { - m_qmlChannelProvider = new SubChannelProvider(runControl); - addStartDependency(m_qmlChannelProvider); - } + if (useQmlServer) + runControl->requestQmlChannel(); - if (usePerf) { - m_perfChannelProvider = new SubChannelProvider(runControl); - addStartDependency(m_perfChannelProvider); - } + if (usePerf) + runControl->requestPerfChannel(); } void start() override @@ -72,30 +66,30 @@ public: CommandLine cmd; cmd.setExecutable(device()->filePath(Constants::AppcontrollerFilepath)); - if (m_debugChannelProvider) { + if (usesDebugChannel()) { cmd.addArg("--debug-gdb"); - lowerPort = upperPort = m_debugChannelProvider->channel().port(); + lowerPort = upperPort = debugChannel().port(); } - if (m_qmlChannelProvider) { + if (usesQmlChannel()) { cmd.addArg("--debug-qml"); cmd.addArg("--qml-debug-services"); cmd.addArg(QmlDebug::qmlDebugServices(m_qmlServices)); - lowerPort = upperPort = m_qmlChannelProvider->channel().port(); + lowerPort = upperPort = qmlChannel().port(); } - if (m_debugChannelProvider && m_qmlChannelProvider) { - lowerPort = m_debugChannelProvider->channel().port(); - upperPort = m_qmlChannelProvider->channel().port(); + if (usesDebugChannel() && usesQmlChannel()) { + lowerPort = debugChannel().port(); + upperPort = qmlChannel().port(); if (lowerPort + 1 != upperPort) { reportFailure("Need adjacent free ports for combined C++/QML debugging"); return; } } - if (m_perfChannelProvider) { + if (usesPerfChannel()) { const Store perfArgs = runControl()->settingsData(PerfProfiler::Constants::PerfSettingsId); const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString(); cmd.addArg("--profile-perf"); cmd.addArgs(recordArgs, CommandLine::Raw); - lowerPort = upperPort = m_perfChannelProvider->channel().port(); + lowerPort = upperPort = perfChannel().port(); } cmd.addArg("--port-range"); cmd.addArg(QString("%1-%2").arg(lowerPort).arg(upperPort)); @@ -115,9 +109,6 @@ private: friend class QdbDeviceQmlToolingSupport; friend class QdbDevicePerfProfilerSupport; - Debugger::SubChannelProvider *m_debugChannelProvider = nullptr; - Debugger::SubChannelProvider *m_qmlChannelProvider = nullptr; - Debugger::SubChannelProvider *m_perfChannelProvider = nullptr; QmlDebug::QmlDebugServicesPreset m_qmlServices; Process m_launcher; }; @@ -172,10 +163,10 @@ void QdbDeviceDebugSupport::start() { setStartMode(Debugger::AttachToRemoteServer); setCloseMode(KillAndExitMonitorAtClose); - if (SubChannelProvider *provider = m_debuggee->m_debugChannelProvider) - setRemoteChannel(provider->channel()); - if (SubChannelProvider *provider = m_debuggee->m_qmlChannelProvider) - setQmlServer(provider->channel()); + if (usesDebugChannel()) + setRemoteChannel(debugChannel()); + if (usesQmlChannel()) + setQmlServer(qmlChannel()); setUseContinueInsteadOfRun(true); setContinueAfterAttach(true); addSolibSearchDir("%{sysroot}/system/lib"); @@ -221,8 +212,8 @@ QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl) void QdbDeviceQmlToolingSupport::start() { - QTC_ASSERT(m_runner->m_qmlChannelProvider, reportFailure({})); - m_worker->recordData("QmlServerUrl", m_runner->m_qmlChannelProvider->channel()); + QTC_ASSERT(usesQmlChannel(), reportFailure({})); + m_worker->recordData("QmlServerUrl", qmlChannel()); reportStarted(); } @@ -252,8 +243,8 @@ QdbDevicePerfProfilerSupport::QdbDevicePerfProfilerSupport(RunControl *runContro void QdbDevicePerfProfilerSupport::start() { - QTC_ASSERT(m_profilee->m_perfChannelProvider, reportFailure({})); - runControl()->setProperty("PerfConnection", m_profilee->m_perfChannelProvider->channel()); + QTC_ASSERT(usesPerfChannel(), reportFailure({})); + runControl()->setProperty("PerfConnection", perfChannel()); reportStarted(); } diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 2f5657767c4..c1e70eeda7c 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -156,8 +156,6 @@ class DebuggerRunToolPrivate { public: QPointer coreUnpacker; - QPointer debugChannelProvider; - QPointer qmlChannelProvider; bool addQmlServerInferiorCommandLineArgumentIfNeeded = false; int snapshotCounter = 0; int engineStartsNeeded = 0; @@ -170,7 +168,6 @@ public: // DebugServer Process debuggerServerProc; - bool useDebugServer = false; Utils::ProcessHandle serverAttachPid; bool serverUseMulti = true; bool serverEssential = true; @@ -309,16 +306,12 @@ void DebuggerRunTool::setCommandsForReset(const QString &commands) { m_runParameters.commandsForReset = commands; } - void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation) + +void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation) { m_runParameters.debugInfoLocation = debugInfoLocation; } -QUrl DebuggerRunTool::qmlServer() const -{ - return m_runParameters.qmlServer; -} - void DebuggerRunTool::setQmlServer(const QUrl &qmlServer) { m_runParameters.qmlServer = qmlServer; @@ -464,11 +457,11 @@ void DebuggerRunTool::continueAfterTerminalStart() { TaskHub::clearTasks(Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); - if (d->debugChannelProvider) - setRemoteChannel(d->debugChannelProvider->channel()); + if (usesDebugChannel()) + setRemoteChannel(debugChannel()); - if (d->qmlChannelProvider) { - setQmlServer(d->qmlChannelProvider->channel()); + if (usesQmlChannel()) { + setQmlServer(qmlChannel()); if (d->addQmlServerInferiorCommandLineArgumentIfNeeded && m_runParameters.isQmlDebugging && m_runParameters.isCppDebugging()) { @@ -758,39 +751,10 @@ bool DebuggerRunTool::isQmlDebugging() const void DebuggerRunTool::setUsePortsGatherer(bool useCpp, bool useQml) { - runControl()->enablePortsGatherer(); - if (useCpp) { - QTC_ASSERT(!d->debugChannelProvider, reportFailure(); return); - d->debugChannelProvider = new SubChannelProvider(runControl()); - addStartDependency(d->debugChannelProvider); - } - if (useQml) { - QTC_ASSERT(!d->qmlChannelProvider, reportFailure(); return); - d->qmlChannelProvider = new SubChannelProvider(runControl()); - addStartDependency(d->qmlChannelProvider); - } -} - -SubChannelProvider *DebuggerRunTool::debugChannelProvider() const -{ - return d->debugChannelProvider; -} - -QUrl DebuggerRunTool::debugChannel() const -{ - QTC_ASSERT(d->debugChannelProvider, return {}); - return d->debugChannelProvider->channel(); -} - -SubChannelProvider *DebuggerRunTool::qmlChannelProvider() const -{ - return d->qmlChannelProvider; -} - -QUrl DebuggerRunTool::qmlChannel() const -{ - QTC_ASSERT(d->qmlChannelProvider, return {}); - return d->qmlChannelProvider->channel(); + if (useCpp) + runControl()->requestDebugChannel(); + if (useQml) + runControl()->requestQmlChannel(); } void DebuggerRunTool::setSolibSearchPath(const Utils::FilePaths &list) @@ -1085,26 +1049,9 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout) forwarding. */ -SubChannelProvider::SubChannelProvider(RunControl *runControl) - : RunWorker(runControl) -{ - setId("SubChannelProvider"); -} - -void SubChannelProvider::start() -{ - m_channel.setScheme(urlTcpScheme()); - if (device()->extraData(RemoteLinux::Constants::SshForwardDebugServerPort).toBool()) - m_channel.setHost("localhost"); - else - m_channel.setHost(device()->toolControlChannel(IDevice::ControlChannelHint()).host()); - m_channel.setPort(runControl()->findEndPoint().port()); - reportStarted(); -} - void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup() { - if (!d->useDebugServer) { + if (!usesDebugChannel()) { continueAfterDebugServerStart(); return; } @@ -1114,11 +1061,10 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup() CommandLine commandLine = m_runParameters.inferior.command; CommandLine cmd; - if (d->qmlChannelProvider && !d->debugChannelProvider) { + if (usesQmlChannel() && !usesDebugChannel()) { // FIXME: Case should not happen? cmd.setExecutable(commandLine.executable()); - cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, - d->qmlChannelProvider->channel())); + cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, qmlChannel())); cmd.addArgs(commandLine.arguments(), CommandLine::Raw); } else { cmd.setExecutable(device()->debugServerPath()); @@ -1162,15 +1108,15 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup() } } } - QTC_ASSERT(d->debugChannelProvider, reportFailure({})); + QTC_ASSERT(usesDebugChannel(), reportFailure({})); if (cmd.executable().baseName().contains("lldb-server")) { cmd.addArg("platform"); cmd.addArg("--listen"); - cmd.addArg(QString("*:%1").arg(d->debugChannelProvider->channel().port())); + cmd.addArg(QString("*:%1").arg(debugChannel().port())); cmd.addArg("--server"); } else if (cmd.executable().baseName() == "debugserver") { const QString ipAndPort("`echo $SSH_CLIENT | cut -d ' ' -f 1`:%1"); - cmd.addArgs(ipAndPort.arg(d->debugChannelProvider->channel().port()), CommandLine::Raw); + cmd.addArgs(ipAndPort.arg(debugChannel().port()), CommandLine::Raw); if (d->serverAttachPid.isValid()) cmd.addArgs({"--attach", QString::number(d->serverAttachPid.pid())}); @@ -1183,10 +1129,10 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup() if (d->serverAttachPid.isValid()) cmd.addArg("--attach"); - const auto port = d->debugChannelProvider->channel().port(); + const auto port = debugChannel().port(); cmd.addArg(QString(":%1").arg(port)); - if (device()->extraData(RemoteLinux::Constants::SshForwardDebugServerPort).toBool()) { + if (device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()) { QVariantHash extraData; extraData[RemoteLinux::Constants::SshForwardPort] = port; extraData[RemoteLinux::Constants::DisableSharing] = true; @@ -1216,7 +1162,7 @@ void DebuggerRunTool::startDebugServerIfNeededAndContinueStartup() void DebuggerRunTool::setUseDebugServer(ProcessHandle attachPid, bool essential, bool useMulti) { - d->useDebugServer = true; + runControl()->requestDebugChannel(); d->serverAttachPid = attachPid; d->serverEssential = essential; d->serverUseMulti = useMulti; diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 58502f162c6..4caf61112d4 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -70,7 +70,6 @@ public: void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); void setQmlServer(const QUrl &qmlServer); - QUrl qmlServer() const; // Used in GammaRay integration. void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false); @@ -82,12 +81,6 @@ public: Internal::DebuggerRunParameters &runParameters() { return m_runParameters; } - QUrl debugChannel() const; - SubChannelProvider *debugChannelProvider() const; - - QUrl qmlChannel() const; - SubChannelProvider *qmlChannelProvider() const; - protected: bool isCppDebugging() const; bool isQmlDebugging() const; @@ -129,19 +122,6 @@ private: Internal::DebuggerRunParameters m_runParameters; }; -class DEBUGGER_EXPORT SubChannelProvider : public ProjectExplorer::RunWorker -{ -public: - explicit SubChannelProvider(ProjectExplorer::RunControl *runControl); - - void start() final; - - QUrl channel() const { return m_channel; } - -private: - QUrl m_channel; -}; - class DebuggerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 8db24364cb4..a5a70ff59b9 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -224,6 +224,7 @@ const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration. // Called "RemoteLinux." for backwards compatibility const char SUPPORTS_RSYNC[] = "RemoteLinux.SupportsRSync"; const char SUPPORTS_SFTP[] = "RemoteLinux.SupportsSftp"; +const char SSH_FORWARD_DEBUGSERVER_PORT[] = "RemoteLinux.SshForwardDebugServerPort"; // UI texts PROJECTEXPLORER_EXPORT QString msgAutoDetected(); diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 0c863df0c51..14f2094c166 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -294,6 +294,13 @@ public: bool autoDelete = false; bool m_supportsReRunning = true; std::optional m_runRecipe; + + bool useDebugChannel = false; + bool useQmlChannel = false; + bool usePerfChannel = false; + QUrl debugChannel; + QUrl qmlChannel; + QUrl perfChannel; }; class RunControlPrivate : public QObject, public RunControlPrivateData @@ -349,6 +356,9 @@ public: void startTaskTree(); void checkAutoDeleteAndEmitStopped(); + void enablePortsGatherer(); + QUrl getNextChannel(); + RunControl *q; Id runMode; TaskTreeRunner m_taskTreeRunner; @@ -590,6 +600,13 @@ void RunControlPrivate::startPortsGathererIfNeededAndContinueStart() portList = device->freePorts(); q->appendMessage(Tr::tr("Found %n free ports.", nullptr, portList.count()) + '\n', NormalMessageFormat); + if (useDebugChannel) + debugChannel = getNextChannel(); + if (useQmlChannel) + qmlChannel = getNextChannel(); + if (usePerfChannel) + perfChannel = getNextChannel(); + continueStart(); } else { onWorkerFailed(nullptr, portsGatherer->errorString()); @@ -603,7 +620,26 @@ void RunControlPrivate::startPortsGathererIfNeededAndContinueStart() void RunControl::enablePortsGatherer() { - d->portsGatherer = std::make_unique(); + d->enablePortsGatherer(); +} + +void RunControlPrivate::enablePortsGatherer() +{ + if (!portsGatherer) + portsGatherer = std::make_unique(); +} + +QUrl RunControlPrivate::getNextChannel() +{ + QTC_ASSERT(portsGatherer, return {}); + QUrl result; + result.setScheme(urlTcpScheme()); + if (q->device()->extraData(Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()) + result.setHost("localhost"); + else + result.setHost(q->device()->toolControlChannel(IDevice::ControlChannelHint()).host()); + result.setPort(portList.getNextFreePort(portsGatherer->usedPorts()).number()); + return result; } QUrl RunControl::findEndPoint() @@ -616,6 +652,54 @@ QUrl RunControl::findEndPoint() return result; } +void RunControl::requestDebugChannel() +{ + d->enablePortsGatherer(); + d->useDebugChannel = true; +} + +bool RunControl::usesDebugChannel() const +{ + return d->useDebugChannel; +} + +QUrl RunControl::debugChannel() const +{ + return d->debugChannel; +} + +void RunControl::requestQmlChannel() +{ + d->enablePortsGatherer(); + d->useQmlChannel = true; +} + +bool RunControl::usesQmlChannel() const +{ + return d->useQmlChannel; +} + +QUrl RunControl::qmlChannel() const +{ + return d->qmlChannel; +} + +void RunControl::requestPerfChannel() +{ + d->enablePortsGatherer(); + d->usePerfChannel = true; +} + +bool RunControl::usesPerfChannel() const +{ + return d->usePerfChannel; +} + +QUrl RunControl::perfChannel() const +{ + return d->perfChannel; +} + void RunControlPrivate::continueStart() { checkState(RunControlState::Starting); @@ -1909,6 +1993,36 @@ void RunWorker::setEssential(bool essential) d->essential = essential; } +QUrl RunWorker::debugChannel() const +{ + return d->runControl->debugChannel(); +} + +bool RunWorker::usesDebugChannel() const +{ + return d->runControl->usesDebugChannel(); +} + +QUrl RunWorker::qmlChannel() const +{ + return d->runControl->qmlChannel(); +} + +bool RunWorker::usesQmlChannel() const +{ + return d->runControl->usesQmlChannel(); +} + +QUrl RunWorker::perfChannel() const +{ + return d->runControl->perfChannel(); +} + +bool RunWorker::usesPerfChannel() const +{ + return d->runControl->usesPerfChannel(); +} + void RunWorker::start() { reportStarted(); diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index dc00eb5102a..69bcf1cdc1d 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -81,6 +81,15 @@ public: bool isEssential() const; void setEssential(bool essential); + QUrl debugChannel() const; + bool usesDebugChannel() const; + + QUrl qmlChannel() const; + bool usesQmlChannel() const; + + QUrl perfChannel() const; + bool usesPerfChannel() const; + signals: void started(); void stopped(); @@ -237,6 +246,18 @@ public: void enablePortsGatherer(); QUrl findEndPoint(); + void requestDebugChannel(); + bool usesDebugChannel() const; + QUrl debugChannel() const; + + void requestQmlChannel(); + bool usesQmlChannel() const; + QUrl qmlChannel() const; + + void requestPerfChannel(); + bool usesPerfChannel() const; + QUrl perfChannel() const; + signals: void appendMessage(const QString &msg, Utils::OutputFormat format); void aboutToStart(); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 456ae907f8a..f83ab4a8327 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -76,22 +76,22 @@ static QStringList searchPaths(Kit *kit) class QnxDebuggeeRunner : public ProjectExplorer::SimpleTargetRunner { public: - QnxDebuggeeRunner(RunControl *runControl, DebuggerRunTool *debugger) + explicit QnxDebuggeeRunner(RunControl *runControl) : SimpleTargetRunner(runControl) { setId("QnxDebuggeeRunner"); - setStartModifier([this, debugger] { + setStartModifier([this] { CommandLine cmd = commandLine(); QStringList arguments; - if (SubChannelProvider *provider = debugger->debugChannelProvider()) { - int pdebugPort = provider->channel().port(); + if (usesDebugChannel()) { + int pdebugPort = debugChannel().port(); cmd.setExecutable(device()->filePath(QNX_DEBUG_EXECUTABLE)); arguments.append(QString::number(pdebugPort)); } - if (SubChannelProvider *provider = debugger->qmlChannelProvider()) { + if (usesQmlChannel()) { arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, - provider->channel())); + qmlChannel())); } cmd.setArguments(ProcessArgs::joinArgs(arguments)); setCommandLine(cmd); @@ -113,7 +113,7 @@ public: setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); - auto debuggeeRunner = new QnxDebuggeeRunner(runControl, this); + auto debuggeeRunner = new QnxDebuggeeRunner(runControl); auto slog2InfoRunner = new Slog2InfoRunner(runControl); debuggeeRunner->addStartDependency(slog2InfoRunner); diff --git a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp index fa995ab2861..c8e9d97b2b7 100644 --- a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp +++ b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp @@ -109,19 +109,14 @@ public: if (usePerf) { suppressDefaultStdOutHandling(); runControl->setProperty("PerfProcess", QVariant::fromValue(process())); - m_perfChannelProvider = new Debugger::SubChannelProvider(runControl); - addStartDependency(m_perfChannelProvider); + runControl->requestPerfChannel(); } - if (useGdbServer) { - m_debugChannelProvider = new Debugger::SubChannelProvider(runControl); - addStartDependency(m_debugChannelProvider); - } + if (useGdbServer) + runControl->requestDebugChannel(); - if (useQmlServer) { - m_qmlChannelProvider = new Debugger::SubChannelProvider(runControl); - addStartDependency(m_qmlChannelProvider); - } + if (useQmlServer) + runControl->requestQmlChannel(); setStartModifier([this, runControl] { FilePath controller = runControl->aspectData()->filePath; @@ -140,22 +135,21 @@ public: cmd.addArg("debug-application"); - if (m_debugChannelProvider || m_qmlChannelProvider) { + if (usesDebugChannel() || usesQmlChannel()) { QStringList debugArgs; debugArgs.append(envVars.join(' ')); - if (m_debugChannelProvider) { - debugArgs.append(QString("gdbserver :%1").arg(m_debugChannelProvider->channel().port())); - } - if (m_qmlChannelProvider) { + if (usesDebugChannel()) + debugArgs.append(QString("gdbserver :%1").arg(debugChannel().port())); + if (usesQmlChannel()) { const QString qmlArgs = qmlDebugCommandLineArguments(m_qmlServices, - QString("port:%1").arg(m_qmlChannelProvider->channel().port()), + QString("port:%1").arg(qmlChannel().port()), true); debugArgs.append(QString("%program% %1 %arguments%") .arg(qmlArgs)); } cmd.addArg(debugArgs.join(' ')); } - if (m_perfChannelProvider) { + if (usesPerfChannel()) { const Store perfArgs = runControl->settingsData(PerfProfiler::Constants::PerfSettingsId); const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString(); cmd.addArg(QString("perf record %1 -o - --").arg(recordArgs)); @@ -181,22 +175,7 @@ public: }); } - QUrl gdbServer() const - { - QTC_ASSERT(m_debugChannelProvider, return {}); - return m_debugChannelProvider->channel(); - } - - QUrl qmlServer() const - { - QTC_ASSERT(m_qmlChannelProvider, return {}); - return m_qmlChannelProvider->channel(); - } - private: - Debugger::SubChannelProvider *m_debugChannelProvider = nullptr; - Debugger::SubChannelProvider *m_qmlChannelProvider = nullptr; - Debugger::SubChannelProvider *m_perfChannelProvider = nullptr; QmlDebug::QmlDebugServicesPreset m_qmlServices; }; @@ -252,13 +231,13 @@ private: setCloseMode(Debugger::KillAndExitMonitorAtClose); if (isQmlDebugging()) - setQmlServer(m_debuggee->qmlServer()); + setQmlServer(qmlChannel()); if (isCppDebugging()) { setUseExtendedRemote(false); setUseContinueInsteadOfRun(true); setContinueAfterAttach(true); - setRemoteChannel(m_debuggee->gdbServer()); + setRemoteChannel(debugChannel()); setSymbolFile(m_symbolFile); QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(runControl()->kit()); @@ -304,7 +283,7 @@ public: private: void start() final { - m_worker->recordData("QmlServerUrl", m_runner->qmlServer()); + m_worker->recordData("QmlServerUrl", qmlChannel()); reportStarted(); } diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp index f89767de0a3..6a29994a094 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -265,7 +266,7 @@ void GenericLinuxDeviceConfigurationWidget::linkDeviceChanged(int index) void GenericLinuxDeviceConfigurationWidget::sshPortForwardingForDebugging(bool on) { - device()->setExtraData(Constants::SshForwardDebugServerPort, on); + device()->setExtraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT, on); } void GenericLinuxDeviceConfigurationWidget::updateDeviceFromUi() @@ -347,7 +348,8 @@ void GenericLinuxDeviceConfigurationWidget::initGui() sshParams.authenticationType == SshParameters::AuthenticationTypeSpecificKey); m_gdbServerLineEdit->setFilePath(device()->debugServerPath()); m_qmlRuntimeLineEdit->setFilePath(device()->qmlRunCommand()); - m_useSshPortForwardingForDebugging->setChecked(device()->extraData(Constants::SshForwardDebugServerPort).toBool()); + m_useSshPortForwardingForDebugging->setChecked( + device()->extraData(ProjectExplorer::Constants::SSH_FORWARD_DEBUGSERVER_PORT).toBool()); updatePortsWarningLabel(); } diff --git a/src/plugins/remotelinux/remotelinux_constants.h b/src/plugins/remotelinux/remotelinux_constants.h index a562164dfdc..19e44e0646f 100644 --- a/src/plugins/remotelinux/remotelinux_constants.h +++ b/src/plugins/remotelinux/remotelinux_constants.h @@ -21,7 +21,6 @@ const char KillAppStepId[] = "RemoteLinux.KillAppStep"; const char SourceProfile[] = "RemoteLinux.SourceProfile"; const char LinkDevice[] = "RemoteLinux.LinkDevice"; -const char SshForwardDebugServerPort[] = "RemoteLinux.SshForwardDebugServerPort"; const char SshForwardPort[] = "RemoteLinux.SshForwardPort"; const char DisableSharing[] = "RemoteLinux.DisableSharing";