ProjectExplorer: Use Utils::FileName for Runnable::executable

Change-Id: I584bc18aa19a4c9886af7b13e95052dfd4350b34
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-06-20 17:19:12 +02:00
parent 18eb0b39c5
commit 1396c6e8e9
57 changed files with 171 additions and 173 deletions

View File

@@ -176,8 +176,7 @@ void AndroidDebugSupport::start()
solibSearchPath.removeDuplicates(); solibSearchPath.removeDuplicates();
setSolibSearchPath(solibSearchPath); setSolibSearchPath(solibSearchPath);
qCDebug(androidDebugSupportLog) << "SoLibSearchPath: "<<solibSearchPath; qCDebug(androidDebugSupportLog) << "SoLibSearchPath: "<<solibSearchPath;
setSymbolFile(target->activeBuildConfiguration()->buildDirectory().toString() setSymbolFile(target->activeBuildConfiguration()->buildDirectory().pathAppended("app_process"));
+ "/app_process");
setSkipExecutableValidation(true); setSkipExecutableValidation(true);
setUseExtendedRemote(true); setUseExtendedRemote(true);
QUrl gdbServer; QUrl gdbServer;

View File

@@ -96,7 +96,7 @@ public:
addSupportedRunMode(QML_PREVIEW_RUN_MODE); addSupportedRunMode(QML_PREVIEW_RUN_MODE);
setProducer([](RunControl *runControl) -> RunWorker * { setProducer([](RunControl *runControl) -> RunWorker * {
const Runnable runnable = runControl->runConfiguration()->runnable(); const Runnable runnable = runControl->runConfiguration()->runnable();
return new AndroidQmlToolingSupport(runControl, runnable.executable); return new AndroidQmlToolingSupport(runControl, runnable.executable.toString());
}); });
addConstraint([](RunConfiguration *runConfig) { addConstraint([](RunConfiguration *runConfig) {
return runConfig->isEnabled() return runConfig->isEnabled()

View File

@@ -368,6 +368,5 @@ QVector<QObject *> AutotestPlugin::createTestObjects() const
bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const
{ {
return rc ? (rc->displayName() == displayName && rc->runnable().executable == executable) return rc && rc->displayName() == displayName && rc->runnable().executable.toString() == executable;
: false;
} }

View File

@@ -44,6 +44,7 @@
static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.testconfiguration", QtWarningMsg) static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.testconfiguration", QtWarningMsg)
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
@@ -59,11 +60,11 @@ static bool isLocal(Target *target)
return DeviceTypeKitAspect::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; return DeviceTypeKitAspect::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
} }
static QString ensureExeEnding(const QString& file) static FilePath ensureExeEnding(const FilePath &file)
{ {
if (!Utils::HostOsInfo::isWindowsHost() || file.isEmpty() || file.toLower().endsWith(".exe")) if (!HostOsInfo::isWindowsHost() || file.isEmpty() || file.toString().toLower().endsWith(".exe"))
return file; return file;
return Utils::HostOsInfo::withExecutableSuffix(file); return FilePath::fromString(HostOsInfo::withExecutableSuffix(file.toString()));
} }
void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguration *rc, void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguration *rc,
@@ -94,7 +95,7 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio
BuildTargetInfo targetInfo = rc->buildTargetInfo(); BuildTargetInfo targetInfo = rc->buildTargetInfo();
if (!targetInfo.targetFilePath.isEmpty()) if (!targetInfo.targetFilePath.isEmpty())
m_runnable.executable = ensureExeEnding(targetInfo.targetFilePath.toString()); m_runnable.executable = ensureExeEnding(targetInfo.targetFilePath);
QString buildBase; QString buildBase;
if (auto buildConfig = target->activeBuildConfiguration()) { if (auto buildConfig = target->activeBuildConfiguration()) {
@@ -157,7 +158,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
} }
} }
const QString localExecutable = ensureExeEnding(targetInfo.targetFilePath.toString()); const FilePath localExecutable = ensureExeEnding(targetInfo.targetFilePath);
if (localExecutable.isEmpty()) if (localExecutable.isEmpty())
return; return;
@@ -172,10 +173,10 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
// deployment information should get taken into account, but it pretty much seems as if // deployment information should get taken into account, but it pretty much seems as if
// each build system uses it differently // each build system uses it differently
const DeploymentData &deployData = target->deploymentData(); const DeploymentData &deployData = target->deploymentData();
const DeployableFile deploy = deployData.deployableForLocalFile(localExecutable); const DeployableFile deploy = deployData.deployableForLocalFile(localExecutable.toString());
// we might have a deployable executable // we might have a deployable executable
const QString deployedExecutable = ensureExeEnding((deploy.isValid() && deploy.isExecutable()) const FilePath deployedExecutable = ensureExeEnding((deploy.isValid() && deploy.isExecutable())
? QDir::cleanPath(deploy.remoteFilePath()) : localExecutable); ? FilePath::fromString(QDir::cleanPath(deploy.remoteFilePath())) : localExecutable);
qCDebug(LOG) << " LocalExecutable" << localExecutable; qCDebug(LOG) << " LocalExecutable" << localExecutable;
qCDebug(LOG) << " DeployedExecutable" << deployedExecutable; qCDebug(LOG) << " DeployedExecutable" << deployedExecutable;
@@ -190,7 +191,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
const Runnable runnable = runConfig->runnable(); const Runnable runnable = runConfig->runnable();
// not the best approach - but depending on the build system and whether the executables // 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... // are going to get installed or not we have to soften the condition...
const QString currentExecutable = ensureExeEnding(runnable.executable); const FilePath currentExecutable = ensureExeEnding(runnable.executable);
const QString currentBST = runConfig->buildKey(); const QString currentBST = runConfig->buildKey();
qCDebug(LOG) << " CurrentExecutable" << currentExecutable; qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
qCDebug(LOG) << " BST of RunConfig" << currentBST; qCDebug(LOG) << " BST of RunConfig" << currentBST;
@@ -258,7 +259,7 @@ void TestConfiguration::setTestCaseCount(int count)
void TestConfiguration::setExecutableFile(const QString &executableFile) void TestConfiguration::setExecutableFile(const QString &executableFile)
{ {
m_runnable.executable = executableFile; m_runnable.executable = Utils::FilePath::fromString(executableFile);
} }
void TestConfiguration::setProjectFile(const QString &projectFile) void TestConfiguration::setProjectFile(const QString &projectFile)
@@ -312,11 +313,11 @@ QString TestConfiguration::executableFilePath() const
if (!hasExecutable()) if (!hasExecutable())
return QString(); return QString();
QFileInfo commandFileInfo(m_runnable.executable); QFileInfo commandFileInfo = m_runnable.executable.toFileInfo();
if (commandFileInfo.isExecutable() && commandFileInfo.path() != ".") { if (commandFileInfo.isExecutable() && commandFileInfo.path() != ".") {
return commandFileInfo.absoluteFilePath(); return commandFileInfo.absoluteFilePath();
} else if (commandFileInfo.path() == "."){ } else if (commandFileInfo.path() == "."){
QString fullCommandFileName = m_runnable.executable; QString fullCommandFileName = m_runnable.executable.toString();
// TODO: check if we can use searchInPath() from Utils::Environment // TODO: check if we can use searchInPath() from Utils::Environment
const QStringList &pathList = m_runnable.environment.toProcessEnvironment().value("PATH") const QStringList &pathList = m_runnable.environment.toProcessEnvironment().value("PATH")
.split(Utils::HostOsInfo::pathListSeparator()); .split(Utils::HostOsInfo::pathListSeparator());

View File

@@ -68,7 +68,7 @@ public:
{ {
ProjectExplorer::Runnable r; ProjectExplorer::Runnable r;
QTC_ASSERT(m_testConfig, return r); QTC_ASSERT(m_testConfig, return r);
r.executable = m_testConfig->executableFilePath(); r.executable = Utils::FilePath::fromString(m_testConfig->executableFilePath());
r.commandLineArguments = m_testConfig->argumentsForTestRunner().join(' '); r.commandLineArguments = m_testConfig->argumentsForTestRunner().join(' ');
r.workingDirectory = m_testConfig->workingDirectory(); r.workingDirectory = m_testConfig->workingDirectory();
r.environment = m_testConfig->environment(); r.environment = m_testConfig->environment();

View File

@@ -65,6 +65,8 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
using namespace Utils;
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
@@ -390,7 +392,7 @@ static ProjectExplorer::RunConfiguration *getRunConfiguration(const QString &bui
runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) { runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) {
if (rc->displayName() != dName) if (rc->displayName() != dName)
return false; return false;
return rc->runnable().executable == exe; return rc->runnable().executable.toString() == exe;
}); });
if (runConfig && dialog.rememberChoice()) if (runConfig && dialog.rememberChoice())
AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe)); AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe));
@@ -550,7 +552,7 @@ void TestRunner::debugTests()
QStringList omitted; QStringList omitted;
ProjectExplorer::Runnable inferior = config->runnable(); ProjectExplorer::Runnable inferior = config->runnable();
inferior.executable = commandFilePath; inferior.executable = FilePath::fromString(commandFilePath);
const QStringList args = config->argumentsForTestRunner(&omitted); const QStringList args = config->argumentsForTestRunner(&omitted);
inferior.commandLineArguments = Utils::QtcProcess::joinArgs(args); inferior.commandLineArguments = Utils::QtcProcess::joinArgs(args);
@@ -589,7 +591,7 @@ void TestRunner::debugTests()
if (useOutputProcessor) { if (useOutputProcessor) {
TestOutputReader *outputreader = config->outputReader(*futureInterface, nullptr); TestOutputReader *outputreader = config->outputReader(*futureInterface, nullptr);
outputreader->setId(inferior.executable); outputreader->setId(inferior.executable.toString());
connect(outputreader, &TestOutputReader::newOutputAvailable, connect(outputreader, &TestOutputReader::newOutputAvailable,
TestResultsPane::instance(), &TestResultsPane::addOutput); TestResultsPane::instance(), &TestResultsPane::addOutput);
connect(runControl, &ProjectExplorer::RunControl::appendMessage, connect(runControl, &ProjectExplorer::RunControl::appendMessage,
@@ -755,7 +757,7 @@ void RunConfigurationSelectionDialog::populate()
if (auto target = project->activeTarget()) { if (auto target = project->activeTarget()) {
for (ProjectExplorer::RunConfiguration *rc : target->runConfigurations()) { for (ProjectExplorer::RunConfiguration *rc : target->runConfigurations()) {
auto runnable = rc->runnable(); auto runnable = rc->runnable();
const QStringList rcDetails = { runnable.executable, const QStringList rcDetails = { runnable.executable.toString(),
runnable.commandLineArguments, runnable.commandLineArguments,
runnable.workingDirectory }; runnable.workingDirectory };
m_rcCombo->addItem(rc->displayName(), rcDetails); m_rcCombo->addItem(rc->displayName(), rcDetails);

View File

@@ -48,6 +48,7 @@
using namespace Debugger; using namespace Debugger;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {
@@ -86,13 +87,13 @@ void BareMetalDebugSupport::start()
const auto exeAspect = runControl()->aspect<ExecutableAspect>(); const auto exeAspect = runControl()->aspect<ExecutableAspect>();
QTC_ASSERT(exeAspect, reportFailure(); return); QTC_ASSERT(exeAspect, reportFailure(); return);
const QString bin = exeAspect->executable().toString(); const FilePath bin = exeAspect->executable();
if (bin.isEmpty()) { if (bin.isEmpty()) {
reportFailure(tr("Cannot debug: Local executable is not set.")); reportFailure(tr("Cannot debug: Local executable is not set."));
return; return;
} }
if (!QFile::exists(bin)) { if (!bin.exists()) {
reportFailure(tr("Cannot debug: Could not find executable for \"%1\".").arg(bin)); reportFailure(tr("Cannot debug: Could not find executable for \"%1\".").arg(bin.toString()));
return; return;
} }

View File

@@ -65,7 +65,7 @@ public:
void terminate() override void terminate() override
{ {
ProjectExplorer::Runnable r; ProjectExplorer::Runnable r;
r.executable = Constants::AppcontrollerFilepath; r.executable = FilePath::fromString(Constants::AppcontrollerFilepath);
r.commandLineArguments = QStringLiteral("--stop"); r.commandLineArguments = QStringLiteral("--stop");
(new ApplicationLauncher(this))->start(r, device()); (new ApplicationLauncher(this))->start(r, device());

View File

@@ -118,12 +118,12 @@ public:
lowerPort = upperPort = perfPort; lowerPort = upperPort = perfPort;
} }
args.append(QString(" --port-range %1-%2 ").arg(lowerPort).arg(upperPort)); args.append(QString(" --port-range %1-%2 ").arg(lowerPort).arg(upperPort));
args.append(r.executable); args.append(r.executable.toString());
args.append(" "); args.append(" ");
args.append(r.commandLineArguments); args.append(r.commandLineArguments);
r.commandLineArguments = args; r.commandLineArguments = args;
r.executable = Constants::AppcontrollerFilepath; r.executable = FilePath::fromString(Constants::AppcontrollerFilepath);
m_launcher.start(r, device()); m_launcher.start(r, device());
} }

View File

@@ -143,8 +143,8 @@ public:
void start() final void start() final
{ {
Runnable r = runnable(); Runnable r = runnable();
r.commandLineArguments = r.executable + ' ' + r.commandLineArguments; r.commandLineArguments = r.executable.toString() + ' ' + r.commandLineArguments;
r.executable = Constants::AppcontrollerFilepath; r.executable = Utils::FilePath::fromString(Constants::AppcontrollerFilepath);
setRunnable(r); setRunnable(r);
SimpleTargetRunner::start(); SimpleTargetRunner::start();
} }

View File

@@ -100,7 +100,7 @@ void QdbStopApplicationService::doDeploy()
this, &QdbStopApplicationService::stdOutData); this, &QdbStopApplicationService::stdOutData);
ProjectExplorer::Runnable runnable; ProjectExplorer::Runnable runnable;
runnable.executable = Constants::AppcontrollerFilepath; runnable.executable = Utils::FilePath::fromString(Constants::AppcontrollerFilepath);
runnable.commandLineArguments = QStringLiteral("--stop"); runnable.commandLineArguments = QStringLiteral("--stop");
runnable.workingDirectory = QStringLiteral("/usr/bin"); runnable.workingDirectory = QStringLiteral("/usr/bin");

View File

@@ -133,7 +133,7 @@ Runnable StartRemoteDialog::runnable() const
Kit *kit = d->kitChooser->currentKit(); Kit *kit = d->kitChooser->currentKit();
Runnable r; Runnable r;
r.device = DeviceKitAspect::device(kit); r.device = DeviceKitAspect::device(kit);
r.executable = d->executable->text(); r.executable = Utils::FilePath::fromString(d->executable->text());
r.commandLineArguments = d->arguments->text(); r.commandLineArguments = d->arguments->text();
r.workingDirectory = d->workingDirectory->text(); r.workingDirectory = d->workingDirectory->text();
return r; return r;

View File

@@ -349,7 +349,7 @@ void CdbEngine::setupEngine()
return; return;
} }
bool cdbIs64Bit = Utils::is64BitWindowsBinary(sp.debugger.executable); bool cdbIs64Bit = Utils::is64BitWindowsBinary(sp.debugger.executable.toString());
if (!cdbIs64Bit) if (!cdbIs64Bit)
m_wow64State = noWow64Stack; m_wow64State = noWow64Stack;
const QFileInfo extensionFi(CdbEngine::extensionLibraryName(cdbIs64Bit)); const QFileInfo extensionFi(CdbEngine::extensionLibraryName(cdbIs64Bit));
@@ -369,7 +369,7 @@ void CdbEngine::setupEngine()
} }
// Prepare command line. // Prepare command line.
CommandLine debugger{FilePath::fromString(sp.debugger.executable)}; CommandLine debugger{sp.debugger.executable};
const QString extensionFileName = extensionFi.fileName(); const QString extensionFileName = extensionFi.fileName();
const bool isRemote = sp.startMode == AttachToRemoteServer; const bool isRemote = sp.startMode == AttachToRemoteServer;
@@ -406,7 +406,7 @@ void CdbEngine::setupEngine()
switch (sp.startMode) { switch (sp.startMode) {
case StartInternal: case StartInternal:
case StartExternal: case StartExternal:
debugger.addArg(QDir::toNativeSeparators(sp.inferior.executable)); debugger.addArg(sp.inferior.executable.toUserOutput());
// Complete native argument string. // Complete native argument string.
debugger.addArgs(sp.inferior.commandLineArguments, CommandLine::Raw); debugger.addArgs(sp.inferior.commandLineArguments, CommandLine::Raw);
break; break;
@@ -491,8 +491,7 @@ void CdbEngine::handleInitialSessionIdle()
if (rp.breakOnMain) { if (rp.breakOnMain) {
BreakpointParameters bp(BreakpointAtMain); BreakpointParameters bp(BreakpointAtMain);
if (rp.startMode == StartInternal || rp.startMode == StartExternal) { if (rp.startMode == StartInternal || rp.startMode == StartExternal) {
const QString &moduleFileName = Utils::FilePath::fromString(rp.inferior.executable) const QString &moduleFileName = rp.inferior.executable.fileName();
.fileName();
bp.module = moduleFileName.left(moduleFileName.indexOf('.')); bp.module = moduleFileName.left(moduleFileName.indexOf('.'));
} }
QString function = cdbAddBreakpointCommand(bp, m_sourcePathMappings); QString function = cdbAddBreakpointCommand(bp, m_sourcePathMappings);
@@ -826,7 +825,7 @@ void CdbEngine::doInterruptInferior(const InterruptCallback &callback)
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished, connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
this, &CdbEngine::handleDoInterruptInferior); this, &CdbEngine::handleDoInterruptInferior);
m_signalOperation->setDebuggerCommand(runParameters().debugger.executable); m_signalOperation->setDebuggerCommand(runParameters().debugger.executable.toString());
m_signalOperation->interruptProcess(inferiorPid()); m_signalOperation->interruptProcess(inferiorPid());
} }

View File

@@ -142,7 +142,7 @@ QString StartApplicationParameters::displayName() const
{ {
const int maxLength = 60; const int maxLength = 60;
QString name = FilePath::fromString(runnable.executable).fileName() QString name = runnable.executable.fileName()
+ ' ' + runnable.commandLineArguments; + ' ' + runnable.commandLineArguments;
if (name.size() > 60) { if (name.size() > 60) {
int index = name.lastIndexOf(' ', maxLength); int index = name.lastIndexOf(' ', maxLength);
@@ -163,7 +163,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
settings->setValue("LastKitId", kitId.toSetting()); settings->setValue("LastKitId", kitId.toSetting());
settings->setValue("LastServerPort", serverPort); settings->setValue("LastServerPort", serverPort);
settings->setValue("LastServerAddress", serverAddress); settings->setValue("LastServerAddress", serverAddress);
settings->setValue("LastExternalExecutable", runnable.executable); settings->setValue("LastExternalExecutable", runnable.executable.toVariant());
settings->setValue("LastExternalExecutableArguments", runnable.commandLineArguments); settings->setValue("LastExternalExecutableArguments", runnable.commandLineArguments);
settings->setValue("LastExternalWorkingDirectory", runnable.workingDirectory); settings->setValue("LastExternalWorkingDirectory", runnable.workingDirectory);
settings->setValue("LastExternalBreakAtMain", breakAtMain); settings->setValue("LastExternalBreakAtMain", breakAtMain);
@@ -177,7 +177,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
kitId = Id::fromSetting(settings->value("LastKitId")); kitId = Id::fromSetting(settings->value("LastKitId"));
serverPort = settings->value("LastServerPort").toUInt(); serverPort = settings->value("LastServerPort").toUInt();
serverAddress = settings->value("LastServerAddress").toString(); serverAddress = settings->value("LastServerAddress").toString();
runnable.executable = settings->value("LastExternalExecutable").toString(); runnable.executable = FilePath::fromVariant(settings->value("LastExternalExecutable"));
runnable.commandLineArguments = settings->value("LastExternalExecutableArguments").toString(); runnable.commandLineArguments = settings->value("LastExternalExecutableArguments").toString();
runnable.workingDirectory = settings->value("LastExternalWorkingDirectory").toString(); runnable.workingDirectory = settings->value("LastExternalWorkingDirectory").toString();
breakAtMain = settings->value("LastExternalBreakAtMain").toBool(); breakAtMain = settings->value("LastExternalBreakAtMain").toBool();
@@ -442,7 +442,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const
StartApplicationParameters result; StartApplicationParameters result;
result.serverPort = d->serverPortSpinBox->value(); result.serverPort = d->serverPortSpinBox->value();
result.serverAddress = d->channelOverrideEdit->text(); result.serverAddress = d->channelOverrideEdit->text();
result.runnable.executable = d->localExecutablePathChooser->path(); result.runnable.executable = d->localExecutablePathChooser->fileName();
result.serverStartScript = d->serverStartScriptPathChooser->fileName(); result.serverStartScript = d->serverStartScriptPathChooser->fileName();
result.kitId = d->kitChooser->currentKitId(); result.kitId = d->kitChooser->currentKitId();
result.debugInfoLocation = d->debuginfoPathChooser->path(); result.debugInfoLocation = d->debuginfoPathChooser->path();
@@ -458,7 +458,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
d->kitChooser->setCurrentKitId(p.kitId); d->kitChooser->setCurrentKitId(p.kitId);
d->serverPortSpinBox->setValue(p.serverPort); d->serverPortSpinBox->setValue(p.serverPort);
d->channelOverrideEdit->setText(p.serverAddress); d->channelOverrideEdit->setText(p.serverAddress);
d->localExecutablePathChooser->setPath(p.runnable.executable); d->localExecutablePathChooser->setFileName(p.runnable.executable);
d->serverStartScriptPathChooser->setFileName(p.serverStartScript); d->serverStartScriptPathChooser->setFileName(p.serverStartScript);
d->debuginfoPathChooser->setPath(p.debugInfoLocation); d->debuginfoPathChooser->setPath(p.debugInfoLocation);
d->arguments->setText(p.runnable.commandLineArguments); d->arguments->setText(p.runnable.commandLineArguments);

View File

@@ -2564,8 +2564,7 @@ QString DebuggerEngine::formatStartParameters() const
str << "qml"; str << "qml";
str << '\n'; str << '\n';
if (!sp.inferior.executable.isEmpty()) { if (!sp.inferior.executable.isEmpty()) {
str << "Executable: " << QDir::toNativeSeparators(sp.inferior.executable) str << "Executable: " << sp.inferior.commandLine().toUserOutput();
<< ' ' << sp.inferior.commandLineArguments;
if (d->m_terminalRunner) if (d->m_terminalRunner)
str << " [terminal]"; str << " [terminal]";
str << '\n'; str << '\n';
@@ -2573,9 +2572,8 @@ QString DebuggerEngine::formatStartParameters() const
str << "Directory: " << QDir::toNativeSeparators(sp.inferior.workingDirectory) str << "Directory: " << QDir::toNativeSeparators(sp.inferior.workingDirectory)
<< '\n'; << '\n';
} }
QString cmd = sp.debugger.executable; if (!sp.debugger.executable.isEmpty())
if (!cmd.isEmpty()) str << "Debugger: " << sp.debugger.executable.toUserOutput() << '\n';
str << "Debugger: " << QDir::toNativeSeparators(cmd) << '\n';
if (!sp.coreFile.isEmpty()) if (!sp.coreFile.isEmpty())
str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n'; str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n';
if (sp.attachPID.isValid()) if (sp.attachPID.isValid())
@@ -2630,11 +2628,11 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
&& rp.cppEngineType == CdbEngineType && rp.cppEngineType == CdbEngineType
&& rp.startMode != AttachToRemoteServer) { && rp.startMode != AttachToRemoteServer) {
QTC_ASSERT(!rp.symbolFile.isEmpty(), return); QTC_ASSERT(!rp.symbolFile.isEmpty(), return);
if (!rp.symbolFile.endsWith(".exe", Qt::CaseInsensitive)) if (!rp.symbolFile.toString().endsWith(".exe", Qt::CaseInsensitive))
rp.symbolFile.append(".exe"); rp.symbolFile = FileName::fromString(rp.symbolFile.toString() + ".exe");
QString errorMessage; QString errorMessage;
QStringList rc; QStringList rc;
if (getPDBFiles(rp.symbolFile, &rc, &errorMessage) && !rc.isEmpty()) if (getPDBFiles(rp.symbolFile.toString(), &rc, &errorMessage) && !rc.isEmpty())
return; return;
if (!errorMessage.isEmpty()) { if (!errorMessage.isEmpty()) {
detailedWarning.append('\n'); detailedWarning.append('\n');
@@ -2655,11 +2653,11 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
break; break;
} }
Utils::ElfReader reader(rp.symbolFile); Utils::ElfReader reader(rp.symbolFile.toString());
const ElfData elfData = reader.readHeaders(); const ElfData elfData = reader.readHeaders();
const QString error = reader.errorString(); const QString error = reader.errorString();
showMessage("EXAMINING " + rp.symbolFile, LogDebug); showMessage("EXAMINING " + rp.symbolFile.toString(), LogDebug);
QByteArray msg = "ELF SECTIONS: "; QByteArray msg = "ELF SECTIONS: ";
static const QList<QByteArray> interesting = { static const QList<QByteArray> interesting = {

View File

@@ -128,7 +128,7 @@ public:
// Used by general remote debugging. // Used by general remote debugging.
QString remoteChannel; QString remoteChannel;
bool useExtendedRemote = false; // Whether to use GDB's target extended-remote or not. bool useExtendedRemote = false; // Whether to use GDB's target extended-remote or not.
QString symbolFile; Utils::FilePath symbolFile;
// Used by Mer plugin (3rd party) // Used by Mer plugin (3rd party)
QMap<QString, QString> sourcePathMap; QMap<QString, QString> sourcePathMap;

View File

@@ -335,7 +335,7 @@ Runnable DebuggerKitAspect::runnable(const Kit *kit)
{ {
Runnable runnable; Runnable runnable;
if (const DebuggerItem *item = debugger(kit)) { if (const DebuggerItem *item = debugger(kit)) {
runnable.executable = item->command().toString(); runnable.executable = item->command();
runnable.workingDirectory = item->workingDirectory().toString(); runnable.workingDirectory = item->workingDirectory().toString();
runnable.environment = Utils::Environment::systemEnvironment(); runnable.environment = Utils::Environment::systemEnvironment();
runnable.environment.set("LC_NUMERIC", "C"); runnable.environment.set("LC_NUMERIC", "C");

View File

@@ -851,7 +851,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
Kit *kit = nullptr; Kit *kit = nullptr;
DebuggerStartMode startMode = StartExternal; DebuggerStartMode startMode = StartExternal;
QString executable; FilePath executable;
QString remoteChannel; QString remoteChannel;
QString coreFile; QString coreFile;
bool useTerminal = false; bool useTerminal = false;
@@ -864,7 +864,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
if (key.isEmpty()) { if (key.isEmpty()) {
continue; continue;
} else if (executable.isEmpty()) { } else if (executable.isEmpty()) {
executable = key; executable = FilePath::fromString(key);
} else { } else {
*errorMessage = DebuggerPlugin::tr("Only one executable allowed."); *errorMessage = DebuggerPlugin::tr("Only one executable allowed.");
return false; return false;
@@ -885,7 +885,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
} }
} }
if (!kit) if (!kit)
kit = guessKitFromAbis(Abi::abisOfBinary(FilePath::fromString(executable))); kit = guessKitFromAbis(Abi::abisOfBinary(executable));
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
runControl->setKit(kit); runControl->setKit(kit);
@@ -910,8 +910,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile)); debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile));
} else { } else {
debugger->setStartMode(StartExternal); debugger->setStartMode(StartExternal);
debugger->setRunControlName(tr("Executable file \"%1\"").arg(executable)); debugger->setRunControlName(tr("Executable file \"%1\"").arg(executable.toUserOutput()));
debugger->setStartMessage(tr("Debugging file %1.").arg(executable)); debugger->setStartMessage(tr("Debugging file %1.").arg(executable.toUserOutput()));
} }
debugger->setUseTerminal(useTerminal); debugger->setUseTerminal(useTerminal);
@@ -1588,7 +1588,7 @@ void DebuggerPluginPrivate::attachCore()
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted)
return; return;
setConfigValue("LastExternalExecutableFile", dlg.symbolFile()); setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toVariant());
setConfigValue("LastLocalCoreFile", dlg.localCoreFile()); setConfigValue("LastLocalCoreFile", dlg.localCoreFile());
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile()); setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting()); setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
@@ -1743,7 +1743,7 @@ RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
runControl->setDisplayName(tr("Process %1").arg(process.pid)); runControl->setDisplayName(tr("Process %1").arg(process.pid));
auto debugger = new DebuggerRunTool(runControl); auto debugger = new DebuggerRunTool(runControl);
debugger->setAttachPid(ProcessHandle(process.pid)); debugger->setAttachPid(ProcessHandle(process.pid));
debugger->setInferiorExecutable(process.exe); debugger->setInferiorExecutable(FilePath::fromString(process.exe));
debugger->setInferiorDevice(device); debugger->setInferiorDevice(device);
debugger->setStartMode(AttachExternal); debugger->setStartMode(AttachExternal);
debugger->setCloseMode(DetachAtClose); debugger->setCloseMode(DetachAtClose);

