diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index cda84620658..bcab0dba6fd 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -51,10 +51,9 @@ namespace Internal { class RemoteLinuxAnalyzeSupportPrivate { public: - RemoteLinuxAnalyzeSupportPrivate(RunControl *runControl, Core::Id runMode) - : runMode(runMode) + RemoteLinuxAnalyzeSupportPrivate(RunControl *runControl) { - if (runMode != ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) + if (runControl->runMode() != ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) return; RunConfiguration *runConfiguration = runControl->runConfiguration(); QTC_ASSERT(runConfiguration, return); @@ -66,7 +65,6 @@ public: .join(' '); } - Core::Id runMode; Utils::Port qmlPort; QString remoteFifo; QString perfRecordArguments; @@ -79,9 +77,9 @@ public: using namespace Internal; -RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunControl *runControl, Core::Id runMode) +RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunControl *runControl, Core::Id) : AbstractRemoteLinuxRunSupport(runControl), - d(new RemoteLinuxAnalyzeSupportPrivate(runControl, runMode)) + d(new RemoteLinuxAnalyzeSupportPrivate(runControl)) { connect(runControl, &RunControl::starting, this, &RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested); @@ -107,11 +105,12 @@ void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested() { QTC_ASSERT(state() == Inactive, return); - if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { + const Core::Id runMode = runControl()->runMode(); + if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { showMessage(tr("Checking available ports...") + QLatin1Char('\n'), Utils::NormalMessageFormat); startPortsGathering(); - } else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { + } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { showMessage(tr("Creating remote socket...") + QLatin1Char('\n'), Utils::NormalMessageFormat); createRemoteFifo(); @@ -122,13 +121,14 @@ void RemoteLinuxAnalyzeSupport::startExecution() { QTC_ASSERT(state() == GatheringResources, return); - if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { + const Core::Id runMode = runControl()->runMode(); + if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { d->qmlPort = findPort(); if (!d->qmlPort.isValid()) { handleAdapterSetupFailed(tr("Not enough free ports on device for profiling.")); return; } - } else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { + } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { d->remoteFifo = fifo(); if (d->remoteFifo.isEmpty()) { handleAdapterSetupFailed(tr("FIFO for profiling data could not be created.")); @@ -154,12 +154,12 @@ void RemoteLinuxAnalyzeSupport::startExecution() auto r = runnable(); - if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { + if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { if (!r.commandLineArguments.isEmpty()) r.commandLineArguments.append(QLatin1Char(' ')); r.commandLineArguments += QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort); - } else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { + } else if (runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) { r.commandLineArguments = QLatin1String("-c 'perf record -o - ") + d->perfRecordArguments + QLatin1String(" -- ") + r.executable + QLatin1String(" ") + r.commandLineArguments + QLatin1String(" > ") + d->remoteFifo diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.h b/src/plugins/remotelinux/remotelinuxanalyzesupport.h index f2b35b02f75..4999418be5a 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.h +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.h @@ -40,7 +40,7 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR { Q_OBJECT public: - RemoteLinuxAnalyzeSupport(ProjectExplorer::RunControl *runConfig, Core::Id runMode); + RemoteLinuxAnalyzeSupport(ProjectExplorer::RunControl *runControl, Core::Id = Core::Id()); ~RemoteLinuxAnalyzeSupport() override; protected: diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index 8ca1e6657d4..79e6f0ff6c8 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -149,7 +149,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co DeviceKitInformation::device(runConfig->target()->kit())->sshParameters(); connection.analyzerHost = connection.connParams.host; runControl->setConnection(connection); - (void) new RemoteLinuxAnalyzeSupport(runControl, mode); + (void) new RemoteLinuxAnalyzeSupport(runControl); return runControl; }