diff options
author | hjk <[email protected]> | 2021-08-10 09:19:30 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-08-13 15:04:30 +0000 |
commit | 52e5023bcce391f7bd47b70e62c3f4ab04d319f7 (patch) | |
tree | 6288d6e7e901b6f2c8e3ef29e1cd1fe1f85be4f2 /src/plugins | |
parent | 33108795d6b2dd1e91942efb3c1c27ad23342295 (diff) |
ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins')
71 files changed, 247 insertions, 295 deletions
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index f135b427a16..0002b23fe35 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -100,7 +100,7 @@ class AndroidQmlPreviewWorker : public AndroidQmlToolingSupport { public: AndroidQmlPreviewWorker(RunControl *runControl) - : AndroidQmlToolingSupport(runControl, runControl->runnable().executable.toString()) + : AndroidQmlToolingSupport(runControl, runControl->runnable().command.executable().toString()) {} }; diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index bc16e5e5f87..85631878945 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -276,7 +276,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa << m_extraEnvVars.toStringList(); if (target->buildConfigurations().first()->buildType() != BuildConfiguration::BuildType::Release) { - m_extraAppParams = runControl->runnable().commandLineArguments; + m_extraAppParams = runControl->runnable().command.arguments(); } if (auto aspect = runControl->aspect(Constants::ANDROID_AMSTARTARGS)) { diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index 38883879a30..82fb07a982c 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -508,7 +508,7 @@ QVector<QObject *> AutotestPlugin::createTestObjects() const bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const { - return rc && rc->displayName() == displayName && rc->runnable().executable.toString() == executable; + return rc && rc->displayName() == displayName && rc->runnable().command.executable().toString() == executable; } } // Internal diff --git a/src/plugins/autotest/boost/boosttestconfiguration.cpp b/src/plugins/autotest/boost/boosttestconfiguration.cpp index eef1bb58908..ba306e55c8c 100644 --- a/src/plugins/autotest/boost/boosttestconfiguration.cpp +++ b/src/plugins/autotest/boost/boosttestconfiguration.cpp @@ -128,7 +128,7 @@ QStringList BoostTestConfiguration::argumentsForTestRunner(QStringList *omitted) arguments << "-t" << test; if (AutotestPlugin::settings()->processArgs) { - arguments << filterInterfering(runnable().commandLineArguments.split( + arguments << filterInterfering(runnable().command.arguments().split( ' ', Qt::SkipEmptyParts), omitted); } return arguments; diff --git a/src/plugins/autotest/catch/catchconfiguration.cpp b/src/plugins/autotest/catch/catchconfiguration.cpp index 3d01b58bd01..bb1353ff4a9 100644 --- a/src/plugins/autotest/catch/catchconfiguration.cpp +++ b/src/plugins/autotest/catch/catchconfiguration.cpp @@ -101,7 +101,7 @@ QStringList CatchConfiguration::argumentsForTestRunner(QStringList *omitted) con arguments << "--reporter" << "xml"; if (AutotestPlugin::settings()->processArgs) { - arguments << filterInterfering(runnable().commandLineArguments.split( + arguments << filterInterfering(runnable().command.arguments().split( ' ', Qt::SkipEmptyParts), omitted); } diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp index 4556aceb0dd..a4903b075ad 100644 --- a/src/plugins/autotest/gtest/gtestconfiguration.cpp +++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp @@ -76,7 +76,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con { QStringList arguments; if (AutotestPlugin::settings()->processArgs) { - arguments << filterInterfering(runnable().commandLineArguments.split( + arguments << filterInterfering(runnable().command.arguments().split( ' ', Qt::SkipEmptyParts), omitted); } diff --git a/src/plugins/autotest/qtest/qttestconfiguration.cpp b/src/plugins/autotest/qtest/qttestconfiguration.cpp index edc58a90900..a7305eeb729 100644 --- a/src/plugins/autotest/qtest/qttestconfiguration.cpp +++ b/src/plugins/autotest/qtest/qttestconfiguration.cpp @@ -52,7 +52,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co QStringList arguments; if (AutotestPlugin::settings()->processArgs) { arguments.append(QTestUtils::filterInterfering( - runnable().commandLineArguments.split(' ', Qt::SkipEmptyParts), + runnable().command.arguments().split(' ', Qt::SkipEmptyParts), omitted, false)); } auto qtSettings = static_cast<QtTestSettings *>(framework()->testSettings()); diff --git a/src/plugins/autotest/quick/quicktestconfiguration.cpp b/src/plugins/autotest/quick/quicktestconfiguration.cpp index aa2bdc18acb..bd02a88be20 100644 --- a/src/plugins/autotest/quick/quicktestconfiguration.cpp +++ b/src/plugins/autotest/quick/quicktestconfiguration.cpp @@ -59,7 +59,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted) QStringList arguments; if (AutotestPlugin::settings()->processArgs) { arguments.append(QTestUtils::filterInterfering - (runnable().commandLineArguments.split(' ', Qt::SkipEmptyParts), + (runnable().command.arguments().split(' ', Qt::SkipEmptyParts), omitted, true)); } diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 1e363288846..8da67933b5e 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -75,7 +75,7 @@ Utils::FilePath ITestConfiguration::workingDirectory() const bool ITestConfiguration::hasExecutable() const { - return !m_runnable.executable.isEmpty(); + return !m_runnable.command.isEmpty(); } Utils::FilePath ITestConfiguration::executableFilePath() const @@ -83,10 +83,10 @@ Utils::FilePath ITestConfiguration::executableFilePath() const if (!hasExecutable()) return {}; - if (m_runnable.executable.isExecutableFile() && m_runnable.executable.path() != ".") { - return m_runnable.executable.absoluteFilePath(); - } else if (m_runnable.executable.path() == "."){ - QString fullCommandFileName = m_runnable.executable.toString(); + if (m_runnable.command.executable().isExecutableFile() && m_runnable.command.executable().path() != ".") { + return m_runnable.command.executable().absoluteFilePath(); + } else if (m_runnable.command.executable().path() == "."){ + QString fullCommandFileName = m_runnable.command.executable().toString(); // TODO: check if we can use searchInPath() from Utils::Environment const QStringList &pathList = m_runnable.environment.toProcessEnvironment().value("PATH") .split(Utils::HostOsInfo::pathListSeparator()); @@ -94,7 +94,7 @@ Utils::FilePath ITestConfiguration::executableFilePath() const for (const QString &path : pathList) { QString filePath(path + QDir::separator() + fullCommandFileName); if (QFileInfo(filePath).isExecutable()) - return m_runnable.executable.absoluteFilePath(); + return m_runnable.command.executable().absoluteFilePath(); } } return {}; @@ -154,7 +154,7 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio BuildTargetInfo targetInfo = rc->buildTargetInfo(); if (!targetInfo.targetFilePath.isEmpty()) - m_runnable.executable = ensureExeEnding(targetInfo.targetFilePath); + m_runnable.command.setExecutable(ensureExeEnding(targetInfo.targetFilePath)); Utils::FilePath buildBase; if (auto buildConfig = target->activeBuildConfiguration()) { @@ -177,8 +177,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) qCDebug(LOG) << "Using run configuration specified by user or found by first call"; completeTestInformation(m_origRunConfig, runMode); if (hasExecutable()) { - qCDebug(LOG) << "Completed.\nRunnable:" << m_runnable.executable - << "\nArgs:" << m_runnable.commandLineArguments + qCDebug(LOG) << "Completed.\nCommand:" << m_runnable.command.toUserOutput() << "\nWorking directory:" << m_runnable.workingDirectory; return; } @@ -255,7 +254,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) const Runnable runnable = runConfig->runnable(); // not the best approach - but depending on the build system and whether the executables // are going to get installed or not we have to soften the condition... - const FilePath currentExecutable = ensureExeEnding(runnable.executable); + const FilePath currentExecutable = ensureExeEnding(runnable.command.executable()); const QString currentBST = runConfig->buildKey(); qCDebug(LOG) << " CurrentExecutable" << currentExecutable; qCDebug(LOG) << " BST of RunConfig" << currentBST; @@ -265,7 +264,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) qCDebug(LOG) << " Using this RunConfig."; m_origRunConfig = runConfig; m_runnable = runnable; - m_runnable.executable = currentExecutable; + m_runnable.command.setExecutable(currentExecutable); setDisplayName(runConfig->displayName()); if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy) m_runConfig = new Internal::TestRunConfiguration(target, this); @@ -278,7 +277,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode) // for this case try the original executable path of the BuildTargetInfo (the executable // before installation) to have at least something to execute if (!hasExecutable() && !localExecutable.isEmpty()) - m_runnable.executable = localExecutable; + m_runnable.command.setExecutable(localExecutable); if (displayName().isEmpty() && hasExecutable()) { qCDebug(LOG) << " Fallback"; // we failed to find a valid runconfiguration - but we've got the executable already @@ -318,7 +317,7 @@ void TestConfiguration::setTestCases(const QStringList &testCases) void TestConfiguration::setExecutableFile(const QString &executableFile) { - m_runnable.executable = Utils::FilePath::fromString(executableFile); + m_runnable.command.setExecutable(Utils::FilePath::fromString(executableFile)); } void TestConfiguration::setProjectFile(const Utils::FilePath &projectFile) diff --git a/src/plugins/autotest/testrunconfiguration.h b/src/plugins/autotest/testrunconfiguration.h index f0f56f219af..451add1fa2b 100644 --- a/src/plugins/autotest/testrunconfiguration.h +++ b/src/plugins/autotest/testrunconfiguration.h @@ -65,8 +65,8 @@ public: { ProjectExplorer::Runnable r; QTC_ASSERT(m_testConfig, return r); - r.executable = m_testConfig->executableFilePath(); - r.commandLineArguments = m_testConfig->argumentsForTestRunner().join(' '); + r.command.setExecutable(m_testConfig->executableFilePath()); + r.command.setArguments(m_testConfig->argumentsForTestRunner().join(' ')); r.workingDirectory = m_testConfig->workingDirectory(); r.environment = m_testConfig->environment(); return r; diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 88a1359fc18..fea438dc35a 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -438,7 +438,7 @@ static RunConfiguration *getRunConfiguration(const QString &buildTargetKey) RunConfiguration *runConfig = nullptr; const QList<RunConfiguration *> runConfigurations = Utils::filtered(target->runConfigurations(), [] (const RunConfiguration *rc) { - return !rc->runnable().executable.isEmpty(); + return !rc->runnable().command.isEmpty(); }); const ChoicePair oldChoice = AutotestPlugin::cachedChoiceFor(buildTargetKey); @@ -464,7 +464,7 @@ static RunConfiguration *getRunConfiguration(const QString &buildTargetKey) runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) { if (rc->displayName() != dName) return false; - return rc->runnable().executable.toString() == exe; + return rc->runnable().command.executable().toString() == exe; }); if (runConfig && dialog.rememberChoice()) AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe)); @@ -638,10 +638,10 @@ void TestRunner::debugTests() QStringList omitted; Runnable inferior = config->runnable(); - inferior.executable = commandFilePath; + inferior.command.setExecutable(commandFilePath); const QStringList args = config->argumentsForTestRunner(&omitted); - inferior.commandLineArguments = Utils::ProcessArgs::joinArgs(args); + inferior.command.setArguments(Utils::ProcessArgs::joinArgs(args)); if (!omitted.isEmpty()) { const QString &details = constructOmittedDetailsString(omitted); reportResult(ResultType::MessageWarn, details.arg(config->displayName())); @@ -677,7 +677,7 @@ void TestRunner::debugTests() if (useOutputProcessor) { TestOutputReader *outputreader = config->outputReader(*futureInterface, nullptr); - outputreader->setId(inferior.executable.toString()); + outputreader->setId(inferior.command.executable().toString()); connect(outputreader, &TestOutputReader::newOutputLineAvailable, TestResultsPane::instance(), &TestResultsPane::addOutputLine); connect(runControl, &RunControl::appendMessage, @@ -909,8 +909,8 @@ void RunConfigurationSelectionDialog::populate() if (auto target = project->activeTarget()) { for (RunConfiguration *rc : target->runConfigurations()) { auto runnable = rc->runnable(); - const QStringList rcDetails = { runnable.executable.toString(), - runnable.commandLineArguments, + const QStringList rcDetails = { runnable.command.executable().toString(), + runnable.command.arguments(), runnable.workingDirectory.toString() }; m_rcCombo->addItem(rc->displayName(), rcDetails); } diff --git a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp index e8287bcf474..90b3dbd2b93 100644 --- a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp +++ b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp @@ -180,11 +180,11 @@ bool GdbServerProvider::aboutToRun(DebuggerRunTool *runTool, } Runnable inferior; - inferior.executable = bin; + inferior.command.setExecutable(bin); inferior.extraData.insert(Debugger::Constants::kPeripheralDescriptionFile, m_peripheralDescriptionFile.toVariant()); if (const auto argAspect = runControl->aspect<ArgumentsAspect>()) - inferior.commandLineArguments = argAspect->arguments(runControl->macroExpander()); + inferior.command.setArguments(argAspect->arguments(runControl->macroExpander())); runTool->setInferior(inferior); runTool->setSymbolFile(bin); runTool->setStartMode(AttachToRemoteServer); @@ -202,7 +202,7 @@ RunWorker *GdbServerProvider::targetRunner(RunControl *runControl) const return nullptr; Runnable r; - r.setCommandLine(command()); + r.command = command(); // Command arguments are in host OS style as the bare metal's GDB servers are launched // on the host, not on that target. return new GdbServerProviderRunner(runControl, r); diff --git a/src/plugins/baremetal/debugservers/uvsc/uvscserverprovider.cpp b/src/plugins/baremetal/debugservers/uvsc/uvscserverprovider.cpp index aad7c350d33..75d0cc12442 100644 --- a/src/plugins/baremetal/debugservers/uvsc/uvscserverprovider.cpp +++ b/src/plugins/baremetal/debugservers/uvsc/uvscserverprovider.cpp @@ -215,7 +215,7 @@ bool UvscServerProvider::aboutToRun(DebuggerRunTool *runTool, QString &errorMess const FilePath peripheralDescriptionFile = FilePath::fromString(m_deviceSelection.svd); Runnable inferior; - inferior.executable = bin; + inferior.command.setExecutable(bin); inferior.extraData.insert(Debugger::Constants::kPeripheralDescriptionFile, peripheralDescriptionFile.toVariant()); inferior.extraData.insert(Debugger::Constants::kUVisionProjectFilePath, projFilePath.toString()); @@ -233,12 +233,12 @@ ProjectExplorer::RunWorker *UvscServerProvider::targetRunner(RunControl *runCont { // Get uVision executable path. const Runnable uv = DebuggerKitAspect::runnable(runControl->kit()); - CommandLine server(uv.executable); + CommandLine server(uv.command.executable()); server.addArg("-j0"); server.addArg(QStringLiteral("-s%1").arg(m_channel.port())); Runnable r; - r.setCommandLine(server); + r.command = server; return new UvscServerProviderRunner(runControl, r); } @@ -380,7 +380,7 @@ UvscServerProviderRunner::UvscServerProviderRunner(ProjectExplorer::RunControl * { setId("BareMetalUvscServer"); - m_process.setCommand(runnable.commandLine()); + m_process.setCommand(runnable.command); connect(&m_process, &QtcProcess::started, this, [this] { ProcessHandle pid(m_process.processId()); diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp index 02b262f8c52..1f6ba72280f 100644 --- a/src/plugins/boot2qt/qdbdevice.cpp +++ b/src/plugins/boot2qt/qdbdevice.cpp @@ -65,8 +65,7 @@ public: void terminate() override { ProjectExplorer::Runnable r; - r.executable = FilePath::fromString(Constants::AppcontrollerFilepath); - r.commandLineArguments = QStringLiteral("--stop"); + r.command = {QString(Constants::AppcontrollerFilepath), {"--stop"}}; (new ApplicationLauncher(this))->start(r, device()); } @@ -91,7 +90,7 @@ public: m_deviceName = device->displayName(); Runnable r; - r.setCommandLine(command); + r.command = command; m_appRunner.start(r, device); showMessage(QdbDevice::tr("Starting command \"%1\" on device \"%2\".") .arg(command.toUserOutput(), m_deviceName)); diff --git a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp index ef766006c66..04e5132ee46 100644 --- a/src/plugins/boot2qt/qdbdevicedebugsupport.cpp +++ b/src/plugins/boot2qt/qdbdevicedebugsupport.cpp @@ -115,12 +115,13 @@ public: lowerPort = upperPort = perfPort; } args.append(QString(" --port-range %1-%2 ").arg(lowerPort).arg(upperPort)); - args.append(r.executable.toString()); + // FIXME: Breaks with spaces! + args.append(r.command.executable().toString()); args.append(" "); - args.append(r.commandLineArguments); + args.append(r.command.arguments()); - r.commandLineArguments = args; - r.executable = FilePath::fromString(Constants::AppcontrollerFilepath); + r.command.setArguments(args); + r.command.setExecutable(FilePath::fromString(Constants::AppcontrollerFilepath)); m_launcher.start(r, device()); } diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index 449b7a8db2e..37bd47e9c46 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -144,8 +144,9 @@ public: { setStarter([this, runControl] { Runnable r = runControl->runnable(); - r.commandLineArguments = r.executable.toString() + ' ' + r.commandLineArguments; - r.executable = Utils::FilePath::fromString(Constants::AppcontrollerFilepath); + // FIXME: Spaces! + r.command.setArguments(r.command.executable().toString() + ' ' + r.command.arguments()); + r.command.setExecutable(Utils::FilePath::fromString(Constants::AppcontrollerFilepath)); doStart(r, runControl->device()); }); } diff --git a/src/plugins/boot2qt/qdbstopapplicationservice.cpp b/src/plugins/boot2qt/qdbstopapplicationservice.cpp index d300ef08ad4..4c43cc6af6d 100644 --- a/src/plugins/boot2qt/qdbstopapplicationservice.cpp +++ b/src/plugins/boot2qt/qdbstopapplicationservice.cpp @@ -102,8 +102,7 @@ void QdbStopApplicationService::doDeploy() this, &QdbStopApplicationService::stdOutData); ProjectExplorer::Runnable runnable; - runnable.executable = Utils::FilePath::fromString(Constants::AppcontrollerFilepath); - runnable.commandLineArguments = QStringLiteral("--stop"); + runnable.command = {QString(Constants::AppcontrollerFilepath), {"--stop"}}; runnable.workingDirectory = FilePath::fromString("/usr/bin"); d->applicationLauncher.start(runnable, diff --git a/src/plugins/clangtools/clangtoolruncontrol.cpp b/src/plugins/clangtools/clangtoolruncontrol.cpp index f2febea4c2f..28ce949c821 100644 --- a/src/plugins/clangtools/clangtoolruncontrol.cpp +++ b/src/plugins/clangtools/clangtoolruncontrol.cpp @@ -252,10 +252,10 @@ void ClangToolRunWorker::start() // Collect files const auto clangIncludeDirAndVersion = - getClangIncludeDirAndVersion(runControl()->runnable().executable); + getClangIncludeDirAndVersion(runControl()->runnable().command.executable()); const AnalyzeUnits unitsToProcess = unitsToAnalyze(clangIncludeDirAndVersion.first, clangIncludeDirAndVersion.second); - qCDebug(LOG) << Q_FUNC_INFO << runControl()->runnable().executable + qCDebug(LOG) << Q_FUNC_INFO << runControl()->runnable().command.executable() << clangIncludeDirAndVersion.first << clangIncludeDirAndVersion.second; qCDebug(LOG) << "Files to process:" << unitsToProcess; diff --git a/src/plugins/debugger/analyzer/startremotedialog.cpp b/src/plugins/debugger/analyzer/startremotedialog.cpp index 21024fe1a2e..c5762013ae6 100644 --- a/src/plugins/debugger/analyzer/startremotedialog.cpp +++ b/src/plugins/debugger/analyzer/startremotedialog.cpp @@ -132,8 +132,7 @@ Runnable StartRemoteDialog::runnable() const Kit *kit = d->kitChooser->currentKit(); Runnable r; r.device = DeviceKitAspect::device(kit); - r.executable = FilePath::fromString(d->executable->text()); - r.commandLineArguments = d->arguments->text(); + r.command = {FilePath::fromString(d->executable->text()), d->arguments->text(), CommandLine::Raw}; r.workingDirectory = FilePath::fromString(d->workingDirectory->text()); return r; } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index c7f508fd7f6..d6d1f2da782 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -331,8 +331,7 @@ void CdbEngine::setupEngine() DebuggerRunParameters sp = runParameters(); if (terminal()) { m_effectiveStartMode = AttachToLocalProcess; - sp.inferior.executable.clear(); - sp.inferior.commandLineArguments.clear(); + sp.inferior.command = CommandLine(); sp.attachPID = ProcessHandle(terminal()->applicationPid()); sp.startMode = AttachToLocalProcess; sp.useTerminal = false; // Force no terminal. @@ -345,12 +344,12 @@ void CdbEngine::setupEngine() // Determine binary (force MSVC), extension lib name and path to use // The extension is passed as relative name with the path variable set //(does not work with absolute path names) - if (sp.debugger.executable.isEmpty()) { + if (sp.debugger.command.isEmpty()) { handleSetupFailure(tr("There is no CDB executable specified.")); return; } - bool cdbIs64Bit = Utils::is64BitWindowsBinary(sp.debugger.executable.toString()); + bool cdbIs64Bit = Utils::is64BitWindowsBinary(sp.debugger.command.executable().toString()); if (!cdbIs64Bit) m_wow64State = noWow64Stack; const QFileInfo extensionFi(CdbEngine::extensionLibraryName(cdbIs64Bit)); @@ -370,7 +369,7 @@ void CdbEngine::setupEngine() } // Prepare command line. - CommandLine debugger{sp.debugger.executable}; + CommandLine debugger{sp.debugger.command}; const QString extensionFileName = extensionFi.fileName(); const bool isRemote = sp.startMode == AttachToRemoteServer; @@ -403,9 +402,9 @@ void CdbEngine::setupEngine() switch (sp.startMode) { case StartInternal: case StartExternal: - debugger.addArg(sp.inferior.executable.toUserOutput()); + debugger.addArg(sp.inferior.command.executable().toUserOutput()); // Complete native argument string. - debugger.addArgs(sp.inferior.commandLineArguments, CommandLine::Raw); + debugger.addArgs(sp.inferior.command.arguments(), CommandLine::Raw); break; case AttachToRemoteServer: break; @@ -489,7 +488,7 @@ void CdbEngine::handleInitialSessionIdle() if (rp.breakOnMain) { BreakpointParameters bp(BreakpointAtMain); if (rp.startMode == StartInternal || rp.startMode == StartExternal) { - const QString &moduleFileName = rp.inferior.executable.fileName(); + const QString &moduleFileName = rp.inferior.command.executable().fileName(); bp.module = moduleFileName.left(moduleFileName.indexOf('.')); } QString function = cdbAddBreakpointCommand(bp, m_sourcePathMappings); @@ -835,7 +834,7 @@ void CdbEngine::doInterruptInferior(const InterruptCallback &callback) connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished, this, &CdbEngine::handleDoInterruptInferior); - m_signalOperation->setDebuggerCommand(runParameters().debugger.executable.toString()); + m_signalOperation->setDebuggerCommand(runParameters().debugger.command.executable()); m_signalOperation->interruptProcess(inferiorPid()); } diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 00eec18dc0c..69c1ee48cd7 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -135,9 +135,8 @@ public: bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) const { - return runnable.executable == rhs.runnable.executable + return runnable.command == rhs.runnable.command && serverPort == rhs.serverPort - && runnable.commandLineArguments == rhs.runnable.commandLineArguments && runnable.workingDirectory == rhs.runnable.workingDirectory && breakAtMain == rhs.breakAtMain && runInTerminal == rhs.runInTerminal @@ -153,8 +152,8 @@ QString StartApplicationParameters::displayName() const { const int maxLength = 60; - QString name = runnable.executable.fileName() - + ' ' + runnable.commandLineArguments; + QString name = runnable.command.executable().fileName() + + ' ' + runnable.command.arguments(); if (name.size() > 60) { int index = name.lastIndexOf(' ', maxLength); if (index == -1) @@ -174,8 +173,8 @@ void StartApplicationParameters::toSettings(QSettings *settings) const settings->setValue("LastKitId", kitId.toSetting()); settings->setValue("LastServerPort", serverPort); settings->setValue("LastServerAddress", serverAddress); - settings->setValue("LastExternalExecutable", runnable.executable.toVariant()); - settings->setValue("LastExternalExecutableArguments", runnable.commandLineArguments); + settings->setValue("LastExternalExecutable", runnable.command.executable().toVariant()); + settings->setValue("LastExternalExecutableArguments", runnable.command.arguments()); settings->setValue("LastExternalWorkingDirectory", runnable.workingDirectory.toVariant()); settings->setValue("LastExternalBreakAtMain", breakAtMain); settings->setValue("LastExternalRunInTerminal", runInTerminal); @@ -191,8 +190,8 @@ void StartApplicationParameters::fromSettings(const QSettings *settings) kitId = Id::fromSetting(settings->value("LastKitId")); serverPort = settings->value("LastServerPort").toUInt(); serverAddress = settings->value("LastServerAddress").toString(); - runnable.executable = FilePath::fromVariant(settings->value("LastExternalExecutable")); - runnable.commandLineArguments = settings->value("LastExternalExecutableArguments").toString(); + runnable.command.setExecutable(FilePath::fromVariant(settings->value("LastExternalExecutable"))); + runnable.command.setArguments(settings->value("LastExternalExecutableArguments").toString()); runnable.workingDirectory = FilePath::fromVariant(settings->value("LastExternalWorkingDirectory")); breakAtMain = settings->value("LastExternalBreakAtMain").toBool(); runInTerminal = settings->value("LastExternalRunInTerminal").toBool(); @@ -349,7 +348,7 @@ void StartApplicationDialog::setHistory(const QList<StartApplicationParameters> d->historyComboBox->clear(); for (int i = l.size(); --i >= 0; ) { const StartApplicationParameters &p = l.at(i); - if (!p.runnable.executable.isEmpty()) + if (!p.runnable.command.isEmpty()) d->historyComboBox->addItem(p.displayName(), QVariant::fromValue(p)); } } @@ -483,13 +482,13 @@ StartApplicationParameters StartApplicationDialog::parameters() const StartApplicationParameters result; result.serverPort = d->serverPortSpinBox->value(); result.serverAddress = d->channelOverrideEdit->text(); - result.runnable.executable = d->localExecutablePathChooser->filePath(); + result.runnable.command.setExecutable(d->localExecutablePathChooser->filePath()); result.sysRoot = d->sysRootPathChooser->filePath(); result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText(); result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText(); result.kitId = d->kitChooser->currentKitId(); result.debugInfoLocation = d->debuginfoPathChooser->filePath().toString(); - result.runnable.commandLineArguments = d->arguments->text(); + result.runnable.command.setArguments(d->arguments->text()); result.runnable.workingDirectory = d->workingDirectory->filePath(); result.breakAtMain = d->breakAtMainCheckBox->isChecked(); result.runInTerminal = d->runInTerminalCheckBox->isChecked(); @@ -502,12 +501,12 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p) d->kitChooser->setCurrentKitId(p.kitId); d->serverPortSpinBox->setValue(p.serverPort); d->channelOverrideEdit->setText(p.serverAddress); - d->localExecutablePathChooser->setFilePath(p.runnable.executable); + d->localExecutablePathChooser->setFilePath(p.runnable.command.executable()); d->sysRootPathChooser->setFilePath(p.sysRoot); d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands); d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands); d->debuginfoPathChooser->setPath(p.debugInfoLocation); - d->arguments->setText(p.runnable.commandLineArguments); + d->arguments->setText(p.runnable.command.arguments()); d->workingDirectory->setFilePath(p.runnable.workingDirectory); d->breakAtMainCheckBox->setChecked(p.breakAtMain); d->runInTerminalCheckBox->setChecked(p.runInTerminal); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 2d1d82489bd..1a3e31d8270 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -119,9 +119,9 @@ QDebug operator<<(QDebug d, DebuggerState state) QDebug operator<<(QDebug str, const DebuggerRunParameters &sp) { QDebug nospace = str.nospace(); - nospace << "executable=" << sp.inferior.executable + nospace << "executable=" << sp.inferior.command.executable() << " coreFile=" << sp.coreFile - << " processArgs=" << sp.inferior.commandLineArguments + << " processArgs=" << sp.inferior.command.arguments() << " inferior environment=<" << sp.inferior.environment.size() << " variables>" << " debugger environment=<" << sp.debugger.environment.size() << " variables>" << " workingDir=" << sp.inferior.workingDirectory @@ -2621,16 +2621,16 @@ QString DebuggerEngine::formatStartParameters() const if (sp.isQmlDebugging) str << "qml"; str << '\n'; - if (!sp.inferior.executable.isEmpty()) { - str << "Executable: " << sp.inferior.commandLine().toUserOutput(); + if (!sp.inferior.command.isEmpty()) { + str << "Executable: " << sp.inferior.command.toUserOutput(); if (d->m_terminalRunner) str << " [terminal]"; str << '\n'; if (!sp.inferior.workingDirectory.isEmpty()) str << "Directory: " << sp.inferior.workingDirectory.toUserOutput() << '\n'; } - if (!sp.debugger.executable.isEmpty()) - str << "Debugger: " << sp.debugger.executable.toUserOutput() << '\n'; + if (!sp.debugger.command.isEmpty()) + str << "Debugger: " << sp.debugger.command.toUserOutput() << '\n'; if (!sp.coreFile.isEmpty()) str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n'; if (sp.attachPID.isValid()) diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index 5354df0af7c..d8e06e74e71 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -345,7 +345,7 @@ Runnable DebuggerKitAspect::runnable(const Kit *kit) { Runnable runnable; if (const DebuggerItem *item = debugger(kit)) { - runnable.executable = item->command(); + runnable.command = CommandLine{item->command()}; runnable.workingDirectory = item->workingDirectory(); runnable.environment = kit->runEnvironment(); runnable.environment.set("LC_NUMERIC", "C"); diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 4cce8c70564..9349ee0bf89 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -376,7 +376,7 @@ void DebuggerRunTool::setInferior(const Runnable &runnable) void DebuggerRunTool::setInferiorExecutable(const FilePath &executable) { - m_runParameters.inferior.executable = executable; + m_runParameters.inferior.command.setExecutable(executable); } void DebuggerRunTool::setInferiorEnvironment(const Utils::Environment &env) @@ -451,17 +451,17 @@ void DebuggerRunTool::start() QTC_ASSERT(qmlServerPort > 0, reportFailure(); return); QString mode = QString("port:%1").arg(qmlServerPort); - CommandLine cmd{m_runParameters.inferior.executable}; + CommandLine cmd{m_runParameters.inferior.command.executable()}; cmd.addArg(qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, mode, true)); - cmd.addArgs(m_runParameters.inferior.commandLineArguments, CommandLine::Raw); + cmd.addArgs(m_runParameters.inferior.command.arguments(), CommandLine::Raw); - m_runParameters.inferior.setCommandLine(cmd); + m_runParameters.inferior.command = cmd; } } // User canceled input dialog asking for executable when working on library project. if (m_runParameters.startMode == StartInternal - && m_runParameters.inferior.executable.isEmpty() + && m_runParameters.inferior.command.isEmpty() && m_runParameters.interpreter.isEmpty()) { reportFailure(tr("No executable specified.")); return; @@ -484,19 +484,19 @@ void DebuggerRunTool::start() return; if (m_runParameters.cppEngineType == CdbEngineType - && Utils::is64BitWindowsBinary(m_runParameters.inferior.executable.toString()) - && !Utils::is64BitWindowsBinary(m_runParameters.debugger.executable.toString())) { + && Utils::is64BitWindowsBinary(m_runParameters.inferior.command.executable().toString()) + && !Utils::is64BitWindowsBinary(m_runParameters.debugger.command.executable().toString())) { reportFailure( DebuggerPlugin::tr( "%1 is a 64 bit executable which can not be debugged by a 32 bit Debugger.\n" "Please select a 64 bit Debugger in the kit settings for this kit.") - .arg(m_runParameters.inferior.executable.toUserOutput())); + .arg(m_runParameters.inferior.command.executable().toUserOutput())); return; } Utils::globalMacroExpander()->registerFileVariables( "DebuggedExecutable", tr("Debugged executable"), - [this] { return m_runParameters.inferior.executable; } + [this] { return m_runParameters.inferior.command.executable(); } ); runControl()->setDisplayName(m_runParameters.displayName); @@ -637,7 +637,7 @@ void DebuggerRunTool::start() } } - appendMessage(tr("Debugging %1 ...").arg(m_runParameters.inferior.commandLine().toUserOutput()), + appendMessage(tr("Debugging %1 ...").arg(m_runParameters.inferior.command.toUserOutput()), NormalMessageFormat); QString debuggerName = m_engine->objectName(); if (m_engine2) @@ -682,7 +682,7 @@ void DebuggerRunTool::handleEngineFinished(DebuggerEngine *engine) { engine->prepareForRestart(); if (--d->engineStopsNeeded == 0) { - QString cmd = m_runParameters.inferior.commandLine().toUserOutput(); + QString cmd = m_runParameters.inferior.command.toUserOutput(); QString msg = engine->runParameters().exitCode // Main engine. ? tr("Debugging of %1 has finished with exit code %2.") .arg(cmd).arg(engine->runParameters().exitCode.value()) @@ -730,7 +730,7 @@ bool DebuggerRunTool::fixupParameters() { DebuggerRunParameters &rp = m_runParameters; if (rp.symbolFile.isEmpty()) - rp.symbolFile = rp.inferior.executable; + rp.symbolFile = rp.inferior.command.executable(); // Copy over DYLD_IMAGE_SUFFIX etc for (const auto &var : @@ -788,7 +788,7 @@ bool DebuggerRunTool::fixupParameters() QString qmlarg = rp.isCppDebugging() && rp.nativeMixedEnabled ? QmlDebug::qmlDebugNativeArguments(service, false) : QmlDebug::qmlDebugTcpArguments(service, rp.qmlServer); - ProcessArgs::addArg(&rp.inferior.commandLineArguments, qmlarg); + rp.inferior.command.addArg(qmlarg); } } @@ -802,10 +802,10 @@ bool DebuggerRunTool::fixupParameters() if (HostOsInfo::isWindowsHost()) { ProcessArgs::SplitError perr; - rp.inferior.commandLineArguments = - ProcessArgs::prepareArgs(rp.inferior.commandLineArguments, &perr, + rp.inferior.command.setArguments( + ProcessArgs::prepareArgs(rp.inferior.command.arguments(), &perr, HostOsInfo::hostOs(), nullptr, - &rp.inferior.workingDirectory).toWindowsArgs(); + &rp.inferior.workingDirectory).toWindowsArgs()); if (perr != ProcessArgs::SplitOk) { // perr == BadQuoting is never returned on Windows // FIXME? QTCREATORBUG-2809 @@ -894,7 +894,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH"); if (!envBinary.isEmpty()) - m_runParameters.debugger.executable = FilePath::fromString(QString::fromLocal8Bit(envBinary)); + m_runParameters.debugger.command.setExecutable(FilePath::fromString(QString::fromLocal8Bit(envBinary))); if (Project *project = runControl->project()) { m_runParameters.projectSourceDirectory = project->projectDirectory(); @@ -924,11 +924,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm m_runParameters.mainScript = mainScript; m_runParameters.interpreter = interpreter; const QString args = runConfig->property("arguments").toString(); - if (!args.isEmpty()) { - if (!m_runParameters.inferior.commandLineArguments.isEmpty()) - m_runParameters.inferior.commandLineArguments.append(' '); - m_runParameters.inferior.commandLineArguments.append(args); - } + m_runParameters.inferior.command.addArgs(args, CommandLine::Raw); m_engine = createPdbEngine(); } } @@ -1028,7 +1024,7 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat debugServer.environment = mainRunnable.environment; debugServer.workingDirectory = mainRunnable.workingDirectory; - QStringList args = ProcessArgs::splitArgs(mainRunnable.commandLineArguments, OsTypeLinux); + QStringList args = ProcessArgs::splitArgs(mainRunnable.command.arguments(), OsTypeLinux); const bool isQmlDebugging = portsGatherer->useQmlServer(); const bool isCppDebugging = portsGatherer->useGdbServer(); @@ -1038,13 +1034,13 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat portsGatherer->qmlServer())); } if (isQmlDebugging && !isCppDebugging) { - debugServer.executable = mainRunnable.executable; // FIXME: Case should not happen? + debugServer.command.setExecutable(mainRunnable.command.executable()); // FIXME: Case should not happen? } else { - debugServer.executable = FilePath::fromString(runControl->device()->debugServerPath()); - if (debugServer.executable.isEmpty()) - debugServer.executable = FilePath::fromString("gdbserver"); + debugServer.command.setExecutable(FilePath::fromString(runControl->device()->debugServerPath())); + if (debugServer.command.isEmpty()) + debugServer.command.setExecutable(FilePath::fromString("gdbserver")); args.clear(); - if (debugServer.executable.toString().contains("lldb-server")) { + if (debugServer.command.executable().toString().contains("lldb-server")) { args.append("platform"); args.append("--listen"); args.append(QString("*:%1").arg(portsGatherer->gdbServer().port())); @@ -1060,7 +1056,7 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat args.append(QString::number(m_pid.pid())); } } - debugServer.commandLineArguments = ProcessArgs::joinArgs(args, OsTypeLinux); + debugServer.command.setArguments(ProcessArgs::joinArgs(args, OsTypeLinux)); doStart(debugServer, runControl->device()); }); diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp index 97e8b274555..f816ac97254 100644 --- a/src/plugins/debugger/enginemanager.cpp +++ b/src/plugins/debugger/enginemanager.cpp @@ -245,7 +245,7 @@ QVariant EngineItem::data(int column, int role) const return myName; } case 1: - return rp.coreFile.isEmpty() ? rp.inferior.executable.toUserOutput() : rp.coreFile; + return rp.coreFile.isEmpty() ? rp.inferior.command.executable().toUserOutput() : rp.coreFile; } return QVariant(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b8354a28752..88dfca2ed0b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -696,7 +696,7 @@ void GdbEngine::interruptInferior() notifyInferiorStopFailed(); } }); - signalOperation->setDebuggerCommand(runParameters().debugger.executable.toString()); + signalOperation->setDebuggerCommand(runParameters().debugger.command.executable()); signalOperation->interruptProcess(inferiorPid()); } else { interruptInferior2(); @@ -1681,8 +1681,8 @@ void GdbEngine::setLinuxOsAbi() return; const DebuggerRunParameters &rp = runParameters(); bool isElf = (rp.toolChainAbi.binaryFormat() == Abi::ElfFormat); - if (!isElf && !rp.inferior.executable.isEmpty()) { - isElf = Utils::anyOf(Abi::abisOfBinary(rp.inferior.executable), [](const Abi &abi) { + if (!isElf && !rp.inferior.command.isEmpty()) { + isElf = Utils::anyOf(Abi::abisOfBinary(rp.inferior.command.executable()), [](const Abi &abi) { return abi.binaryFormat() == Abi::ElfFormat; }); } @@ -3807,7 +3807,7 @@ void GdbEngine::setupEngine() m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX const DebuggerRunParameters &rp = runParameters(); - CommandLine gdbCommand{rp.debugger.executable}; + CommandLine gdbCommand = rp.debugger.command; if (usesOutputCollector()) { if (!m_outputCollector.listen()) { @@ -3826,7 +3826,7 @@ void GdbEngine::setupEngine() m_expectTerminalTrap = terminal(); - if (rp.debugger.executable.isEmpty()) { + if (rp.debugger.command.isEmpty()) { handleGdbStartFailed(); handleAdapterStartFailed( msgNoGdbBinaryForToolChain(rp.toolChainAbi), @@ -3862,7 +3862,7 @@ void GdbEngine::setupEngine() msg = failedToStartMessage() + ' ' + tr("The working directory \"%1\" is not usable.") .arg(wd.toUserOutput()); else - msg = RunWorker::userMessageForProcessError(QProcess::FailedToStart, rp.debugger.executable); + msg = RunWorker::userMessageForProcessError(QProcess::FailedToStart, rp.debugger.command.executable()); handleAdapterStartFailed(msg); return; } @@ -3930,7 +3930,7 @@ void GdbEngine::setupEngine() Module module; module.startAddress = 0; module.endAddress = 0; - module.modulePath = rp.inferior.executable.toString(); + module.modulePath = rp.inferior.command.executable().toString(); module.moduleName = "<executable>"; modulesHandler()->updateModule(module); @@ -3979,7 +3979,7 @@ void GdbEngine::setupEngine() //if (terminal()->isUsable()) // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); - const QFileInfo gdbBinaryFile = rp.debugger.executable.toFileInfo(); + const QFileInfo gdbBinaryFile = rp.debugger.command.executable().toFileInfo(); const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python"; runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')"}); @@ -4061,7 +4061,7 @@ void GdbEngine::reloadDebuggingHelpers() void GdbEngine::handleGdbError(QProcess::ProcessError error) { - QString msg = RunWorker::userMessageForProcessError(error, runParameters().debugger.executable); + QString msg = RunWorker::userMessageForProcessError(error, runParameters().debugger.command.executable()); QString errorString = m_gdbProc.errorString(); if (!errorString.isEmpty()) msg += '\n' + errorString; @@ -4302,7 +4302,7 @@ bool GdbEngine::isTermEngine() const bool GdbEngine::usesOutputCollector() const { - return isPlainEngine() && !runParameters().debugger.executable.needsDevice(); + return isPlainEngine() && !runParameters().debugger.command.executable().needsDevice(); } void GdbEngine::claimInitialBreakpoints() @@ -4368,7 +4368,7 @@ void GdbEngine::setupInferior() //const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); - const QString args = runParameters().inferior.commandLineArguments; + const QString args = runParameters().inferior.command.arguments(); // if (!remoteArch.isEmpty()) // postCommand("set architecture " + remoteArch); @@ -4418,7 +4418,7 @@ void GdbEngine::setupInferior() setLinuxOsAbi(); - FilePath executable = rp.inferior.executable; + FilePath executable = rp.inferior.command.executable(); if (executable.isEmpty()) { CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile); @@ -4464,12 +4464,12 @@ void GdbEngine::setupInferior() setEnvironmentVariables(); if (!rp.inferior.workingDirectory.isEmpty()) runCommand({"cd " + rp.inferior.workingDirectory.path()}); - if (!rp.inferior.commandLineArguments.isEmpty()) { - QString args = rp.inferior.commandLineArguments; + if (!rp.inferior.command.arguments().isEmpty()) { + QString args = rp.inferior.command.arguments(); runCommand({"-exec-arguments " + args}); } - QString executable = runParameters().inferior.executable.toFileInfo().absoluteFilePath(); + QString executable = runParameters().inferior.command.executable().toFileInfo().absoluteFilePath(); runCommand({"-file-exec-and-symbols \"" + executable + '"', CB(handleFileExecAndSymbols)}); } @@ -4799,8 +4799,8 @@ void GdbEngine::handleTargetExtendedRemote(const DebuggerResponse &response) // gdb server will stop the remote application itself. runCommand({"attach " + QString::number(runParameters().attachPID.pid()), CB(handleTargetExtendedAttach)}); - } else if (!runParameters().inferior.executable.isEmpty()) { - runCommand({"-gdb-set remote exec-file " + runParameters().inferior.executable.toString(), + } else if (!runParameters().inferior.command.isEmpty()) { + runCommand({"-gdb-set remote exec-file " + runParameters().inferior.command.executable().toString(), CB(handleTargetExtendedAttach)}); } else { const QString title = tr("No Remote Executable or Process ID Specified"); @@ -4849,8 +4849,8 @@ void GdbEngine::handleTargetQnx(const DebuggerResponse &response) const DebuggerRunParameters &rp = runParameters(); if (rp.attachPID.isValid()) runCommand({"attach " + QString::number(rp.attachPID.pid()), CB(handleRemoteAttach)}); - else if (!rp.inferior.executable.isEmpty()) - runCommand({"set nto-executable " + rp.inferior.executable.toString(), + else if (!rp.inferior.command.isEmpty()) + runCommand({"set nto-executable " + rp.inferior.command.executable().toString(), CB(handleSetNtoExecutable)}); else handleInferiorPrepared(); @@ -4988,7 +4988,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS Environment envLang(Environment::systemEnvironment()); envLang.setupEnglishOutput(); proc.setEnvironment(envLang); - proc.setCommand({debugger.executable, args}); + proc.setCommand({debugger.command.executable(), args}); proc.runBlocking(); if (proc.result() == QtcProcess::FinishedWithSuccess) { diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index a340f6103ea..26816ce5469 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -208,7 +208,7 @@ void LldbEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); - const FilePath lldbCmd = runParameters().debugger.executable; + const FilePath lldbCmd = runParameters().debugger.command.executable(); showMessage("STARTING LLDB: " + lldbCmd.toUserOutput()); Environment environment = runParameters().debugger.environment; @@ -280,14 +280,14 @@ void LldbEngine::setupEngine() } DebuggerCommand cmd2("setupInferior"); - cmd2.arg("executable", rp.inferior.executable.toString()); + cmd2.arg("executable", rp.inferior.command.executable().toString()); cmd2.arg("breakonmain", rp.breakOnMain); cmd2.arg("useterminal", bool(terminal())); cmd2.arg("startmode", rp.startMode); cmd2.arg("nativemixed", isNativeMixedActive()); cmd2.arg("workingdirectory", rp.inferior.workingDirectory); cmd2.arg("environment", rp.inferior.environment.toStringList()); - cmd2.arg("processargs", toHex(ProcessArgs::splitArgs(rp.inferior.commandLineArguments).join(QChar(0)))); + cmd2.arg("processargs", toHex(ProcessArgs::splitArgs(rp.inferior.command.arguments()).join(QChar(0)))); cmd2.arg("platform", rp.platform); cmd2.arg("symbolfile", rp.symbolFile); @@ -805,7 +805,7 @@ QString LldbEngine::errorMessage(QProcess::ProcessError error) const return tr("The LLDB process failed to start. Either the " "invoked program \"%1\" is missing, or you may have insufficient " "permissions to invoke the program.") - .arg(runParameters().debugger.executable.toUserOutput()); + .arg(runParameters().debugger.command.executable().toUserOutput()); case QProcess::Crashed: return tr("The LLDB process crashed some time after starting " "successfully."); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 82085020e57..416e1693bd1 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -505,7 +505,7 @@ void QmlEngine::startApplicationLauncher() { if (!d->applicationLauncher.isRunning()) { const Runnable runnable = runParameters().inferior; - showMessage(tr("Starting %1").arg(runnable.commandLine().toUserOutput()), + showMessage(tr("Starting %1").arg(runnable.command.toUserOutput()), NormalMessageFormat); d->applicationLauncher.start(runnable); } diff --git a/src/plugins/debugger/terminal.cpp b/src/plugins/debugger/terminal.cpp index 7f4996cd5b6..98d461b4555 100644 --- a/src/plugins/debugger/terminal.cpp +++ b/src/plugins/debugger/terminal.cpp @@ -218,7 +218,7 @@ void TerminalRunner::start() } // Error message for user is delivered via a signal. - m_stubProc.setCommand(stub.commandLine()); + m_stubProc.setCommand(stub.command); m_stubProc.start(); } diff --git a/src/plugins/debugger/unstartedappwatcherdialog.cpp b/src/plugins/debugger/unstartedappwatcherdialog.cpp index 771dc6fceca..19af428adeb 100644 --- a/src/plugins/debugger/unstartedappwatcherdialog.cpp +++ b/src/plugins/debugger/unstartedappwatcherdialog.cpp @@ -121,7 +121,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent) if (isLocal(runConfig)) { resetExecutable->setEnabled(true); connect(resetExecutable, &QPushButton::clicked, this, [this, runnable] { - m_pathChooser->setFilePath(runnable.executable); + m_pathChooser->setFilePath(runnable.command.executable()); }); } } @@ -200,7 +200,7 @@ void UnstartedAppWatcherDialog::selectExecutable() if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) { const Runnable runnable = runConfig->runnable(); if (isLocal(runConfig)) - path = runnable.executable.parentDir(); + path = runnable.command.executable().parentDir(); } } diff --git a/src/plugins/debugger/uvsc/uvscengine.cpp b/src/plugins/debugger/uvsc/uvscengine.cpp index 8e3a8b6041d..475a205881b 100644 --- a/src/plugins/debugger/uvsc/uvscengine.cpp +++ b/src/plugins/debugger/uvsc/uvscengine.cpp @@ -110,16 +110,16 @@ void UvscEngine::setupEngine() } // Check for valid uVision executable. - if (rp.debugger.executable.isEmpty()) { + if (rp.debugger.command.isEmpty()) { handleSetupFailure(tr("Internal error: No uVision executable specified.")); return; - } else if (!rp.debugger.executable.exists()) { + } else if (!rp.debugger.command.executable().exists()) { handleSetupFailure(tr("Internal error: The specified uVision executable does not exist.")); return; } showMessage("UVSC: RESOLVING LIBRARY SYMBOLS..."); - m_client.reset(new UvscClient(rp.debugger.executable.parentDir().toString())); + m_client.reset(new UvscClient(rp.debugger.command.executable().parentDir().toString())); if (m_client->error() != UvscClient::NoError) { handleSetupFailure(tr("Internal error: Cannot resolve the library: %1.") .arg(m_client->errorString())); @@ -375,7 +375,7 @@ void UvscEngine::insertBreakpoint(const Breakpoint &bp) if (requested.type == BreakpointByFileAndLine) { // Add target executable name. const DebuggerRunParameters &rp = runParameters(); - QString exe = rp.inferior.executable.baseName(); + QString exe = rp.inferior.command.executable().baseName(); exe.replace('-', '_'); expression += "\\\\" + exe; // Add file name. @@ -568,9 +568,8 @@ bool UvscEngine::configureProject(const DebuggerRunParameters &rp) // We need to use the relative output target path. showMessage("UVSC: SETTING PROJECT OUTPUT TARGET..."); - const FilePath targetPath = rp.inferior.executable.relativeChildPath( - projectPath.parentDir()); - if (!rp.inferior.executable.exists()) { + const FilePath targetPath = rp.inferior.command.executable().relativeChildPath(projectPath.parentDir()); + if (!rp.inferior.command.executable().exists()) { handleSetupFailure(tr("Internal error: The specified output file does not exist.")); return false; } else if (!m_client->setProjectOutputTarget(targetPath)) { @@ -626,7 +625,7 @@ void UvscEngine::handleProjectClosed() Module module; module.startAddress = 0; module.endAddress = 0; - module.modulePath = rp.inferior.executable.toString(); + module.modulePath = rp.inferior.command.executable().toString(); module.moduleName = "<executable>"; modulesHandler()->updateModule(module); diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 2bfee35354e..83bb5bbe0ad 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -144,7 +144,7 @@ void DockerDeviceProcess::start(const Runnable &runnable) disconnect(&m_process); - m_process.setCommand(runnable.commandLine()); + m_process.setCommand(runnable.command); m_process.setEnvironment(runnable.environment); m_process.setWorkingDirectory(runnable.workingDirectory); connect(&m_process, &QtcProcess::errorOccurred, this, &DeviceProcess::error); @@ -214,9 +214,8 @@ class DockerPortsGatheringMethod : public PortsGatheringMethod // /proc/net/tcp* covers /proc/net/tcp and /proc/net/tcp6 Runnable runnable; - runnable.executable = FilePath::fromString("sed"); - runnable.commandLineArguments - = "-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*"; + runnable.command.setExecutable(FilePath::fromString("sed")); + runnable.command.setArguments("-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*"); return runnable; } @@ -485,7 +484,7 @@ DockerDevice::DockerDevice(const DockerDeviceData &data) }); Runnable runnable; - runnable.executable = FilePath::fromString("/bin/sh"); + runnable.command = {"/bin/sh", {}}; runnable.device = sharedFromThis(); runnable.environment = env; runnable.workingDirectory = workingDir; diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index a2b57b941d1..5a93615bf2f 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -197,7 +197,7 @@ void IosRunner::start() this, &IosRunner::handleFinished); const Runnable runnable = runControl()->runnable(); - QStringList args = ProcessArgs::splitArgs(runnable.commandLineArguments, OsTypeMac); + QStringList args = ProcessArgs::splitArgs(runnable.command.arguments(), OsTypeMac); if (m_qmlServerPort.isValid()) { QUrl qmlServer; qmlServer.setPort(m_qmlServerPort.number()); diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp index 131aff1c65b..9369fe589fa 100644 --- a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp +++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp @@ -92,12 +92,10 @@ public: { setStarter([this, runControl] { const Target *target = runControl->target(); - const CommandLine cmd( - cmakeFilePath(target), - runControl->runConfiguration()->aspect<StringAspect>()->value(), - CommandLine::Raw); Runnable r; - r.setCommandLine(cmd); + r.command = {cmakeFilePath(target), + runControl->runConfiguration()->aspect<StringAspect>()->value(), + CommandLine::Raw}; r.workingDirectory = target->activeBuildConfiguration()->buildDirectory(); r.environment = target->activeBuildConfiguration()->environment(); SimpleTargetRunner::doStart(r, {}); diff --git a/src/plugins/perfprofiler/perfconfigwidget.cpp b/src/plugins/perfprofiler/perfconfigwidget.cpp index 9381f1e147c..d201a08ff0d 100644 --- a/src/plugins/perfprofiler/perfconfigwidget.cpp +++ b/src/plugins/perfprofiler/perfconfigwidget.cpp @@ -174,9 +174,7 @@ void PerfConfigWidget::readTracePoints() messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); if (messageBox.exec() == QMessageBox::Yes) { ProjectExplorer::Runnable runnable; - runnable.executable = Utils::FilePath::fromString("perf"); - runnable.commandLineArguments = QLatin1String("probe -l"); - + runnable.command = {"perf", {"probe", "-l"}}; m_process->start(runnable); useTracePointsButton->setEnabled(false); } diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index 48bb6cd4bcc..c032edde375 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -150,13 +150,11 @@ public: QStringList arguments; arguments << "record"; arguments += m_perfRecordArguments; - arguments << "-o" << "-" << "--" << perfRunnable.executable.toString() - << Utils::ProcessArgs::splitArgs(perfRunnable.commandLineArguments, - Utils::OsTypeLinux); + arguments << "-o" << "-" << "--" << perfRunnable.command.executable().toString() + << ProcessArgs::splitArgs(perfRunnable.command.arguments(), OsTypeLinux); - perfRunnable.executable = FilePath::fromString("perf"); - perfRunnable.commandLineArguments = Utils::ProcessArgs::joinArgs(arguments, - Utils::OsTypeLinux); + perfRunnable.command.setExecutable(FilePath::fromString("perf")); + perfRunnable.command.setArguments(ProcessArgs::joinArgs(arguments, OsTypeLinux)); m_process->start(perfRunnable); } diff --git a/src/plugins/perfprofiler/perftracepointdialog.cpp b/src/plugins/perfprofiler/perftracepointdialog.cpp index 771471b186f..ec6f5ba1462 100644 --- a/src/plugins/perfprofiler/perftracepointdialog.cpp +++ b/src/plugins/perfprofiler/perftracepointdialog.cpp @@ -101,12 +101,10 @@ void PerfTracePointDialog::runScript() Runnable runnable; const QString elevate = m_ui->privilegesChooser->currentText(); - if (elevate != QLatin1String("n.a.")) { - runnable.executable = Utils::FilePath::fromString(elevate); - runnable.commandLineArguments = "sh"; - } else { - runnable.executable = Utils::FilePath::fromString("sh"); - } + if (elevate != QLatin1String("n.a.")) + runnable.command = {elevate, {"sh"}}; + else + runnable.command = {"sh", {}}; connect(m_process.get(), &DeviceProcess::started, this, &PerfTracePointDialog::feedScriptToProcess); diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 42ac99d5df4..726546636c9 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -390,7 +390,7 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice:: WinDebugInterface::instance()->start(); // Try to start listener again... #endif - CommandLine cmdLine = runnable.commandLine(); + CommandLine cmdLine = runnable.command; if (m_runAsRoot) { CommandLine wrapped("sudo", {"-A"}); wrapped.addArgs(cmdLine); @@ -420,7 +420,7 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice:: return; } - if (!device->isEmptyCommandAllowed() && runnable.executable.isEmpty()) { + if (!device->isEmptyCommandAllowed() && runnable.command.isEmpty()) { doReportError(ApplicationLauncher::tr("Cannot run: No command given.")); setFinished(); return; diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 5bb144d54e1..ae2e480a1f1 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -392,8 +392,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) if (!tab.runControl || tab.runControl->isRunning()) return false; const Runnable otherRunnable = tab.runControl->runnable(); - return thisRunnable.executable == otherRunnable.executable - && thisRunnable.commandLineArguments == otherRunnable.commandLineArguments + return thisRunnable.command == otherRunnable.command && thisRunnable.workingDirectory == otherRunnable.workingDirectory && thisRunnable.environment == otherRunnable.environment; }); diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index 0c2c1cdd61e..6de84f199b2 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -125,7 +125,7 @@ static int queue(const QList<Project *> &projects, const QList<Id> &stepIds, continue; for (const BuildConfiguration * const bc : buildConfigsForSelection(t, configSelection)) { - if (rc->runnable().executable.isChildOf(bc->buildDirectory())) + if (rc->runnable().command.executable().isChildOf(bc->buildDirectory())) return true; } } diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index d39922c6d32..d339f4a9804 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -102,14 +102,14 @@ Runnable CustomExecutableRunConfiguration::runnable() const aspect<WorkingDirectoryAspect>()->workingDirectory(macroExpander()); Runnable r; - r.setCommandLine(commandLine()); + r.command = commandLine(); r.environment = aspect<EnvironmentAspect>()->environment(); r.workingDirectory = workingDirectory; r.device = DeviceManager::defaultDesktopDevice(); - if (!r.executable.isEmpty()) { - const QString expanded = macroExpander()->expand(r.executable.toString()); - r.executable = r.environment.searchInPath(expanded, {workingDirectory}); + if (!r.command.isEmpty()) { + const FilePath expanded = macroExpander()->expand(r.command.executable()); + r.command.setExecutable(r.environment.searchInPath(expanded.toString(), {workingDirectory})); } return r; diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index f25b044f5dc..0d2a0f4ad1c 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -138,13 +138,10 @@ class DesktopPortsGatheringMethod : public PortsGatheringMethod Q_UNUSED(protocol) Runnable runnable; - if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost()) { - runnable.executable = FilePath::fromString("netstat"); - runnable.commandLineArguments = "-a -n"; - } else if (HostOsInfo::isLinuxHost()) { - runnable.executable = FilePath::fromString("/bin/sh"); - runnable.commandLineArguments = "-c 'cat /proc/net/tcp*'"; - } + if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost()) + runnable.command = CommandLine{"netstat", {"-a", "-n"}}; + else if (HostOsInfo::isLinuxHost()) + runnable.command = CommandLine{"/bin/sh", {"-c", "cat /proc/net/tcp*"}}; return runnable; } diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp index 86cd26cf303..559696e0e8a 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceprocess.cpp @@ -56,8 +56,8 @@ void DesktopDeviceProcess::start(const Runnable &runnable) QTC_ASSERT(m_process.state() == QProcess::NotRunning, return); m_process.setEnvironment(runnable.environment); m_process.setWorkingDirectory(runnable.workingDirectory); - m_process.start(runnable.executable.toString(), - Utils::ProcessArgs::splitArgs(runnable.commandLineArguments)); + m_process.setCommand(runnable.command); + m_process.start(); } void DesktopDeviceProcess::interrupt() diff --git a/src/plugins/projectexplorer/devicesupport/desktopprocesssignaloperation.cpp b/src/plugins/projectexplorer/devicesupport/desktopprocesssignaloperation.cpp index 8afa9611052..1003b978874 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopprocesssignaloperation.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopprocesssignaloperation.cpp @@ -126,7 +126,7 @@ void DesktopProcessSignalOperation::interruptProcessSilently(qint64 pid) bool is64BitSystem = Utils::is64BitWindowsSystem(); SpecialInterrupt si = NoSpecialInterrupt; if (is64BitSystem) - si = Utils::is64BitWindowsBinary(m_debuggerCommand) ? Win64Interrupt : Win32Interrupt; + si = Utils::is64BitWindowsBinary(m_debuggerCommand.path()) ? Win64Interrupt : Win32Interrupt; /* Windows 64 bit has a 32 bit subsystem (WOW64) which makes it possible to run a 32 bit application inside a 64 bit environment. diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 8da8c3038c0..f897f3e70b8 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -766,7 +766,7 @@ QString IDevice::defaultPublicKeyFilePath() return defaultPrivateKeyFilePath() + QLatin1String(".pub"); } -void DeviceProcessSignalOperation::setDebuggerCommand(const QString &cmd) +void DeviceProcessSignalOperation::setDebuggerCommand(const FilePath &cmd) { m_debuggerCommand = cmd; } diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index 300d97e896b..be4e9e358cb 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -28,6 +28,7 @@ #include "../projectexplorer_export.h" #include <utils/id.h> +#include <utils/filepath.h> #include <utils/hostosinfo.h> #include <QAbstractSocket> @@ -51,7 +52,6 @@ namespace QSsh { class SshConnectionParameters; } namespace Utils { class CommandLine; class Environment; -class FilePath; class Icon; class PortList; class Port; @@ -82,7 +82,7 @@ public: virtual void interruptProcess(qint64 pid) = 0; virtual void interruptProcess(const QString &filePath) = 0; - void setDebuggerCommand(const QString &cmd); + void setDebuggerCommand(const Utils::FilePath &cmd); signals: // If the error message is empty the operation was successful @@ -91,7 +91,7 @@ signals: protected: explicit DeviceProcessSignalOperation(); - QString m_debuggerCommand; + Utils::FilePath m_debuggerCommand; QString m_errorMessage; }; diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index 2f8b3c62dd0..71758da47b3 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -87,7 +87,7 @@ SshDeviceProcess::~SshDeviceProcess() void SshDeviceProcess::start(const Runnable &runnable) { QTC_ASSERT(d->state == SshDeviceProcessPrivate::Inactive, return); - QTC_ASSERT(runInTerminal() || !runnable.executable.isEmpty(), return); + QTC_ASSERT(runInTerminal() || !runnable.command.isEmpty(), return); d->setState(SshDeviceProcessPrivate::Connecting); d->errorMessage.clear(); @@ -187,7 +187,7 @@ void SshDeviceProcess::handleConnected() QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connecting, return); d->setState(SshDeviceProcessPrivate::Connected); - d->process = runInTerminal() && d->runnable.executable.isEmpty() + d->process = runInTerminal() && d->runnable.command.isEmpty() ? d->connection->createRemoteShell() : d->connection->createRemoteProcess(fullCommandLine(d->runnable)); const QString display = d->displayName(); @@ -300,15 +300,16 @@ void SshDeviceProcess::handleKillOperationTimeout() QString SshDeviceProcess::fullCommandLine(const Runnable &runnable) const { - QString cmdLine = runnable.executable.toString(); - if (!runnable.commandLineArguments.isEmpty()) - cmdLine.append(QLatin1Char(' ')).append(runnable.commandLineArguments); + QString cmdLine = runnable.command.executable().toString(); + // FIXME: That quotes wrongly. + if (!runnable.command.arguments().isEmpty()) + cmdLine.append(QLatin1Char(' ')).append(runnable.command.arguments()); return cmdLine; } void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) { - if (runnable.executable.isEmpty()) + if (runnable.command.isEmpty()) return; switch (state) { case SshDeviceProcessPrivate::Inactive: @@ -327,7 +328,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) if (processId != 0) signalOperation->interruptProcess(processId); else - signalOperation->interruptProcess(runnable.executable.toString()); + signalOperation->interruptProcess(runnable.command.executable().toString()); } else { if (killOperation) // We are already in the process of killing the app. return; @@ -338,7 +339,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) if (processId != 0) signalOperation->killProcess(processId); else - signalOperation->killProcess(runnable.executable.toString()); + signalOperation->killProcess(runnable.command.executable().toString()); } break; } diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 2bd7a72f2bf..6677a418529 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -398,7 +398,7 @@ bool RunConfiguration::fromMap(const QVariantMap &map) Runnable RunConfiguration::runnable() const { Runnable r; - r.setCommandLine(commandLine()); + r.command = commandLine(); if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>()) r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()); if (auto environmentAspect = aspect<EnvironmentAspect>()) diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index e95c971282e..704307c68af 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1198,12 +1198,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP m_launcher.setRunAsRoot(m_runAsRoot); const bool isDesktop = device.isNull() || device.dynamicCast<const DesktopDevice>(); - const QString rawDisplayName = runnable.displayName(); - const QString displayName = isDesktop - ? QDir::toNativeSeparators(rawDisplayName) - : rawDisplayName; - const QString msg = RunControl::tr("Starting %1 %2...") - .arg(displayName).arg(runnable.commandLineArguments); + const QString msg = RunControl::tr("Starting %1...").arg(runnable.command.toUserOutput()); appendMessage(msg, Utils::NormalMessageFormat); if (isDesktop) { @@ -1220,12 +1215,13 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP }); connect(&m_launcher, &ApplicationLauncher::processExited, - this, [this, displayName](int exitCode, QProcess::ExitStatus status) { + this, [this, runnable](int exitCode, QProcess::ExitStatus status) { QString msg; if (status == QProcess::CrashExit) msg = tr("%1 crashed."); else msg = tr("%2 exited with code %1").arg(exitCode); + const QString displayName = runnable.command.executable().toUserOutput(); appendMessage(msg.arg(displayName), Utils::NormalMessageFormat); if (!m_stopReported) { m_stopReported = true; @@ -1237,7 +1233,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP this, [this, runnable](QProcess::ProcessError error) { if (error == QProcess::Timedout) return; // No actual change on the process side. - const QString msg = userMessageForProcessError(error, runnable.executable); + const QString msg = userMessageForProcessError(error, runnable.command.executable()); appendMessage(msg, Utils::NormalMessageFormat); if (!m_stopReported) { m_stopReported = true; @@ -1245,7 +1241,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP } }); - if (runnable.executable.isEmpty()) { + if (runnable.command.isEmpty()) { reportFailure(RunControl::tr("No executable specified.")); } else { m_launcher.start(runnable); @@ -1630,15 +1626,9 @@ void RunWorker::stop() reportStopped(); } -CommandLine Runnable::commandLine() const +QString Runnable::displayName() const { - return CommandLine(executable, commandLineArguments, CommandLine::Raw); -} - -void Runnable::setCommandLine(const CommandLine &cmdLine) -{ - executable = cmdLine.executable(); - commandLineArguments = cmdLine.arguments(); + return command.executable().toString(); } // OutputFormatterFactory diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 7a10cb61cf0..6f00b57e97d 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -67,18 +67,14 @@ class PROJECTEXPLORER_EXPORT Runnable public: Runnable() = default; - Utils::CommandLine commandLine() const; - void setCommandLine(const Utils::CommandLine &cmdLine); - - Utils::FilePath executable; - QString commandLineArguments; + Utils::CommandLine command; Utils::FilePath workingDirectory; Utils::Environment environment; IDevice::ConstPtr device; // Override the kit's device. Keep unset by default. QHash<Utils::Id, QVariant> extraData; // FIXME: Not necessarily a display name - QString displayName() const { return executable.toString(); } + QString displayName() const; }; class PROJECTEXPLORER_EXPORT RunWorker : public QObject diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index f9528c8e0ea..1af9f8bb793 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -128,7 +128,7 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC setStarter([this, runControl, serverUrl] { ProjectExplorer::Runnable runnable = runControl->runnable(); - QStringList qmlProjectRunConfigurationArguments = runnable.commandLine().splitArguments(); + QStringList qmlProjectRunConfigurationArguments = runnable.command.splitArguments(); const auto currentTarget = runControl->target(); const auto *qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(currentTarget->buildSystem()); @@ -142,15 +142,13 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC if (!currentFile.isEmpty() && qmlProjectRunConfigurationArguments.last().contains(mainScriptFromProject)) { qmlProjectRunConfigurationArguments.removeLast(); - auto commandLine = Utils::CommandLine(runnable.commandLine().executable(), qmlProjectRunConfigurationArguments); - commandLine.addArg(currentFile); - runnable.setCommandLine(commandLine); + runnable.command = Utils::CommandLine(runnable.command.executable(), qmlProjectRunConfigurationArguments); + runnable.command.addArg(currentFile); } } - Utils::ProcessArgs::addArg(&runnable.commandLineArguments, - QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices, - serverUrl.path())); + runnable.command.addArg(QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices, + serverUrl.path())); doStart(runnable, {}); }); } diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 5dd244cba46..91eff9a9bba 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -251,10 +251,10 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q QString arguments = Utils::ProcessArgs::quoteArg( QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, code, true)); - if (!debuggee.commandLineArguments.isEmpty()) - arguments += ' ' + debuggee.commandLineArguments; + if (!debuggee.command.arguments().isEmpty()) + arguments += ' ' + debuggee.command.arguments(); - debuggee.commandLineArguments = arguments; + debuggee.command.setArguments(arguments); doStart(debuggee, {}); }); diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp index 49eeacdde30..5aebc2243fc 100644 --- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp +++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp @@ -56,7 +56,7 @@ void LocalQmlProfilerRunnerTest::testRunner() int runCount = 0; int stopCount = 0; - debuggee.executable = Utils::FilePath::fromString("\\-/|\\-/"); + debuggee.command.setExecutable(Utils::FilePath::fromString("\\-/|\\-/")); debuggee.environment = Utils::Environment::systemEnvironment(); // should not be used anywhere but cannot be empty @@ -109,10 +109,8 @@ void LocalQmlProfilerRunnerTest::testRunner() QVERIFY(profiler.isNull()); serverUrl = Utils::urlFromLocalSocket(); - debuggee.executable = Utils::FilePath::fromString(QCoreApplication::applicationFilePath()); - // comma is used to specify a test function. In this case, an invalid one. - debuggee.commandLineArguments = QString("-test QmlProfiler,"); + debuggee.command = Utils::CommandLine(QCoreApplication::applicationFilePath(), {"-test", "QmlProfiler,"}); runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); runControl->setRunnable(debuggee); profiler = new LocalQmlProfilerSupport(runControl, serverUrl); @@ -129,7 +127,7 @@ void LocalQmlProfilerRunnerTest::testRunner() QTRY_VERIFY(runControl.isNull()); QVERIFY(profiler.isNull()); - debuggee.commandLineArguments.clear(); + debuggee.command.setArguments({}); serverUrl.clear(); serverUrl = Utils::urlFromLocalHostAndFreePort(); runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); @@ -149,7 +147,7 @@ void LocalQmlProfilerRunnerTest::testRunner() QTRY_VERIFY(runControl.isNull()); QVERIFY(profiler.isNull()); - debuggee.commandLineArguments = QString("-test QmlProfiler,"); + debuggee.command.setArguments("-test QmlProfiler,"); serverUrl.setScheme(Utils::urlSocketScheme()); { Utils::TemporaryFile file("file with spaces"); diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 59236e60f55..05b45e155c6 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -61,9 +61,8 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) profiler->recordData("QmlServerUrl", serverUrl); Runnable r = runControl->runnable(); - ProcessArgs::addArg(&r.commandLineArguments, - QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl), - Utils::OsTypeOtherUnix); + r.command.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl), + Utils::OsTypeOtherUnix); doStart(r, runControl->device()); }); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index d254b9d954f..bc7b0b2b601 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -109,14 +109,14 @@ public: QStringList arguments; if (portsGatherer->useGdbServer()) { int pdebugPort = portsGatherer->gdbServer().port(); - r.executable = FilePath::fromString(QNX_DEBUG_EXECUTABLE); + r.command.setExecutable(FilePath::fromString(QNX_DEBUG_EXECUTABLE)); arguments.append(QString::number(pdebugPort)); } if (portsGatherer->useQmlServer()) { arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, portsGatherer->qmlServer())); } - r.commandLineArguments = ProcessArgs::joinArgs(arguments); + r.command.setArguments(ProcessArgs::joinArgs(arguments)); doStart(r, runControl->device()); }); @@ -202,8 +202,7 @@ public: const int pdebugPort = portsGatherer->gdbServer().port(); Runnable r; - r.executable = FilePath::fromString(QNX_DEBUG_EXECUTABLE); - r.commandLineArguments = QString::number(pdebugPort); + r.command = {QString(QNX_DEBUG_EXECUTABLE), {QString::number(pdebugPort)}}; doStart(r, runControl->device()); }); } diff --git a/src/plugins/qnx/qnxdevice.cpp b/src/plugins/qnx/qnxdevice.cpp index b7bc3fa69c9..24d9db7ad18 100644 --- a/src/plugins/qnx/qnxdevice.cpp +++ b/src/plugins/qnx/qnxdevice.cpp @@ -62,8 +62,7 @@ class QnxPortsGatheringMethod : public PortsGatheringMethod { Q_UNUSED(protocol) Runnable runnable; - runnable.executable = FilePath::fromString("netstat"); - runnable.commandLineArguments = "-na"; + runnable.command = {"netstat", {"-na"}}; return runnable; } @@ -108,8 +107,7 @@ void QnxDevice::updateVersionNumber() const QObject::connect(&versionNumberProcess, &DeviceProcess::error, &eventLoop, &QEventLoop::quit); Runnable r; - r.executable = FilePath::fromString("uname"); - r.commandLineArguments = QLatin1String("-r"); + r.command = {"uname", {"-r"}}; versionNumberProcess.start(r); bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread(); diff --git a/src/plugins/qnx/qnxdeviceprocess.cpp b/src/plugins/qnx/qnxdeviceprocess.cpp index 14d800e94c5..0a272c3d001 100644 --- a/src/plugins/qnx/qnxdeviceprocess.cpp +++ b/src/plugins/qnx/qnxdeviceprocess.cpp @@ -46,8 +46,8 @@ QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QString QnxDeviceProcess::fullCommandLine(const Runnable &runnable) const { - QStringList args = ProcessArgs::splitArgs(runnable.commandLineArguments); - args.prepend(runnable.executable.toString()); + QStringList args = ProcessArgs::splitArgs(runnable.command.arguments()); + args.prepend(runnable.command.executable().toString()); QString cmd = ProcessArgs::createUnixArgs(args).toString(); QString fullCommandLine = @@ -73,7 +73,8 @@ void QnxDeviceProcess::doSignal(int sig) { auto signaler = new SshDeviceProcess(device(), this); Runnable r; - r.executable = FilePath::fromString(QString("kill -%2 `cat %1`").arg(m_pidFile).arg(sig)); + const QString args = QString("-%2 `cat %1`").arg(m_pidFile).arg(sig); + r.command = CommandLine(FilePath::fromString("kill"), args, CommandLine::Raw); connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater); signaler->start(r); } diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp index 20d9f7350de..ae1ee570875 100644 --- a/src/plugins/qnx/slog2inforunner.cpp +++ b/src/plugins/qnx/slog2inforunner.cpp @@ -71,7 +71,7 @@ void Slog2InfoRunner::printMissingWarning() void Slog2InfoRunner::start() { Runnable r; - r.executable = Utils::FilePath::fromString("slog2info"); + r.command = {"slog2info", {}}; m_testProcess->start(r); reportStarted(); } @@ -109,8 +109,7 @@ void Slog2InfoRunner::handleTestProcessCompleted() void Slog2InfoRunner::readLaunchTime() { Runnable r; - r.executable = Utils::FilePath::fromString("date"); - r.commandLineArguments = QLatin1String("+\"%d %H:%M:%S\""); + r.command = CommandLine(FilePath::fromString("date"), "+\"%d %H:%M:%S\"", CommandLine::Raw); m_launchDateTimeProcess->start(r); } @@ -126,8 +125,7 @@ void Slog2InfoRunner::launchSlog2Info() QString::fromLatin1("dd HH:mm:ss")); Runnable r; - r.executable = Utils::FilePath::fromString("slog2info"); - r.commandLineArguments = QLatin1String("-w"); + r.command = {"slog2info", {"-w"}}; m_logProcess->start(r); } diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index e9aa58ed660..8d2888ef613 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -144,9 +144,8 @@ class LinuxPortsGatheringMethod : public PortsGatheringMethod // /proc/net/tcp* covers /proc/net/tcp and /proc/net/tcp6 Runnable runnable; - runnable.executable = FilePath::fromString("sed"); - runnable.commandLineArguments - = "-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*"; + runnable.command.setExecutable(FilePath::fromString("sed")); + runnable.command.setArguments("-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*"); return runnable; } @@ -210,7 +209,7 @@ LinuxDevice::LinuxDevice() // It seems we cannot pass an environment to OpenSSH dynamically // without specifying an executable. if (env.size() > 0) - runnable.executable = FilePath::fromString("/bin/sh"); + runnable.command.setExecutable(FilePath::fromString("/bin/sh")); proc->setRunInTerminal(true); proc->start(runnable); diff --git a/src/plugins/remotelinux/linuxdeviceprocess.cpp b/src/plugins/remotelinux/linuxdeviceprocess.cpp index f46357a2ac4..654e975afc3 100644 --- a/src/plugins/remotelinux/linuxdeviceprocess.cpp +++ b/src/plugins/remotelinux/linuxdeviceprocess.cpp @@ -110,8 +110,8 @@ QString LinuxDeviceProcess::fullCommandLine(const Runnable &runnable) const if (!runInTerminal()) cmd.addArg("exec"); - cmd.addArg(runnable.executable.toString()); - cmd.addArgs(runnable.commandLineArguments, CommandLine::Raw); + cmd.addArg(runnable.command.executable().toString()); + cmd.addArgs(runnable.command.arguments(), CommandLine::Raw); return cmd.arguments(); } diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp index edefa7d61e7..b2f359ecafe 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp @@ -59,7 +59,7 @@ void RemoteLinuxEnvironmentReader::start() connect(m_deviceProcess, &DeviceProcess::finished, this, &RemoteLinuxEnvironmentReader::remoteProcessFinished); Runnable runnable; - runnable.executable = FilePath::fromString("env"); + runnable.command.setExecutable(FilePath::fromString("env")); m_deviceProcess->start(runnable); } diff --git a/src/plugins/remotelinux/remotelinuxkillappstep.cpp b/src/plugins/remotelinux/remotelinuxkillappstep.cpp index 1b436c621f4..daa451d97e0 100644 --- a/src/plugins/remotelinux/remotelinuxkillappstep.cpp +++ b/src/plugins/remotelinux/remotelinuxkillappstep.cpp @@ -47,7 +47,7 @@ RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Utils::Id id) Target * const theTarget = target(); QTC_ASSERT(theTarget, return CheckResult::failure()); RunConfiguration * const rc = theTarget->activeRunConfiguration(); - const QString remoteExe = rc ? rc->runnable().executable.toString() : QString(); + const QString remoteExe = rc ? rc->runnable().command.executable().toString() : QString(); service->setRemoteExecutable(remoteExe); return CheckResult::success(); }); diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp index 9b983587c0d..a83edd88c45 100644 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp @@ -58,9 +58,7 @@ RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runContro QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); Runnable r = runControl->runnable(); - ProcessArgs::addArg(&r.commandLineArguments, - QmlDebug::qmlDebugTcpArguments(services, serverUrl), - OsTypeLinux); + r.command.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl), OsTypeLinux); doStart(r, runControl->device()); }); diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp index ffcca330cfc..d76a43c5b7c 100644 --- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp @@ -125,8 +125,8 @@ void CallgrindController::run(Option option) this, &CallgrindController::controllerProcessClosed); Runnable controller = m_valgrindRunnable; - controller.executable = FilePath::fromString(CALLGRIND_CONTROL_BINARY); - controller.commandLineArguments = QString("%1 %2").arg(toOptionString(option)).arg(m_pid); + controller.command.setExecutable(FilePath::fromString(CALLGRIND_CONTROL_BINARY)); + controller.command.setArguments(QString("%1 %2").arg(toOptionString(option)).arg(m_pid)); if (!m_valgrindRunnable.device || m_valgrindRunnable.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index c19b80414a0..148f0307728 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -286,7 +286,7 @@ CallgrindToolPrivate::CallgrindToolPrivate() runControl->createMainWorker(); const auto runnable = dlg.runnable(); runControl->setRunnable(runnable); - runControl->setDisplayName(runnable.executable.toUserOutput()); + runControl->setDisplayName(runnable.command.executable().toUserOutput()); ProjectExplorerPlugin::startRunControl(runControl); }); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 6898afda66b..9fcb7919a32 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -692,7 +692,7 @@ MemcheckToolPrivate::MemcheckToolPrivate() rc->createMainWorker(); const auto runnable = dlg.runnable(); rc->setRunnable(runnable); - rc->setDisplayName(runnable.executable.toUserOutput()); + rc->setDisplayName(runnable.command.executable().toUserOutput()); ProjectExplorerPlugin::startRunControl(rc); }); @@ -751,9 +751,9 @@ void MemcheckToolPrivate::heobAction() return; } - QString executable = sr.executable.toString(); + QString executable = sr.command.executable().toString(); const QString workingDirectory = Utils::FileUtils::normalizePathName(sr.workingDirectory.toString()); - const QString commandLineArguments = sr.commandLineArguments; + const QString commandLineArguments = sr.command.arguments(); const QStringList envStrings = sr.environment.toStringList(); // target executable diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 0e7fc99d909..6c24c8c0374 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -117,7 +117,7 @@ void ValgrindToolRunner::stop() FilePath ValgrindToolRunner::executable() const { - return runnable().executable; + return runnable().command.executable(); } QStringList ValgrindToolRunner::genericToolArguments() const diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp index f99082f25d7..2c35acc16a9 100644 --- a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp +++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp @@ -500,7 +500,7 @@ void ValgrindMemcheckParserTest::testRealValgrind() qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; ProjectExplorer::Runnable debuggee; - debuggee.executable = FilePath::fromString(executable); + debuggee.command.setExecutable(FilePath::fromString(executable)); debuggee.environment = sysEnv; ValgrindRunner runner; runner.setValgrindCommand({"valgrind", {}}); @@ -537,9 +537,9 @@ void ValgrindMemcheckParserTest::testValgrindStartError() QFETCH(QString, debuggeeArgs); ProjectExplorer::Runnable debuggeeExecutable; - debuggeeExecutable.executable = FilePath::fromString(debuggee); + debuggeeExecutable.command.setExecutable(FilePath::fromString(debuggee)); + debuggeeExecutable.command.setArguments(debuggeeArgs); debuggeeExecutable.environment = Utils::Environment::systemEnvironment(); - debuggeeExecutable.commandLineArguments = debuggeeArgs; ValgrindRunner runner; runner.setValgrindCommand({valgrindExe, valgrindArgs}); diff --git a/src/plugins/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrindrunner.cpp index 2bf5fefde46..cfd3fd81ea8 100644 --- a/src/plugins/valgrind/valgrindrunner.cpp +++ b/src/plugins/valgrind/valgrindrunner.cpp @@ -138,13 +138,13 @@ bool ValgrindRunner::Private::run() if (HostOsInfo::isMacHost()) // May be slower to start but without it we get no filenames for symbols. cmd.addArg("--dsymutil=yes"); - cmd.addArg(m_debuggee.executable.toString()); - cmd.addArgs(m_debuggee.commandLineArguments, CommandLine::Raw); + cmd.addArg(m_debuggee.command.executable().toString()); + cmd.addArgs(m_debuggee.command.arguments(), CommandLine::Raw); emit q->valgrindExecuted(cmd.toUserOutput()); Runnable valgrind; - valgrind.setCommandLine(cmd); + valgrind.command = cmd; valgrind.workingDirectory = m_debuggee.workingDirectory; valgrind.environment = m_debuggee.environment; valgrind.device = m_device; @@ -190,17 +190,17 @@ void ValgrindRunner::Private::remoteProcessStarted() const QString proc = m_valgrindCommand.executable().toString().split(' ').last(); Runnable findPid; - findPid.executable = FilePath::fromString("/bin/sh"); // sleep required since otherwise we might only match "bash -c..." // and not the actual valgrind run - findPid.commandLineArguments = QString("-c \"" + findPid.command.setExecutable(FilePath::fromString("/bin/sh")); + findPid.command.setArguments(QString("-c \"" "sleep 1; ps ax" // list all processes with aliased name " | grep '\\b%1.*%2'" // find valgrind process " | tail -n 1" // limit to single process // we pick the last one, first would be "bash -c ..." " | awk '{print $1;}'" // get pid "\"" - ).arg(proc, m_debuggee.executable.fileName()); + ).arg(proc, m_debuggee.command.executable().fileName())); // m_remote.m_findPID = m_remote.m_connection->createRemoteProcess(cmd.toUtf8()); connect(&m_findPID, &ApplicationLauncher::remoteStderr, diff --git a/src/plugins/valgrind/valgrindtestrunnertest.cpp b/src/plugins/valgrind/valgrindtestrunnertest.cpp index 211d40e5fc0..4dde3013628 100644 --- a/src/plugins/valgrind/valgrindtestrunnertest.cpp +++ b/src/plugins/valgrind/valgrindtestrunnertest.cpp @@ -82,7 +82,7 @@ QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStri Runnable debuggee; const QString &binPath = binPathFileInfo.canonicalFilePath(); - debuggee.executable = Utils::FilePath::fromString(binPath); + debuggee.command.setExecutable(Utils::FilePath::fromString(binPath)); debuggee.environment = Utils::Environment::systemEnvironment(); CommandLine valgrind{"valgrind", {"--num-callers=50", "--track-origins=yes"}}; diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index d50c3abc230..82d7f8d9a53 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -114,11 +114,10 @@ public: addStartDependency(portsGatherer); setStarter([this, runControl, portsGatherer] { - CommandLine cmd = emrunCommand(runControl->target(), - runControl->aspect<WebBrowserSelectionAspect>()->currentBrowser(), - QString::number(portsGatherer->findEndPoint().port())); Runnable r; - r.setCommandLine(cmd); + r.command = emrunCommand(runControl->target(), + runControl->aspect<WebBrowserSelectionAspect>()->currentBrowser(), + QString::number(portsGatherer->findEndPoint().port())); SimpleTargetRunner::doStart(r, {}); }); } |