View File

@@ -316,7 +316,7 @@ void DebuggerRunTool::setSysRoot(const Utils::FilePath &sysRoot)
m_runParameters.sysRoot = sysRoot; m_runParameters.sysRoot = sysRoot;
} }
void DebuggerRunTool::setSymbolFile(const QString &symbolFile) void DebuggerRunTool::setSymbolFile(const FilePath &symbolFile)
{ {
if (symbolFile.isEmpty()) if (symbolFile.isEmpty())
reportFailure(tr("Cannot debug: Local executable is not set.")); reportFailure(tr("Cannot debug: Local executable is not set."));
@@ -404,8 +404,9 @@ void DebuggerRunTool::setServerStartScript(const FilePath &serverStartScript)
{ {
if (!serverStartScript.isEmpty()) { if (!serverStartScript.isEmpty()) {
// Provide script information about the environment // Provide script information about the environment
CommandLine serverStarter(serverStartScript, {}); const CommandLine serverStarter(serverStartScript,
serverStarter.addArgs({m_runParameters.inferior.executable, m_runParameters.remoteChannel}); {m_runParameters.inferior.executable.toString(),
m_runParameters.remoteChannel});
addStartDependency(new LocalProcessRunner(this, serverStarter)); addStartDependency(new LocalProcessRunner(this, serverStarter));
} }
} }
@@ -450,7 +451,7 @@ void DebuggerRunTool::setInferior(const Runnable &runnable)
m_runParameters.inferior = runnable; m_runParameters.inferior = runnable;
} }
void DebuggerRunTool::setInferiorExecutable(const QString &executable) void DebuggerRunTool::setInferiorExecutable(const FilePath &executable)
{ {
m_runParameters.inferior.executable = executable; m_runParameters.inferior.executable = executable;
} }
@@ -565,19 +566,19 @@ void DebuggerRunTool::start()
return; return;
if (m_runParameters.cppEngineType == CdbEngineType if (m_runParameters.cppEngineType == CdbEngineType
&& Utils::is64BitWindowsBinary(m_runParameters.inferior.executable) && Utils::is64BitWindowsBinary(m_runParameters.inferior.executable.toString())
&& !Utils::is64BitWindowsBinary(m_runParameters.debugger.executable)) { && !Utils::is64BitWindowsBinary(m_runParameters.debugger.executable.toString())) {
reportFailure( reportFailure(
DebuggerPlugin::tr( DebuggerPlugin::tr(
"%1 is a 64 bit executable which can not be debugged by a 32 bit Debugger.\n" "%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.") "Please select a 64 bit Debugger in the kit settings for this kit.")
.arg(m_runParameters.inferior.executable)); .arg(m_runParameters.inferior.executable.toUserOutput()));
return; return;
} }
Utils::globalMacroExpander()->registerFileVariables( Utils::globalMacroExpander()->registerFileVariables(
"DebuggedExecutable", tr("Debugged executable"), "DebuggedExecutable", tr("Debugged executable"),
[this] { return m_runParameters.inferior.executable; } [this] { return m_runParameters.inferior.executable.toString(); }
); );
runControl()->setDisplayName(m_runParameters.displayName); runControl()->setDisplayName(m_runParameters.displayName);
@@ -911,7 +912,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
m_runParameters.displayName = runControl->displayName(); m_runParameters.displayName = runControl->displayName();
if (auto symbolsAspect = runControl->aspect<SymbolFileAspect>()) if (auto symbolsAspect = runControl->aspect<SymbolFileAspect>())
m_runParameters.symbolFile = symbolsAspect->value(); m_runParameters.symbolFile = symbolsAspect->fileName();
if (auto terminalAspect = runControl->aspect<TerminalAspect>()) if (auto terminalAspect = runControl->aspect<TerminalAspect>())
m_runParameters.useTerminal = terminalAspect->useTerminal(); m_runParameters.useTerminal = terminalAspect->useTerminal();
@@ -941,7 +942,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH"); const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");
if (!envBinary.isEmpty()) if (!envBinary.isEmpty())
m_runParameters.debugger.executable = QString::fromLocal8Bit(envBinary); m_runParameters.debugger.executable = FileName::fromString(QString::fromLocal8Bit(envBinary));
if (Project *project = runControl->project()) { if (Project *project = runControl->project()) {
m_runParameters.projectSourceDirectory = project->projectDirectory(); m_runParameters.projectSourceDirectory = project->projectDirectory();
@@ -1116,9 +1117,9 @@ void GdbServerRunner::start()
if (isQmlDebugging && !isCppDebugging) { if (isQmlDebugging && !isCppDebugging) {
gdbserver.executable = m_runnable.executable; // FIXME: Case should not happen? gdbserver.executable = m_runnable.executable; // FIXME: Case should not happen?
} else { } else {
gdbserver.executable = device()->debugServerPath(); gdbserver.executable = FileName::fromString(device()->debugServerPath());
if (gdbserver.executable.isEmpty()) if (gdbserver.executable.isEmpty())
gdbserver.executable = "gdbserver"; gdbserver.executable = FileName::fromString("gdbserver");
args.clear(); args.clear();
if (m_useMulti) if (m_useMulti)
args.append("--multi"); args.append("--multi");

View File

@@ -72,7 +72,7 @@ public:
static void setBreakOnMainNextTime(); static void setBreakOnMainNextTime();
void setInferior(const ProjectExplorer::Runnable &runnable); void setInferior(const ProjectExplorer::Runnable &runnable);
void setInferiorExecutable(const QString &executable); void setInferiorExecutable(const Utils::FilePath &executable);
void setInferiorEnvironment(const Utils::Environment &env); // Used by GammaRay plugin void setInferiorEnvironment(const Utils::Environment &env); // Used by GammaRay plugin
void setInferiorDevice(ProjectExplorer::IDevice::ConstPtr device); // Used by cdbengine void setInferiorDevice(ProjectExplorer::IDevice::ConstPtr device); // Used by cdbengine
void setRunControlName(const QString &name); void setRunControlName(const QString &name);
@@ -93,7 +93,7 @@ public:
void setAttachPid(qint64 pid); void setAttachPid(qint64 pid);
void setSysRoot(const Utils::FilePath &sysRoot); void setSysRoot(const Utils::FilePath &sysRoot);
void setSymbolFile(const QString &symbolFile); void setSymbolFile(const Utils::FilePath &symbolFile);
void setRemoteChannel(const QString &channel); void setRemoteChannel(const QString &channel);
void setRemoteChannel(const QString &host, int port); void setRemoteChannel(const QString &host, int port);
void setRemoteChannel(const QUrl &url); void setRemoteChannel(const QUrl &url);

View File

@@ -245,7 +245,7 @@ QVariant EngineItem::data(int column, int role) const
return myName; return myName;
} }
case 1: case 1:
return rp.coreFile.isEmpty() ? rp.inferior.executable : rp.coreFile; return rp.coreFile.isEmpty() ? rp.inferior.executable.toUserOutput() : rp.coreFile;
} }
return QVariant(); return QVariant();

