Commit 2cf00605 authored by hjk's avatar hjk

Debugger: Use StandardRunnable in DebuggerStartParameters

This is a mechanical replacement for the former executable, processArgs,
inferiorEnvironment and workingDirectory members.

Change-Id: I4160e01427ed801df9b729f1f31d0a2ca48159b5
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 67e952e8
......@@ -96,7 +96,8 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useCppDebugger()) {
Kit *kit = target->kit();
params.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process");
params.inferior.executable = target->activeBuildConfiguration()->buildDirectory().toString()
+ QLatin1String("/app_process");
params.skipExecutableValidation = true;
params.remoteChannel = runConfig->remoteChannel();
params.solibSearchPath = AndroidManager::androidQtSupport(target)->soLibSearchPath(target);
......
......@@ -129,8 +129,8 @@ RunControl *BareMetalRunControlFactory::create(
}
}
sp.executable = bin;
sp.processArgs = rc->arguments();
sp.inferior.executable = bin;
sp.inferior.commandLineArguments = rc->arguments();
sp.startMode = AttachToRemoteServer;
sp.commandsAfterConnect = p->initCommands().toLatin1();
sp.commandsForReset = p->resetCommands().toLatin1();
......
......@@ -409,7 +409,7 @@ int CdbEngine::elapsedLogTime() const
bool CdbEngine::startConsole(const DebuggerRunParameters &sp, QString *errorMessage)
{
if (debug)
qDebug("startConsole %s", qPrintable(sp.executable));
qDebug("startConsole %s", qPrintable(sp.inferior.executable));
m_consoleStub.reset(new ConsoleProcess);
m_consoleStub->setMode(ConsoleProcess::Suspend);
connect(m_consoleStub.data(), &ConsoleProcess::processError,
......@@ -418,11 +418,11 @@ bool CdbEngine::startConsole(const DebuggerRunParameters &sp, QString *errorMess
this, &CdbEngine::consoleStubProcessStarted);
connect(m_consoleStub.data(), &ConsoleProcess::stubStopped,
this, &CdbEngine::consoleStubExited);
m_consoleStub->setWorkingDirectory(sp.workingDirectory);
m_consoleStub->setWorkingDirectory(sp.inferior.workingDirectory);
if (sp.stubEnvironment.size())
m_consoleStub->setEnvironment(sp.stubEnvironment);
if (!m_consoleStub->start(sp.executable, sp.processArgs)) {
*errorMessage = tr("The console process \"%1\" could not be started.").arg(sp.executable);
if (!m_consoleStub->start(sp.inferior.executable, sp.inferior.commandLineArguments)) {
*errorMessage = tr("The console process \"%1\" could not be started.").arg(sp.inferior.executable);
return false;
}
return true;
......@@ -448,8 +448,8 @@ void CdbEngine::consoleStubProcessStarted()
qDebug("consoleStubProcessStarted() PID=%lld", m_consoleStub->applicationPID());
// Attach to console process.
DebuggerRunParameters attachParameters = runParameters();
attachParameters.executable.clear();
attachParameters.processArgs.clear();
attachParameters.inferior.executable.clear();
attachParameters.inferior.commandLineArguments.clear();
attachParameters.attachPID = m_consoleStub->applicationPID();
attachParameters.startMode = AttachExternal;
attachParameters.useTerminal = false;
......@@ -579,7 +579,8 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
case StartExternal:
if (!nativeArguments.isEmpty())
nativeArguments.push_back(blank);
QtcProcess::addArgs(&nativeArguments, QStringList(QDir::toNativeSeparators(sp.executable)));
QtcProcess::addArgs(&nativeArguments,
QStringList(QDir::toNativeSeparators(sp.inferior.executable)));
break;
case AttachToRemoteServer:
break;
......@@ -600,10 +601,10 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
*errorMessage = QString::fromLatin1("Internal error: Unsupported start mode %1.").arg(sp.startMode);
return false;
}
if (!sp.processArgs.isEmpty()) { // Complete native argument string.
if (!sp.inferior.commandLineArguments.isEmpty()) { // Complete native argument string.
if (!nativeArguments.isEmpty())
nativeArguments.push_back(blank);
nativeArguments += sp.processArgs;
nativeArguments += sp.inferior.commandLineArguments;
}
const QString msg = QString::fromLatin1("Launching %1 %2\nusing %3 of %4.").
......@@ -615,12 +616,12 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
m_outputBuffer.clear();
m_autoBreakPointCorrection = false;
const QStringList inferiorEnvironment = sp.inferiorEnvironment.size() == 0 ?
const QStringList inferiorEnvironment = sp.inferior.environment.size() == 0 ?
QProcessEnvironment::systemEnvironment().toStringList() :
sp.inferiorEnvironment.toStringList();
sp.inferior.environment.toStringList();
m_process.setEnvironment(mergeEnvironment(inferiorEnvironment, extensionFi.absolutePath()));
if (!sp.workingDirectory.isEmpty())
m_process.setWorkingDirectory(sp.workingDirectory);
if (!sp.inferior.workingDirectory.isEmpty())
m_process.setWorkingDirectory(sp.inferior.workingDirectory);
#ifdef Q_OS_WIN
if (!nativeArguments.isEmpty()) // Appends
......
......@@ -396,7 +396,7 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerRunParameters *rp, Kit
settings->endGroup();
}
rp->executable = newParameters.runnable.executable;
rp->inferior.executable = newParameters.runnable.executable;
const QString inputAddress = dialog.d->serverAddressEdit->text();
if (!inputAddress.isEmpty())
rp->remoteChannel = inputAddress;
......@@ -404,10 +404,10 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerRunParameters *rp, Kit
rp->remoteChannel = rp->connParams.host;
rp->remoteChannel += QLatin1Char(':') + QString::number(newParameters.serverPort);
rp->displayName = newParameters.displayName();
rp->workingDirectory = newParameters.runnable.workingDirectory;
rp->inferior.workingDirectory = newParameters.runnable.workingDirectory;
rp->useTerminal = newParameters.runnable.runMode == ApplicationLauncher::Console;
if (!newParameters.runnable.commandLineArguments.isEmpty())
rp->processArgs = newParameters.runnable.commandLineArguments;
rp->inferior.commandLineArguments = newParameters.runnable.commandLineArguments;
rp->breakOnMain = newParameters.breakAtMain;
rp->serverStartScript = newParameters.serverStartScript;
rp->debugInfoLocation = newParameters.debugInfoLocation;
......
......@@ -101,12 +101,12 @@ QDebug operator<<(QDebug d, DebuggerState state)
QDebug operator<<(QDebug str, const DebuggerRunParameters &sp)
{
QDebug nospace = str.nospace();
nospace << "executable=" << sp.executable
nospace << "executable=" << sp.inferior.executable
<< " coreFile=" << sp.coreFile
<< " processArgs=" << sp.processArgs
<< " inferior environment=<" << sp.inferiorEnvironment.size() << " variables>"
<< " processArgs=" << sp.inferior.commandLineArguments
<< " inferior environment=<" << sp.inferior.environment.size() << " variables>"
<< " debugger environment=<" << sp.debuggerEnvironment.size() << " variables>"
<< " workingDir=" << sp.workingDirectory
<< " workingDir=" << sp.inferior.workingDirectory
<< " attachPID=" << sp.attachPID
<< " useTerminal=" << sp.useTerminal
<< " remoteChannel=" << sp.remoteChannel
......@@ -206,7 +206,7 @@ public:
Utils::globalMacroExpander()->registerFileVariables(PrefixDebugExecutable,
tr("Debugged executable"),
[this]() { return m_runParameters.executable; });
[this]() { return m_runParameters.inferior.executable; });
}
public slots:
......@@ -569,7 +569,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
d->m_runControl->setApplicationProcessHandle(ProcessHandle(d->m_inferiorPid));
if (isNativeMixedActive())
d->m_runParameters.inferiorEnvironment.set(QLatin1String("QV4_FORCE_INTERPRETER"), QLatin1String("1"));
d->m_runParameters.inferior.environment.set(QLatin1String("QV4_FORCE_INTERPRETER"), QLatin1String("1"));
action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
......@@ -922,7 +922,7 @@ void DebuggerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &re
if (result.qmlServerPort != InvalidPort) {
d->m_runParameters.qmlServerPort = result.qmlServerPort;
d->m_runParameters.processArgs.replace(_("%qml_port%"), QString::number(result.qmlServerPort));
d->m_runParameters.inferior.commandLineArguments.replace(_("%qml_port%"), QString::number(result.qmlServerPort));
}
} else {
......@@ -1831,7 +1831,7 @@ void DebuggerEngine::validateExecutable(DebuggerRunParameters *sp)
return;
if (sp->languages == QmlLanguage)
return;
QString binary = sp->executable;
QString binary = sp->inferior.executable;
if (binary.isEmpty())
return;
......
......@@ -1138,8 +1138,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
if (val.isEmpty()) {
if (key.isEmpty()) {
continue;
} else if (rp.executable.isEmpty()) {
rp.executable = key;
} else if (rp.inferior.executable.isEmpty()) {
rp.inferior.executable = key;
} else {
*errorMessage = DebuggerPlugin::tr("Only one executable allowed.");
return false;
......@@ -1164,10 +1164,10 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
}
}
if (rp.startMode == StartExternal) {
rp.displayName = tr("Executable file \"%1\"").arg(rp.executable);
rp.startMessage = tr("Debugging file %1.").arg(rp.executable);
rp.displayName = tr("Executable file \"%1\"").arg(rp.inferior.executable);
rp.startMessage = tr("Debugging file %1.").arg(rp.inferior.executable);
}
rp.inferiorEnvironment = Utils::Environment::systemEnvironment();
rp.inferior.environment = Utils::Environment::systemEnvironment();
rp.stubEnvironment = Utils::Environment::systemEnvironment();
rp.debuggerEnvironment = Utils::Environment::systemEnvironment();
m_scheduledStarts.append(QPair<DebuggerRunParameters, Kit *>(rp, kit));
......@@ -1331,7 +1331,7 @@ void DebuggerPluginPrivate::attachCore()
QString display = dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile();
DebuggerRunParameters rp;
rp.masterEngineType = DebuggerKitInformation::engineType(dlg.kit());
rp.executable = dlg.localExecutableFile();
rp.inferior.executable = dlg.localExecutableFile();
rp.coreFile = dlg.localCoreFile();
rp.displayName = tr("Core file \"%1\"").arg(display);
rp.startMode = AttachCore;
......@@ -1467,7 +1467,7 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
DebuggerRunParameters rp;
rp.attachPID = process.pid;
rp.displayName = tr("Process %1").arg(process.pid);
rp.executable = process.exe;
rp.inferior.executable = process.exe;
rp.startMode = AttachExternal;
rp.closeMode = DetachAtClose;
rp.continueAfterAttach = contAfterAttach;
......@@ -2239,14 +2239,14 @@ static QString formatStartParameters(DebuggerRunParameters &sp)
if (sp.languages & QmlLanguage)
str << "qml";
str << '\n';
if (!sp.executable.isEmpty()) {
str << "Executable: " << QDir::toNativeSeparators(sp.executable)
<< ' ' << sp.processArgs;
if (!sp.inferior.executable.isEmpty()) {
str << "Executable: " << QDir::toNativeSeparators(sp.inferior.executable)
<< ' ' << sp.inferior.commandLineArguments;
if (sp.useTerminal)
str << " [terminal]";
str << '\n';
if (!sp.workingDirectory.isEmpty())
str << "Directory: " << QDir::toNativeSeparators(sp.workingDirectory)
if (!sp.inferior.workingDirectory.isEmpty())
str << "Directory: " << QDir::toNativeSeparators(sp.inferior.workingDirectory)
<< '\n';
}
QString cmd = sp.debuggerCommand;
......
......@@ -146,7 +146,7 @@ void DebuggerRunControl::start()
QTC_ASSERT(m_engine, return);
// User canceled input dialog asking for executable when working on library project.
if (m_engine->runParameters().startMode == StartInternal
&& m_engine->runParameters().executable.isEmpty()
&& m_engine->runParameters().inferior.executable.isEmpty()
&& m_engine->runParameters().interpreter.isEmpty()) {
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
emit started();
......@@ -333,11 +333,11 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
// Extract as much as possible from available RunConfiguration.
if (m_runConfig->runnable().is<StandardRunnable>()) {
auto runnable = m_runConfig->runnable().as<StandardRunnable>();
m_rp.executable = runnable.executable;
m_rp.processArgs = runnable.commandLineArguments;
m_rp.inferior.executable = runnable.executable;
m_rp.inferior.commandLineArguments = runnable.commandLineArguments;
m_rp.useTerminal = runnable.runMode == ApplicationLauncher::Console;
// Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...)
m_rp.workingDirectory = FileUtils::normalizePathName(runnable.workingDirectory);
m_rp.inferior.workingDirectory = FileUtils::normalizePathName(runnable.workingDirectory);
}
// Find a Kit and Target. Either could be missing.
......@@ -353,10 +353,10 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
}
// We might get an executable from a local PID.
if (m_rp.executable.isEmpty() && m_rp.attachPID != InvalidPid) {
if (m_rp.inferior.executable.isEmpty() && m_rp.attachPID != InvalidPid) {
foreach (const DeviceProcessItem &p, DeviceProcessList::localProcesses())
if (p.pid == m_rp.attachPID)
m_rp.executable = p.exe;
m_rp.inferior.executable = p.exe;
}
if (!m_kit) {
......@@ -366,8 +366,8 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
QList<Abi> abis;
if (m_rp.toolChainAbi.isValid()) {
abis.push_back(m_rp.toolChainAbi);
} else if (!m_rp.executable.isEmpty()) {
abis = Abi::abisOfBinary(FileName::fromString(m_rp.executable));
} else if (!m_rp.inferior.executable.isEmpty()) {
abis = Abi::abisOfBinary(FileName::fromString(m_rp.inferior.executable));
}
if (!abis.isEmpty()) {
......@@ -401,9 +401,9 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (m_runConfig) {
if (auto envAspect = m_runConfig->extraAspect<EnvironmentAspect>()) {
m_rp.inferiorEnvironment = envAspect->environment(); // Correct.
m_rp.stubEnvironment = m_rp.inferiorEnvironment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
m_rp.debuggerEnvironment = m_rp.inferiorEnvironment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
m_rp.inferior.environment = envAspect->environment(); // Correct.
m_rp.stubEnvironment = m_rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
m_rp.debuggerEnvironment = m_rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
}
}
......@@ -466,9 +466,9 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
m_rp.interpreter = interpreter;
QString args = runConfig->property("arguments").toString();
if (!args.isEmpty()) {
if (!m_rp.processArgs.isEmpty())
m_rp.processArgs.append(QLatin1Char(' '));
m_rp.processArgs.append(args);
if (!m_rp.inferior.commandLineArguments.isEmpty())
m_rp.inferior.commandLineArguments.append(QLatin1Char(' '));
m_rp.inferior.commandLineArguments.append(args);
}
m_rp.masterEngineType = PdbEngineType;
}
......@@ -496,8 +496,8 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
// Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit!
const QString optimizerKey = _("QML_DISABLE_OPTIMIZER");
if (!m_rp.inferiorEnvironment.hasKey(optimizerKey))
m_rp.inferiorEnvironment.set(optimizerKey, _("1"));
if (!m_rp.inferior.environment.hasKey(optimizerKey))
m_rp.inferior.environment.set(optimizerKey, _("1"));
}
}
}
......@@ -532,7 +532,8 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
service = QmlDebug::QmlDebuggerServices;
}
if (m_rp.startMode != AttachExternal)
QtcProcess::addArg(&m_rp.processArgs, wantCppDebugger && m_rp.nativeMixedEnabled ?
QtcProcess::addArg(&m_rp.inferior.commandLineArguments,
wantCppDebugger && m_rp.nativeMixedEnabled ?
QmlDebug::qmlDebugNativeArguments(service, false) :
QmlDebug::qmlDebugTcpArguments(service, m_rp.qmlServerPort));
}
......
......@@ -435,7 +435,7 @@ DebuggerSourcePathMappingWidget::SourcePathMap
DebuggerSourcePathMappingWidget::mergePlatformQtPath(const DebuggerRunParameters &sp,
const SourcePathMap &in)
{
const FileName qmake = BuildableHelperLibrary::findSystemQt(sp.inferiorEnvironment);
const FileName qmake = BuildableHelperLibrary::findSystemQt(sp.inferior.environment);
// FIXME: Get this from the profile?
// We could query the QtVersion for this information directly, but then we
// will need to add a dependency on QtSupport to the debugger.
......
......@@ -33,6 +33,7 @@
#include <utils/environment.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <QMetaType>
......@@ -60,18 +61,13 @@ public:
class DEBUGGER_EXPORT DebuggerStartParameters
{
public:
DebuggerStartParameters() {}
DebuggerStartMode startMode = NoStartMode;
DebuggerCloseMode closeMode = KillAtClose;
QString executable;
ProjectExplorer::StandardRunnable inferior;
QString displayName; // Used in the Snapshots view.
QString processArgs;
Utils::Environment inferiorEnvironment;
Utils::Environment debuggerEnvironment;
Utils::Environment stubEnvironment;
QString workingDirectory;
qint64 attachPID = InvalidPid;
QStringList solibSearchPath;
bool useTerminal = false;
......
......@@ -52,8 +52,8 @@ void GdbAttachEngine::setupEngine()
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
showMessage(_("TRYING TO START ADAPTER"));
if (!runParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
if (!runParameters().inferior.workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
m_gdbProc.setEnvironment(runParameters().debuggerEnvironment);
startGdb();
......
......@@ -79,7 +79,7 @@ void GdbCoreEngine::setupEngine()
showMessage(_("TRYING TO START ADAPTER"));
const DebuggerRunParameters &rp = runParameters();
m_executable = rp.executable;
m_executable = rp.inferior.executable;
QFileInfo fi(rp.coreFile);
m_coreName = fi.absoluteFilePath();
......
......@@ -4082,7 +4082,7 @@ void GdbEngine::startGdb(const QStringList &args)
Module module;
module.startAddress = 0;
module.endAddress = 0;
module.modulePath = rp.executable;
module.modulePath = rp.inferior.executable;
module.moduleName = QLatin1String("<executable>");
modulesHandler()->updateModule(module);
......@@ -4191,7 +4191,7 @@ void GdbEngine::loadInitScript()
void GdbEngine::setEnvironmentVariables()
{
Environment sysEnv = Environment::systemEnvironment();
Environment runEnv = runParameters().inferiorEnvironment;
Environment runEnv = runParameters().inferior.environment;
foreach (const EnvironmentItem &item, sysEnv.diff(runEnv)) {
if (item.unset)
runCommand({"unset environment " + item.name.toUtf8(), NoFlags});
......@@ -4470,9 +4470,10 @@ bool GdbEngine::prepareCommand()
if (HostOsInfo::isWindowsHost()) {
DebuggerRunParameters &rp = runParameters();
QtcProcess::SplitError perr;
rp.processArgs = QtcProcess::prepareArgs(rp.processArgs, &perr,
HostOsInfo::hostOs(),
nullptr, &rp.workingDirectory).toWindowsArgs();
rp.inferior.commandLineArguments =
QtcProcess::prepareArgs(rp.inferior.commandLineArguments, &perr,
HostOsInfo::hostOs(), nullptr,
&rp.inferior.workingDirectory).toWindowsArgs();
if (perr != QtcProcess::SplitOk) {
// perr == BadQuoting is never returned on Windows
// FIXME? QTCREATORBUG-2809
......
......@@ -53,8 +53,8 @@ void GdbPlainEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
setEnvironmentVariables();
if (!runParameters().processArgs.isEmpty()) {
QString args = runParameters().processArgs;
if (!runParameters().inferior.commandLineArguments.isEmpty()) {
QString args = runParameters().inferior.commandLineArguments;
runCommand({"-exec-arguments " + toLocalEncoding(args), NoFlags});
}
runCommand({"-file-exec-and-symbols \"" + execFilePath() + '"', NoFlags,
......@@ -120,8 +120,8 @@ void GdbPlainEngine::setupEngine()
}
gdbArgs.append(_("--tty=") + m_outputCollector.serverName());
if (!runParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
if (!runParameters().inferior.workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
startGdb(gdbArgs);
}
......@@ -145,7 +145,7 @@ void GdbPlainEngine::shutdownEngine()
QByteArray GdbPlainEngine::execFilePath() const
{
return QFileInfo(runParameters().executable)
return QFileInfo(runParameters().inferior.executable)
.absoluteFilePath().toLocal8Bit();
}
......
......@@ -79,14 +79,14 @@ void GdbRemoteServerEngine::setupEngine()
// Provide script information about the environment
QString arglist;
QtcProcess::addArg(&arglist, serverStartScript);
QtcProcess::addArg(&arglist, runParameters().executable);
QtcProcess::addArg(&arglist, runParameters().inferior.executable);
QtcProcess::addArg(&arglist, runParameters().remoteChannel);
m_uploadProc.start(arglist);
m_uploadProc.waitForStarted();
}
if (!runParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
if (!runParameters().inferior.workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
if (runParameters().remoteSetupNeeded) {
notifyEngineRequestRemoteSetup();
......@@ -164,15 +164,15 @@ void GdbRemoteServerEngine::setupInferior()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
const DebuggerRunParameters &rp = runParameters();
QString executableFileName;
if (!rp.executable.isEmpty()) {
QFileInfo fi(rp.executable);
if (!rp.inferior.executable.isEmpty()) {
QFileInfo fi(rp.inferior.executable);
executableFileName = fi.absoluteFilePath();
}
//const QByteArray sysroot = sp.sysroot.toLocal8Bit();
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
const QString args = isMasterEngine() ? runParameters().processArgs
: masterEngine()->runParameters().processArgs;
const QString args = isMasterEngine() ? runParameters().inferior.commandLineArguments
: masterEngine()->runParameters().inferior.commandLineArguments;
// if (!remoteArch.isEmpty())
// postCommand("set architecture " + remoteArch);
......
......@@ -213,7 +213,7 @@ void GdbServerStarter::attach(int port)
rp.connParams.port = port;
rp.remoteChannel = rp.connParams.host + QLatin1Char(':') + QString::number(rp.connParams.port);
rp.displayName = tr("Remote: \"%1:%2\"").arg(rp.connParams.host).arg(port);
rp.executable = localExecutable;
rp.inferior.executable = localExecutable;
rp.startMode = AttachToRemoteServer;
rp.closeMode = KillAtClose;
createAndScheduleRun(rp, d->kit);
......
......@@ -81,7 +81,7 @@ void GdbTermEngine::setupEngine()
if (!prepareCommand())
return;
m_stubProc.setWorkingDirectory(runParameters().workingDirectory);
m_stubProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
// Set environment + dumper preload.
m_stubProc.setEnvironment(runParameters().stubEnvironment);
......@@ -94,8 +94,8 @@ void GdbTermEngine::setupEngine()
// FIXME: Starting the stub implies starting the inferior. This is
// fairly unclean as far as the state machine and error reporting go.
if (!m_stubProc.start(runParameters().executable,
runParameters().processArgs)) {
if (!m_stubProc.start(runParameters().inferior.executable,
runParameters().inferior.commandLineArguments)) {
// Error message for user is delivered via a signal.
handleAdapterStartFailed(QString());
return;
......
......@@ -177,9 +177,9 @@ bool LldbEngine::prepareCommand()
if (HostOsInfo::isWindowsHost()) {
DebuggerRunParameters &rp = runParameters();
QtcProcess::SplitError perr;
rp.processArgs = QtcProcess::prepareArgs(rp.processArgs, &perr,
HostOsInfo::hostOs(),
nullptr, &rp.workingDirectory).toWindowsArgs();
rp.inferior.commandLineArguments
= QtcProcess::prepareArgs(rp.inferior.commandLineArguments, &perr, HostOsInfo::hostOs(),
nullptr, &rp.inferior.workingDirectory).toWindowsArgs();
if (perr != QtcProcess::SplitOk) {
// perr == BadQuoting is never returned on Windows
// FIXME? QTCREATORBUG-2809
......@@ -207,7 +207,7 @@ void LldbEngine::setupEngine()
return;
}
m_stubProc.setWorkingDirectory(runParameters().workingDirectory);
m_stubProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
// Set environment + dumper preload.
m_stubProc.setEnvironment(runParameters().stubEnvironment);
......@@ -217,8 +217,8 @@ void LldbEngine::setupEngine()
// FIXME: Starting the stub implies starting the inferior. This is
// fairly unclean as far as the state machine and error reporting go.
if (!m_stubProc.start(runParameters().executable,
runParameters().processArgs)) {
if (!m_stubProc.start(runParameters().inferior.executable,
runParameters().inferior.commandLineArguments)) {
// Error message for user is delivered via a signal.
//handleAdapterStartFailed(QString());
notifyEngineSetupFailed();
......@@ -251,8 +251,8 @@ void LldbEngine::startLldb()
showMessage(_("STARTING LLDB: ") + m_lldbCmd);
m_lldbProc.setEnvironment(runParameters().debuggerEnvironment);
if (!runParameters().workingDirectory.isEmpty())
m_lldbProc.setWorkingDirectory(runParameters().workingDirectory);
if (!runParameters().inferior.workingDirectory.isEmpty())
m_lldbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
m_lldbProc.setCommand(m_lldbCmd, QString());
m_lldbProc.start();
......@@ -288,7 +288,7 @@ void LldbEngine::startLldbStage2()
void LldbEngine::setupInferior()
{
Environment sysEnv = Environment::systemEnvironment();
Environment runEnv = runParameters().inferiorEnvironment;
Environment runEnv = runParameters().inferior.environment;
foreach (const EnvironmentItem &item, sysEnv.diff(runEnv)) {
DebuggerCommand cmd("executeDebuggerCommand");
if (item.unset)
......@@ -322,8 +322,8 @@ void LldbEngine::setupInferior()
QString executable;
QtcProcess::Arguments args;
QtcProcess::prepareCommand(QFileInfo(rp.executable).absoluteFilePath(),
rp.processArgs, &executable, &args);
QtcProcess::prepareCommand(QFileInfo(rp.inferior.executable).absoluteFilePath(),
rp.inferior.commandLineArguments, &executable, &args);
DebuggerCommand cmd2("setupInferior");
cmd2.arg("executable", executable);
......@@ -332,9 +332,9 @@ void LldbEngine::setupInferior()
cmd2.arg("startmode", rp.startMode);
cmd2.arg("nativemixed", isNativeMixedActive());
cmd2.arg("dyldimagesuffix", rp.inferiorEnvironment.value(_("DYLD_IMAGE_SUFFIX")));
cmd2.arg("dyldframeworkpath", rp.inferiorEnvironment.value(_("DYLD_LIBRARY_PATH")));
cmd2.arg("dyldlibrarypath", rp.inferiorEnvironment.value(_("DYLD_FRAMEWORK_PATH")));
cmd2.arg("dyldimagesuffix", rp.inferior.environment.value(_("DYLD_IMAGE_SUFFIX")));
cmd2.arg("dyldframeworkpath", rp.inferior.environment.value(_("DYLD_LIBRARY_PATH")));
cmd2.arg("dyldlibrarypath", rp.inferior.environment.value(_("DYLD_FRAMEWORK_PATH")));
QJsonArray processArgs;
foreach (const QString &arg, args.toUnixArgs())
......
......@@ -135,7 +135,7 @@ void PdbEngine::setupEngine()
}
QStringList args = { bridge, scriptFile.fileName() };
args.append(Utils::QtcProcess::splitArgs(runParameters().processArgs));
args.append(Utils::QtcProcess::splitArgs(runParameters().inferior.workingDirectory));
showMessage(_("STARTING ") + m_interpreter + QLatin1Char(' ') + args.join(QLatin1Char(' ')));
m_proc.start(m_interpreter, args);
......