View File

@@ -685,7 +685,7 @@ void GdbEngine::interruptInferior()
notifyInferiorStopFailed(); notifyInferiorStopFailed();
} }
}); });
signalOperation->setDebuggerCommand(runParameters().debugger.executable); signalOperation->setDebuggerCommand(runParameters().debugger.executable.toString());
signalOperation->interruptProcess(inferiorPid()); signalOperation->interruptProcess(inferiorPid());
} else { } else {
interruptInferior2(); interruptInferior2();
@@ -1700,8 +1700,7 @@ void GdbEngine::setLinuxOsAbi()
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
bool isElf = (rp.toolChainAbi.binaryFormat() == Abi::ElfFormat); bool isElf = (rp.toolChainAbi.binaryFormat() == Abi::ElfFormat);
if (!isElf && !rp.inferior.executable.isEmpty()) { if (!isElf && !rp.inferior.executable.isEmpty()) {
isElf = Utils::anyOf(Abi::abisOfBinary(FilePath::fromString(rp.inferior.executable)), isElf = Utils::anyOf(Abi::abisOfBinary(rp.inferior.executable), [](const Abi &abi) {
[](const Abi &abi) {
return abi.binaryFormat() == Abi::ElfFormat; return abi.binaryFormat() == Abi::ElfFormat;
}); });
} }
@@ -3524,7 +3523,7 @@ void GdbEngine::setupEngine()
m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX m_gdbProc.setUseCtrlCStub(runParameters().useCtrlCStub); // This is only set for QNX
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
CommandLine gdbCommand{FilePath::fromString(rp.debugger.executable), {}}; CommandLine gdbCommand{rp.debugger.executable};
if (isPlainEngine()) { if (isPlainEngine()) {
if (!m_outputCollector.listen()) { if (!m_outputCollector.listen()) {
@@ -3636,7 +3635,7 @@ void GdbEngine::setupEngine()
Module module; Module module;
module.startAddress = 0; module.startAddress = 0;
module.endAddress = 0; module.endAddress = 0;
module.modulePath = rp.inferior.executable; module.modulePath = rp.inferior.executable.toString();
module.moduleName = "<executable>"; module.moduleName = "<executable>";
modulesHandler()->updateModule(module); modulesHandler()->updateModule(module);
@@ -3686,7 +3685,7 @@ void GdbEngine::setupEngine()
//if (terminal()->isUsable()) //if (terminal()->isUsable())
// runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())});
const QFileInfo gdbBinaryFile(rp.debugger.executable); const QFileInfo gdbBinaryFile = rp.debugger.executable.toFileInfo();
const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python"; const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python";
runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')"}); runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')"});
@@ -3763,8 +3762,7 @@ void GdbEngine::reloadDebuggingHelpers()
void GdbEngine::handleGdbError(QProcess::ProcessError error) void GdbEngine::handleGdbError(QProcess::ProcessError error)
{ {
const QString program = runParameters().debugger.executable; QString msg = RunWorker::userMessageForProcessError(error, runParameters().debugger.executable);
QString msg = RunWorker::userMessageForProcessError(error, program);
QString errorString = m_gdbProc.errorString(); QString errorString = m_gdbProc.errorString();
if (!errorString.isEmpty()) if (!errorString.isEmpty())
msg += '\n' + errorString; msg += '\n' + errorString;
@@ -4062,10 +4060,8 @@ void GdbEngine::setupInferior()
setLinuxOsAbi(); setLinuxOsAbi();
QString symbolFile; QString symbolFile;
if (!rp.symbolFile.isEmpty()) { if (!rp.symbolFile.isEmpty())
QFileInfo fi(rp.symbolFile); symbolFile = rp.symbolFile.toFileInfo().absoluteFilePath();
symbolFile = fi.absoluteFilePath();
}
//const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray sysroot = sp.sysroot.toLocal8Bit();
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); //const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
@@ -4122,7 +4118,7 @@ void GdbEngine::setupInferior()
setLinuxOsAbi(); setLinuxOsAbi();
QString executable = rp.inferior.executable; FilePath executable = rp.inferior.executable;
if (executable.isEmpty()) { if (executable.isEmpty()) {
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile); CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile);
@@ -4134,7 +4130,7 @@ void GdbEngine::setupInferior()
return; return;
} }
executable = cinfo.foundExecutableName; executable = FilePath::fromString(cinfo.foundExecutableName);
if (executable.isEmpty()) { if (executable.isEmpty()) {
AsynchronousMessageBox::warning(tr("Error Loading Symbols"), AsynchronousMessageBox::warning(tr("Error Loading Symbols"),
tr("No executable to load symbols from specified core.")); tr("No executable to load symbols from specified core."));
@@ -4144,7 +4140,7 @@ void GdbEngine::setupInferior()
} }
// Do that first, otherwise no symbols are loaded. // Do that first, otherwise no symbols are loaded.
QFileInfo fi(executable); QFileInfo fi = executable.toFileInfo();
QString path = fi.absoluteFilePath(); QString path = fi.absoluteFilePath();
runCommand({"-file-exec-and-symbols \"" + path + '"', runCommand({"-file-exec-and-symbols \"" + path + '"',
CB(handleFileExecAndSymbols)}); CB(handleFileExecAndSymbols)});
@@ -4170,7 +4166,7 @@ void GdbEngine::setupInferior()
runCommand({"-exec-arguments " + args}); runCommand({"-exec-arguments " + args});
} }
QString executable = QFileInfo(runParameters().inferior.executable).absoluteFilePath(); QString executable = runParameters().inferior.executable.toFileInfo().absoluteFilePath();
runCommand({"-file-exec-and-symbols \"" + executable + '"', runCommand({"-file-exec-and-symbols \"" + executable + '"',
CB(handleFileExecAndSymbols)}); CB(handleFileExecAndSymbols)});
} }
@@ -4494,7 +4490,7 @@ void GdbEngine::handleTargetExtendedRemote(const DebuggerResponse &response)
runCommand({"attach " + QString::number(runParameters().attachPID.pid()), runCommand({"attach " + QString::number(runParameters().attachPID.pid()),
CB(handleTargetExtendedAttach)}); CB(handleTargetExtendedAttach)});
} else if (!runParameters().inferior.executable.isEmpty()) { } else if (!runParameters().inferior.executable.isEmpty()) {
runCommand({"-gdb-set remote exec-file " + runParameters().inferior.executable, runCommand({"-gdb-set remote exec-file " + runParameters().inferior.executable.toString(),
CB(handleTargetExtendedAttach)}); CB(handleTargetExtendedAttach)});
} else { } else {
const QString title = tr("No Remote Executable or Process ID Specified"); const QString title = tr("No Remote Executable or Process ID Specified");
@@ -4541,11 +4537,11 @@ void GdbEngine::handleTargetQnx(const DebuggerResponse &response)
showMessage(msgAttachedToStoppedInferior(), StatusBar); showMessage(msgAttachedToStoppedInferior(), StatusBar);
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
const QString remoteExecutable = rp.inferior.executable;
if (rp.attachPID.isValid()) if (rp.attachPID.isValid())
runCommand({"attach " + QString::number(rp.attachPID.pid()), CB(handleAttach)}); runCommand({"attach " + QString::number(rp.attachPID.pid()), CB(handleAttach)});
else if (!remoteExecutable.isEmpty()) else if (!rp.inferior.executable.isEmpty())
runCommand({"set nto-executable " + remoteExecutable, CB(handleSetNtoExecutable)}); runCommand({"set nto-executable " + rp.inferior.executable.toString(),
CB(handleSetNtoExecutable)});
else else
handleInferiorPrepared(); handleInferiorPrepared();
} else { } else {
@@ -4679,8 +4675,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
QStringList envLang = QProcess::systemEnvironment(); QStringList envLang = QProcess::systemEnvironment();
Utils::Environment::setupEnglishOutput(&envLang); Utils::Environment::setupEnglishOutput(&envLang);
proc.setEnvironment(envLang); proc.setEnvironment(envLang);
SynchronousProcessResponse response SynchronousProcessResponse response = proc.runBlocking({debugger.executable, args});
= proc.runBlocking({FilePath::fromString(debugger.executable), args});
if (response.result == SynchronousProcessResponse::Finished) { if (response.result == SynchronousProcessResponse::Finished) {
QString output = response.stdOut(); QString output = response.stdOut();

View File

@@ -200,19 +200,19 @@ void LldbEngine::setupEngine()
{ {
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
QString lldbCmd = runParameters().debugger.executable; const FilePath lldbCmd = runParameters().debugger.executable;
showMessage("STARTING LLDB: " + lldbCmd); showMessage("STARTING LLDB: " + lldbCmd.toUserOutput());
m_lldbProc.setEnvironment(runParameters().debugger.environment); m_lldbProc.setEnvironment(runParameters().debugger.environment);
if (QFileInfo(runParameters().debugger.workingDirectory).isDir()) if (QFileInfo(runParameters().debugger.workingDirectory).isDir())
m_lldbProc.setWorkingDirectory(runParameters().debugger.workingDirectory); m_lldbProc.setWorkingDirectory(runParameters().debugger.workingDirectory);
m_lldbProc.setCommand(CommandLine(FilePath::fromString(lldbCmd))); m_lldbProc.setCommand(CommandLine(lldbCmd));
m_lldbProc.start(); m_lldbProc.start();
if (!m_lldbProc.waitForStarted()) { if (!m_lldbProc.waitForStarted()) {
const QString msg = tr("Unable to start LLDB \"%1\": %2") const QString msg = tr("Unable to start LLDB \"%1\": %2")
.arg(lldbCmd, m_lldbProc.errorString()); .arg(lldbCmd.toUserOutput(), m_lldbProc.errorString());
notifyEngineSetupFailed(); notifyEngineSetupFailed();
showMessage("ADAPTER START FAILED"); showMessage("ADAPTER START FAILED");
if (!msg.isEmpty()) if (!msg.isEmpty())
@@ -268,7 +268,7 @@ void LldbEngine::setupEngine()
} }
DebuggerCommand cmd2("setupInferior"); DebuggerCommand cmd2("setupInferior");
cmd2.arg("executable", rp.inferior.executable); cmd2.arg("executable", rp.inferior.executable.toString());
cmd2.arg("breakonmain", rp.breakOnMain); cmd2.arg("breakonmain", rp.breakOnMain);
cmd2.arg("useterminal", bool(terminal())); cmd2.arg("useterminal", bool(terminal()));
cmd2.arg("startmode", rp.startMode); cmd2.arg("startmode", rp.startMode);
@@ -814,7 +814,7 @@ QString LldbEngine::errorMessage(QProcess::ProcessError error) const
return tr("The LLDB process failed to start. Either the " return tr("The LLDB process failed to start. Either the "
"invoked program \"%1\" is missing, or you may have insufficient " "invoked program \"%1\" is missing, or you may have insufficient "
"permissions to invoke the program.") "permissions to invoke the program.")
.arg(runParameters().debugger.executable); .arg(runParameters().debugger.executable.toUserOutput());
case QProcess::Crashed: case QProcess::Crashed:
return tr("The LLDB process crashed some time after starting " return tr("The LLDB process crashed some time after starting "
"successfully."); "successfully.");

View File

@@ -416,9 +416,9 @@ QString AttachCoreDialog::localCoreFile() const
return d->localCoreFileName->path(); return d->localCoreFileName->path();
} }
QString AttachCoreDialog::symbolFile() const FilePath AttachCoreDialog::symbolFile() const
{ {
return d->symbolFileName->path(); return d->symbolFileName->fileName();
} }
void AttachCoreDialog::setSymbolFile(const QString &symbolFileName) void AttachCoreDialog::setSymbolFile(const QString &symbolFileName)

View File

@@ -29,6 +29,7 @@
namespace Core { class Id; } namespace Core { class Id; }
namespace ProjectExplorer { class Kit; } namespace ProjectExplorer { class Kit; }
namespace Utils { class FilePath; }
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -45,7 +46,7 @@ public:
int exec() override; int exec() override;
QString symbolFile() const; Utils::FilePath symbolFile() const;
QString localCoreFile() const; QString localCoreFile() const;
QString remoteCoreFile() const; QString remoteCoreFile() const;
QString overrideStartScript() const; QString overrideStartScript() const;

View File

@@ -539,9 +539,8 @@ void QmlEngine::startApplicationLauncher()
{ {
if (!d->applicationLauncher.isRunning()) { if (!d->applicationLauncher.isRunning()) {
const Runnable runnable = runParameters().inferior; const Runnable runnable = runParameters().inferior;
showMessage(tr("Starting %1 %2").arg(QDir::toNativeSeparators(runnable.executable), showMessage(tr("Starting %1").arg(runnable.commandLine().toUserOutput()),
runnable.commandLineArguments), NormalMessageFormat);
Utils::NormalMessageFormat);
d->applicationLauncher.start(runnable); d->applicationLauncher.start(runnable);
} }
} }

View File

@@ -122,7 +122,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
if (isLocal(runConfig)) { if (isLocal(runConfig)) {
resetExecutable->setEnabled(true); resetExecutable->setEnabled(true);
connect(resetExecutable, &QPushButton::clicked, this, [this, runnable] { connect(resetExecutable, &QPushButton::clicked, this, [this, runnable] {
m_pathChooser->setPath(runnable.executable); m_pathChooser->setFileName(runnable.executable);
}); });
} }
} }
@@ -201,7 +201,7 @@ void UnstartedAppWatcherDialog::selectExecutable()
if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) { if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {
const Runnable runnable = runConfig->runnable(); const Runnable runnable = runConfig->runnable();
if (isLocal(runConfig)) if (isLocal(runConfig))
path = QFileInfo(runnable.executable).path(); path = runnable.executable.toFileInfo().path();
} }
} }

View File

@@ -384,7 +384,7 @@ IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl)
auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration()); auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
Runnable runnable; Runnable runnable;
runnable.executable = iosRunConfig->localExecutable().toUserOutput(); runnable.executable = iosRunConfig->localExecutable();
runnable.commandLineArguments = runnable.commandLineArguments =
runControl->aspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander()); runControl->aspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander());
runControl->setDisplayName(iosRunConfig->applicationName()); runControl->setDisplayName(iosRunConfig->applicationName());
@@ -480,7 +480,7 @@ void IosDebugSupport::start()
const bool cppDebug = isCppDebugging(); const bool cppDebug = isCppDebugging();
const bool qmlDebug = isQmlDebugging(); const bool qmlDebug = isQmlDebugging();
if (cppDebug) { if (cppDebug) {
setInferiorExecutable(iosRunConfig->localExecutable().toString()); setInferiorExecutable(iosRunConfig->localExecutable());
setRemoteChannel("connect://localhost:" + gdbServerPort.toString()); setRemoteChannel("connect://localhost:" + gdbServerPort.toString());
QString bundlePath = iosRunConfig->bundleDirectory().toString(); QString bundlePath = iosRunConfig->bundleDirectory().toString();

View File

@@ -187,7 +187,7 @@ void PerfConfigWidget::readTracePoints()
messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (messageBox.exec() == QMessageBox::Yes) { if (messageBox.exec() == QMessageBox::Yes) {
ProjectExplorer::Runnable runnable; ProjectExplorer::Runnable runnable;
runnable.executable = QLatin1String("perf"); runnable.executable = Utils::FilePath::fromString("perf");
runnable.commandLineArguments = QLatin1String("probe -l"); runnable.commandLineArguments = QLatin1String("probe -l");
m_process->start(runnable); m_process->start(runnable);

View File

@@ -150,11 +150,11 @@ public:
QStringList arguments; QStringList arguments;
arguments << "record"; arguments << "record";
arguments += m_perfRecordArguments; arguments += m_perfRecordArguments;
arguments << "-o" << "-" << "--" << perfRunnable.executable arguments << "-o" << "-" << "--" << perfRunnable.executable.toString()
<< Utils::QtcProcess::splitArgs(perfRunnable.commandLineArguments, << Utils::QtcProcess::splitArgs(perfRunnable.commandLineArguments,
Utils::OsTypeLinux); Utils::OsTypeLinux);
perfRunnable.executable = "perf"; perfRunnable.executable = FilePath::fromString("perf");
perfRunnable.commandLineArguments = Utils::QtcProcess::joinArgs(arguments, perfRunnable.commandLineArguments = Utils::QtcProcess::joinArgs(arguments,
Utils::OsTypeLinux); Utils::OsTypeLinux);
m_process->start(perfRunnable); m_process->start(perfRunnable);

View File

@@ -106,10 +106,10 @@ void PerfTracePointDialog::runScript()
Runnable runnable; Runnable runnable;
const QString elevate = m_ui->privilegesChooser->currentText(); const QString elevate = m_ui->privilegesChooser->currentText();
if (elevate != QLatin1String("n.a.")) { if (elevate != QLatin1String("n.a.")) {
runnable.executable = elevate; runnable.executable = Utils::FileName::fromString(elevate);
runnable.commandLineArguments = "sh"; runnable.commandLineArguments = "sh";
} else { } else {
runnable.executable = "sh"; runnable.executable = Utils::FileName::fromString("sh");
} }
connect(m_process.get(), &DeviceProcess::started, connect(m_process.get(), &DeviceProcess::started,

View File

@@ -261,8 +261,8 @@ Runnable CustomExecutableRunConfiguration::runnable() const
r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
if (!r.executable.isEmpty()) { if (!r.executable.isEmpty()) {
QString expanded = macroExpander()->expand(r.executable); const QString expanded = macroExpander()->expand(r.executable.toString());
r.executable = r.environment.searchInPath(expanded, {workingDirectory}).toString(); r.executable = r.environment.searchInPath(expanded, {workingDirectory});
} }
return r; return r;

View File

@@ -137,10 +137,10 @@ class DesktopPortsGatheringMethod : public PortsGatheringMethod
Runnable runnable; Runnable runnable;
if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost()) { if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost()) {
runnable.executable = "netstat"; runnable.executable = FilePath::fromString("netstat");
runnable.commandLineArguments = "-a -n"; runnable.commandLineArguments = "-a -n";
} else if (HostOsInfo::isLinuxHost()) { } else if (HostOsInfo::isLinuxHost()) {
runnable.executable = "/bin/sh"; runnable.executable = FilePath::fromString("/bin/sh");
runnable.commandLineArguments = "-c 'cat /proc/net/tcp*'"; runnable.commandLineArguments = "-c 'cat /proc/net/tcp*'";
} }
return runnable; return runnable;

View File

@@ -54,7 +54,7 @@ void DesktopDeviceProcess::start(const Runnable &runnable)
QTC_ASSERT(m_process.state() == QProcess::NotRunning, return); QTC_ASSERT(m_process.state() == QProcess::NotRunning, return);
m_process.setProcessEnvironment(runnable.environment.toProcessEnvironment()); m_process.setProcessEnvironment(runnable.environment.toProcessEnvironment());
m_process.setWorkingDirectory(runnable.workingDirectory); m_process.setWorkingDirectory(runnable.workingDirectory);
m_process.start(runnable.executable, m_process.start(runnable.executable.toString(),
Utils::QtcProcess::splitArgs(runnable.commandLineArguments)); Utils::QtcProcess::splitArgs(runnable.commandLineArguments));
} }

View File

@@ -300,7 +300,7 @@ void SshDeviceProcess::handleKillOperationTimeout()
QString SshDeviceProcess::fullCommandLine(const Runnable &runnable) const QString SshDeviceProcess::fullCommandLine(const Runnable &runnable) const
{ {
QString cmdLine = runnable.executable; QString cmdLine = runnable.executable.toString();
if (!runnable.commandLineArguments.isEmpty()) if (!runnable.commandLineArguments.isEmpty())
cmdLine.append(QLatin1Char(' ')).append(runnable.commandLineArguments); cmdLine.append(QLatin1Char(' ')).append(runnable.commandLineArguments);
return cmdLine; return cmdLine;
@@ -327,7 +327,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal)
if (processId != 0) if (processId != 0)
signalOperation->interruptProcess(processId); signalOperation->interruptProcess(processId);
else else
signalOperation->interruptProcess(runnable.executable); signalOperation->interruptProcess(runnable.executable.toString());
} else { } else {
if (killOperation) // We are already in the process of killing the app. if (killOperation) // We are already in the process of killing the app.
return; return;
@@ -338,7 +338,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal)
if (processId != 0) if (processId != 0)
signalOperation->killProcess(processId); signalOperation->killProcess(processId);
else else
signalOperation->killProcess(runnable.executable); signalOperation->killProcess(runnable.executable.toString());
} }
break; break;
} }

View File

@@ -2634,7 +2634,7 @@ int ProjectExplorerPluginPrivate::queue(QList<Project *> projects, QList<Id> ste
BuildConfiguration *bc = t ? t->activeBuildConfiguration() : nullptr; BuildConfiguration *bc = t ? t->activeBuildConfiguration() : nullptr;
if (!bc) if (!bc)
return false; return false;
if (!Utils::FilePath::fromString(rc->runnable().executable).isChildOf(bc->buildDirectory())) if (!rc->runnable().executable.isChildOf(bc->buildDirectory()))
return false; return false;
IDevice::ConstPtr device = rc->runnable().device; IDevice::ConstPtr device = rc->runnable().device;
if (device.isNull()) if (device.isNull())

View File

@@ -1119,8 +1119,7 @@ void SimpleTargetRunner::start()
connect(&m_launcher, &ApplicationLauncher::error, connect(&m_launcher, &ApplicationLauncher::error,
this, &SimpleTargetRunner::onProcessError); this, &SimpleTargetRunner::onProcessError);
const QString executable = m_runnable.executable; if (m_runnable.executable.isEmpty()) {
if (executable.isEmpty()) {
reportFailure(RunControl::tr("No executable specified.")); reportFailure(RunControl::tr("No executable specified."));
} else { } else {
m_launcher.start(m_runnable); m_launcher.start(m_runnable);
@@ -1207,7 +1206,7 @@ void SimpleTargetRunner::onProcessError(QProcess::ProcessError error)
{ {
if (error == QProcess::Timedout) if (error == QProcess::Timedout)
return; // No actual change on the process side. return; // No actual change on the process side.
QString msg = userMessageForProcessError(error, m_runnable.displayName()); const QString msg = userMessageForProcessError(error, m_runnable.executable);
appendMessage(msg, Utils::NormalMessageFormat); appendMessage(msg, Utils::NormalMessageFormat);
if (!m_stopReported) { if (!m_stopReported) {
m_stopReported = true; m_stopReported = true;
@@ -1496,7 +1495,7 @@ bool RunWorker::supportsReRunning() const
return d->supportsReRunning; return d->supportsReRunning;
} }
QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, const QString &program) QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, const FilePath &program)
{ {
QString failedToStart = tr("The process failed to start."); QString failedToStart = tr("The process failed to start.");
QString msg = tr("An unknown error in the process occurred."); QString msg = tr("An unknown error in the process occurred.");
@@ -1504,7 +1503,7 @@ QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, cons
case QProcess::FailedToStart: case QProcess::FailedToStart:
msg = failedToStart + ' ' + tr("Either the " msg = failedToStart + ' ' + tr("Either the "
"invoked program \"%1\" is missing, or you may have insufficient " "invoked program \"%1\" is missing, or you may have insufficient "
"permissions to invoke the program.").arg(program); "permissions to invoke the program.").arg(program.toUserOutput());
break; break;
case QProcess::Crashed: case QProcess::Crashed:
msg = tr("The process was ended forcefully."); msg = tr("The process was ended forcefully.");
@@ -1551,12 +1550,12 @@ void RunWorker::stop()
CommandLine Runnable::commandLine() const CommandLine Runnable::commandLine() const
{ {
return CommandLine(FilePath::fromString(executable), commandLineArguments, CommandLine::Raw); return CommandLine(executable, commandLineArguments, CommandLine::Raw);
} }
void Runnable::setCommandLine(const CommandLine &cmdLine) void Runnable::setCommandLine(const CommandLine &cmdLine)
{ {
executable = cmdLine.executable().toString(); executable = cmdLine.executable();
commandLineArguments = cmdLine.arguments(); commandLineArguments = cmdLine.arguments();
} }

View File

@@ -76,7 +76,7 @@ public:
Utils::CommandLine commandLine() const; Utils::CommandLine commandLine() const;
void setCommandLine(const Utils::CommandLine &cmdLine); void setCommandLine(const Utils::CommandLine &cmdLine);
QString executable; Utils::FilePath executable;
QString commandLineArguments; QString commandLineArguments;
QString workingDirectory; QString workingDirectory;
Utils::Environment environment; Utils::Environment environment;
@@ -84,7 +84,7 @@ public:
QHash<Core::Id, QVariant> extraData; QHash<Core::Id, QVariant> extraData;
// FIXME: Not necessarily a display name // FIXME: Not necessarily a display name
QString displayName() const { return executable; } QString displayName() const { return executable.toString(); }
}; };
class PROJECTEXPLORER_EXPORT RunWorker : public QObject class PROJECTEXPLORER_EXPORT RunWorker : public QObject
@@ -126,7 +126,8 @@ public:
void setSupportsReRunning(bool reRunningSupported); void setSupportsReRunning(bool reRunningSupported);
bool supportsReRunning() const; bool supportsReRunning() const;
static QString userMessageForProcessError(QProcess::ProcessError, const QString &programName); static QString userMessageForProcessError(QProcess::ProcessError,
const Utils::FilePath &programName);
bool isEssential() const; bool isEssential() const;
void setEssential(bool essential); void setEssential(bool essential);

View File

@@ -57,7 +57,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
int runCount = 0; int runCount = 0;
int stopCount = 0; int stopCount = 0;
debuggee.executable = "\\-/|\\-/"; debuggee.executable = Utils::FilePath::fromString("\\-/|\\-/");
debuggee.environment = Utils::Environment::systemEnvironment(); debuggee.environment = Utils::Environment::systemEnvironment();
// should not be used anywhere but cannot be empty // should not be used anywhere but cannot be empty
@@ -110,7 +110,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
QVERIFY(profiler.isNull()); QVERIFY(profiler.isNull());
serverUrl = Utils::urlFromLocalSocket(); serverUrl = Utils::urlFromLocalSocket();
debuggee.executable = qApp->applicationFilePath(); debuggee.executable = Utils::FilePath::fromString(QCoreApplication::applicationFilePath());
// comma is used to specify a test function. In this case, an invalid one. // comma is used to specify a test function. In this case, an invalid one.
debuggee.commandLineArguments = QString("-test QmlProfiler,"); debuggee.commandLineArguments = QString("-test QmlProfiler,");

View File

@@ -109,7 +109,7 @@ private:
QStringList arguments; QStringList arguments;
if (m_portsGatherer->useGdbServer()) { if (m_portsGatherer->useGdbServer()) {
Port pdebugPort = m_portsGatherer->gdbServerPort(); Port pdebugPort = m_portsGatherer->gdbServerPort();
r.executable = Constants::QNX_DEBUG_EXECUTABLE; r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
arguments.append(pdebugPort.toString()); arguments.append(pdebugPort.toString());
} }
if (m_portsGatherer->useQmlServer()) { if (m_portsGatherer->useQmlServer()) {
@@ -183,7 +183,7 @@ public:
} }
QString projectSource() const { return m_projectSource->path(); } QString projectSource() const { return m_projectSource->path(); }
QString localExecutable() const { return m_localExecutable->path(); } FilePath localExecutable() const { return m_localExecutable->fileName(); }
private: private:
PathChooser *m_projectSource; PathChooser *m_projectSource;
@@ -209,7 +209,7 @@ private:
Port pdebugPort = m_portsGatherer->gdbServerPort(); Port pdebugPort = m_portsGatherer->gdbServerPort();
Runnable r; Runnable r;
r.executable = Constants::QNX_DEBUG_EXECUTABLE; r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
r.commandLineArguments = pdebugPort.toString(); r.commandLineArguments = pdebugPort.toString();
setRunnable(r); setRunnable(r);
@@ -258,10 +258,10 @@ void QnxAttachDebugSupport::showProcessesDialog()
DeviceProcessItem process = dlg.currentProcess(); DeviceProcessItem process = dlg.currentProcess();
const int pid = process.pid; const int pid = process.pid;
// QString projectSourceDirectory = dlg.projectSource(); // QString projectSourceDirectory = dlg.projectSource();
QString localExecutable = dlg.localExecutable(); FilePath localExecutable = dlg.localExecutable();
if (localExecutable.isEmpty()) { if (localExecutable.isEmpty()) {
if (auto aspect = runConfig->aspect<SymbolFileAspect>()) if (auto aspect = runConfig->aspect<SymbolFileAspect>())
localExecutable = aspect->fileName().toString(); localExecutable = aspect->fileName();
} }
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);

View File

@@ -62,7 +62,7 @@ class QnxPortsGatheringMethod : public PortsGatheringMethod
{ {
Q_UNUSED(protocol); Q_UNUSED(protocol);
Runnable runnable; Runnable runnable;
runnable.executable = "netstat"; runnable.executable = FileName::fromString("netstat");
runnable.commandLineArguments = "-na"; runnable.commandLineArguments = "-na";
return runnable; return runnable;
} }
@@ -110,7 +110,7 @@ void QnxDevice::updateVersionNumber() const
QObject::connect(&versionNumberProcess, &DeviceProcess::error, &eventLoop, &QEventLoop::quit); QObject::connect(&versionNumberProcess, &DeviceProcess::error, &eventLoop, &QEventLoop::quit);
Runnable r; Runnable r;
r.executable = QLatin1String("uname"); r.executable = FileName::fromString("uname");
r.commandLineArguments = QLatin1String("-r"); r.commandLineArguments = QLatin1String("-r");
versionNumberProcess.start(r); versionNumberProcess.start(r);

View File

@@ -47,7 +47,7 @@ QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device,
QString QnxDeviceProcess::fullCommandLine(const Runnable &runnable) const QString QnxDeviceProcess::fullCommandLine(const Runnable &runnable) const
{ {
QStringList args = QtcProcess::splitArgs(runnable.commandLineArguments); QStringList args = QtcProcess::splitArgs(runnable.commandLineArguments);
args.prepend(runnable.executable); args.prepend(runnable.executable.toString());
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString(); QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
QString fullCommandLine = QLatin1String( QString fullCommandLine = QLatin1String(
@@ -71,7 +71,7 @@ void QnxDeviceProcess::doSignal(int sig)
{ {
auto signaler = new SshDeviceProcess(device(), this); auto signaler = new SshDeviceProcess(device(), this);
Runnable r; Runnable r;
r.executable = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig); r.executable = FileName::fromString(QString("kill -%2 `cat %1`").arg(m_pidFile).arg(sig));
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater); connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
signaler->start(r); signaler->start(r);
} }

View File

@@ -73,7 +73,7 @@ void Slog2InfoRunner::printMissingWarning()
void Slog2InfoRunner::start() void Slog2InfoRunner::start()
{ {
Runnable r; Runnable r;
r.executable = QLatin1String("slog2info"); r.executable = Utils::FilePath::fromString("slog2info");
m_testProcess->start(r); m_testProcess->start(r);
reportStarted(); reportStarted();
} }
@@ -111,7 +111,7 @@ void Slog2InfoRunner::handleTestProcessCompleted()
void Slog2InfoRunner::readLaunchTime() void Slog2InfoRunner::readLaunchTime()
{ {
Runnable r; Runnable r;
r.executable = QLatin1String("date"); r.executable = Utils::FilePath::fromString("date");
r.commandLineArguments = QLatin1String("+\"%d %H:%M:%S\""); r.commandLineArguments = QLatin1String("+\"%d %H:%M:%S\"");
m_launchDateTimeProcess->start(r); m_launchDateTimeProcess->start(r);
} }
@@ -128,7 +128,7 @@ void Slog2InfoRunner::launchSlog2Info()
QString::fromLatin1("dd HH:mm:ss")); QString::fromLatin1("dd HH:mm:ss"));
Runnable r; Runnable r;
r.executable = QLatin1String("slog2info"); r.executable = Utils::FilePath::fromString("slog2info");
r.commandLineArguments = QLatin1String("-w"); r.commandLineArguments = QLatin1String("-w");
m_logProcess->start(r); m_logProcess->start(r);
} }

View File

@@ -52,6 +52,7 @@
#include <QTimer> #include <QTimer>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
@@ -145,7 +146,7 @@ class LinuxPortsGatheringMethod : public PortsGatheringMethod
// /proc/net/tcp* covers /proc/net/tcp and /proc/net/tcp6 // /proc/net/tcp* covers /proc/net/tcp and /proc/net/tcp6
Runnable runnable; Runnable runnable;
runnable.executable = "sed"; runnable.executable = FilePath::fromString("sed");
runnable.commandLineArguments runnable.commandLineArguments
= "-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*"; = "-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*";
return runnable; return runnable;
@@ -216,7 +217,7 @@ LinuxDevice::LinuxDevice()
// It seems we cannot pass an environment to OpenSSH dynamically // It seems we cannot pass an environment to OpenSSH dynamically
// without specifying an executable. // without specifying an executable.
if (env.size() > 0) if (env.size() > 0)
runnable.executable = "/bin/sh"; runnable.executable = FilePath::fromString("/bin/sh");
proc->setRunInTerminal(true); proc->setRunInTerminal(true);
proc->start(runnable); proc->start(runnable);

View File

@@ -99,7 +99,7 @@ QString LinuxDeviceProcess::fullCommandLine(const Runnable &runnable) const
if (!runInTerminal()) if (!runInTerminal())
cmd.addArg("exec"); cmd.addArg("exec");
cmd.addArg(runnable.executable); cmd.addArg(runnable.executable.toString());
cmd.addArgs(runnable.commandLineArguments, CommandLine::Raw); cmd.addArgs(runnable.commandLineArguments, CommandLine::Raw);
return cmd.arguments(); return cmd.arguments();

View File

@@ -30,6 +30,7 @@
#include <projectexplorer/runcontrol.h> #include <projectexplorer/runcontrol.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -56,7 +57,7 @@ void RemoteLinuxEnvironmentReader::start()
connect(m_deviceProcess, &DeviceProcess::finished, connect(m_deviceProcess, &DeviceProcess::finished,
this, &RemoteLinuxEnvironmentReader::remoteProcessFinished); this, &RemoteLinuxEnvironmentReader::remoteProcessFinished);
Runnable runnable; Runnable runnable;
runnable.executable = QLatin1String("env"); runnable.executable = FilePath::fromString("env");
m_deviceProcess->start(runnable); m_deviceProcess->start(runnable);
} }

View File

@@ -47,7 +47,7 @@ RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id)
Target * const theTarget = target(); Target * const theTarget = target();
QTC_ASSERT(theTarget, return CheckResult::failure()); QTC_ASSERT(theTarget, return CheckResult::failure());
RunConfiguration * const rc = theTarget->activeRunConfiguration(); RunConfiguration * const rc = theTarget->activeRunConfiguration();
const QString remoteExe = rc ? rc->runnable().executable : QString(); const QString remoteExe = rc ? rc->runnable().executable.toString() : QString();
service->setRemoteExecutable(remoteExe); service->setRemoteExecutable(remoteExe);
return CheckResult::success(); return CheckResult::success();
}); });

View File

@@ -125,7 +125,7 @@ void CallgrindController::run(Option option)
this, &CallgrindController::controllerProcessClosed); this, &CallgrindController::controllerProcessClosed);
Runnable controller = m_valgrindRunnable; Runnable controller = m_valgrindRunnable;
controller.executable = CALLGRIND_CONTROL_BINARY; controller.executable = FilePath::fromString(CALLGRIND_CONTROL_BINARY);
controller.commandLineArguments = QString("%1 %2").arg(toOptionString(option)).arg(m_pid); controller.commandLineArguments = QString("%1 %2").arg(toOptionString(option)).arg(m_pid);
if (!m_valgrindRunnable.device if (!m_valgrindRunnable.device

View File

@@ -108,7 +108,7 @@ QString CallgrindToolRunner::progressTitle() const
void CallgrindToolRunner::start() void CallgrindToolRunner::start()
{ {
appendMessage(tr("Profiling %1").arg(executable()), Utils::NormalMessageFormat); appendMessage(tr("Profiling %1").arg(executable().toUserOutput()), Utils::NormalMessageFormat);
return ValgrindToolRunner::start(); return ValgrindToolRunner::start();
} }

View File

@@ -285,7 +285,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
runControl->createMainWorker(); runControl->createMainWorker();
const auto runnable = dlg.runnable(); const auto runnable = dlg.runnable();
runControl->setRunnable(runnable); runControl->setRunnable(runnable);
runControl->setDisplayName(runnable.executable); runControl->setDisplayName(runnable.executable.toUserOutput());
ProjectExplorerPlugin::startRunControl(runControl); ProjectExplorerPlugin::startRunControl(runControl);
}); });

View File

@@ -679,7 +679,7 @@ MemcheckToolPrivate::MemcheckToolPrivate()
rc->createMainWorker(); rc->createMainWorker();
const auto runnable = dlg.runnable(); const auto runnable = dlg.runnable();
rc->setRunnable(runnable); rc->setRunnable(runnable);
rc->setDisplayName(runnable.executable); rc->setDisplayName(runnable.executable.toUserOutput());
ProjectExplorerPlugin::startRunControl(rc); ProjectExplorerPlugin::startRunControl(rc);
}); });
@@ -739,7 +739,7 @@ void MemcheckToolPrivate::heobAction()
return; return;
} }
QString executable = sr.executable; QString executable = sr.executable.toString();
const QString workingDirectory = Utils::FileUtils::normalizePathName(sr.workingDirectory); const QString workingDirectory = Utils::FileUtils::normalizePathName(sr.workingDirectory);
const QString commandLineArguments = sr.commandLineArguments; const QString commandLineArguments = sr.commandLineArguments;
const QStringList envStrings = sr.environment.toStringList(); const QStringList envStrings = sr.environment.toStringList();
@@ -966,7 +966,7 @@ void MemcheckToolPrivate::setupRunner(MemcheckToolRunner *runTool)
m_loadExternalLogFile->setDisabled(true); m_loadExternalLogFile->setDisabled(true);
QString dir = runControl->project()->projectDirectory().toString() + '/'; QString dir = runControl->project()->projectDirectory().toString() + '/';
const QString name = FilePath::fromString(runTool->executable()).fileName(); const QString name = runTool->executable().fileName();
m_errorView->setDefaultSuppressionFile(dir + name + ".supp"); m_errorView->setDefaultSuppressionFile(dir + name + ".supp");

View File

@@ -115,7 +115,7 @@ void ValgrindToolRunner::stop()
m_runner.stop(); m_runner.stop();
} }
QString ValgrindToolRunner::executable() const FilePath ValgrindToolRunner::executable() const
{ {
return runnable().executable; return runnable().executable;
} }

View File

@@ -47,7 +47,7 @@ public:
void start() override; void start() override;
void stop() override; void stop() override;
QString executable() const; Utils::FilePath executable() const;
protected: protected:
virtual QString progressTitle() const = 0; virtual QString progressTitle() const = 0;

View File

@@ -44,6 +44,7 @@
#include <QTcpSocket> #include <QTcpSocket>
#include <QSignalSpy> #include <QSignalSpy>
using namespace Utils;
using namespace Valgrind::XmlProtocol; using namespace Valgrind::XmlProtocol;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -498,7 +499,7 @@ void ValgrindMemcheckParserTest::testRealValgrind()
qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this";
ProjectExplorer::Runnable debuggee; ProjectExplorer::Runnable debuggee;
debuggee.executable = executable; debuggee.executable = FilePath::fromString(executable);
debuggee.environment = sysEnv; debuggee.environment = sysEnv;
ValgrindRunner runner; ValgrindRunner runner;
runner.setValgrindExecutable("valgrind"); runner.setValgrindExecutable("valgrind");
@@ -535,7 +536,7 @@ void ValgrindMemcheckParserTest::testValgrindStartError()
QFETCH(QString, debuggeeArgs); QFETCH(QString, debuggeeArgs);
ProjectExplorer::Runnable debuggeeExecutable; ProjectExplorer::Runnable debuggeeExecutable;
debuggeeExecutable.executable = debuggee; debuggeeExecutable.executable = FilePath::fromString(debuggee);
debuggeeExecutable.environment = Utils::Environment::systemEnvironment(); debuggeeExecutable.environment = Utils::Environment::systemEnvironment();
debuggeeExecutable.commandLineArguments = debuggeeArgs; debuggeeExecutable.commandLineArguments = debuggeeArgs;

View File

@@ -139,7 +139,7 @@ bool ValgrindRunner::Private::run()
if (HostOsInfo::isMacHost()) if (HostOsInfo::isMacHost())
// May be slower to start but without it we get no filenames for symbols. // May be slower to start but without it we get no filenames for symbols.
cmd.addArg("--dsymutil=yes"); cmd.addArg("--dsymutil=yes");
cmd.addArg(m_debuggee.executable); cmd.addArg(m_debuggee.executable.toString());
cmd.addArgs(m_debuggee.commandLineArguments, CommandLine::Raw); cmd.addArgs(m_debuggee.commandLineArguments, CommandLine::Raw);
emit q->valgrindExecuted(cmd.toUserOutput()); emit q->valgrindExecuted(cmd.toUserOutput());
@@ -190,7 +190,7 @@ void ValgrindRunner::Private::remoteProcessStarted()
const QString proc = m_valgrindExecutable.split(' ').last(); const QString proc = m_valgrindExecutable.split(' ').last();
Runnable findPid; Runnable findPid;
findPid.executable = "/bin/sh"; findPid.executable = FileName::fromString("/bin/sh");
// sleep required since otherwise we might only match "bash -c..." // sleep required since otherwise we might only match "bash -c..."
// and not the actual valgrind run // and not the actual valgrind run
findPid.commandLineArguments = QString("-c \"" findPid.commandLineArguments = QString("-c \""
@@ -200,7 +200,7 @@ void ValgrindRunner::Private::remoteProcessStarted()
// we pick the last one, first would be "bash -c ..." // we pick the last one, first would be "bash -c ..."
" | awk '{print $1;}'" // get pid " | awk '{print $1;}'" // get pid
"\"" "\""
).arg(proc, Utils::FilePath::fromString(m_debuggee.executable).fileName()); ).arg(proc, m_debuggee.executable.fileName());
// m_remote.m_findPID = m_remote.m_connection->createRemoteProcess(cmd.toUtf8()); // m_remote.m_findPID = m_remote.m_connection->createRemoteProcess(cmd.toUtf8());
connect(&m_findPID, &ApplicationLauncher::remoteStderr, connect(&m_findPID, &ApplicationLauncher::remoteStderr,

View File

@@ -79,7 +79,7 @@ QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStri
return QString(); return QString();
ProjectExplorer::Runnable debuggee; ProjectExplorer::Runnable debuggee;
const QString &binPath = binPathFileInfo.canonicalFilePath(); const QString &binPath = binPathFileInfo.canonicalFilePath();
debuggee.executable = binPath; debuggee.executable = Utils::FilePath::fromString(binPath);
debuggee.environment = Utils::Environment::systemEnvironment(); debuggee.environment = Utils::Environment::systemEnvironment();
m_runner->setLocalServerAddress(QHostAddress::LocalHost); m_runner->setLocalServerAddress(QHostAddress::LocalHost);
m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs); m_runner->setValgrindArguments(QStringList() << "--num-callers=50" << "--track-origins=yes" << vArgs);

View File

@@ -75,7 +75,7 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
setQmlServer(qmlServer); setQmlServer(qmlServer);
} }
setSymbolFile(runControl->buildTargetInfo().targetFilePath.toString()); setSymbolFile(runControl->buildTargetInfo().targetFilePath);
QString errorMessage; QString errorMessage;
m_runner = new WinRtRunnerHelper(this, &errorMessage); m_runner = new WinRtRunnerHelper(this, &errorMessage);
if (!errorMessage.isEmpty()) { if (!errorMessage.isEmpty()) {