Commit e65e0117 authored by hjk's avatar hjk

debugger: let the user specify a working directory when starting a local

application
parent 84f41930
......@@ -516,6 +516,8 @@ StartExternalDialog::StartExternalDialog(QWidget *parent)
m_ui->execFile->setExpectedKind(Utils::PathChooser::File);
m_ui->execFile->setPromptDialogTitle(tr("Select Executable"));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_ui->workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
m_ui->workingDirectory->setPromptDialogTitle(tr("Select Working Directory"));
//execLabel->setHidden(false);
//execEdit->setHidden(false);
......@@ -543,6 +545,16 @@ QString StartExternalDialog::executableFile() const
return m_ui->execFile->path();
}
void StartExternalDialog::setWorkingDirectory(const QString &str)
{
m_ui->workingDirectory->setPath(str);
}
QString StartExternalDialog::workingDirectory() const
{
return m_ui->workingDirectory->path();
}
void StartExternalDialog::setExecutableArguments(const QString &str)
{
m_ui->argsEdit->setText(str);
......
......@@ -116,15 +116,17 @@ public:
explicit AttachTcfDialog(QWidget *parent);
~AttachTcfDialog();
QString remoteChannel() const;
void setRemoteChannel(const QString &host);
QString remoteArchitecture() const;
void setRemoteArchitecture(const QString &arch);
void setRemoteArchitectures(const QStringList &arches);
QString remoteChannel() const;
QString remoteArchitecture() const;
void setServerStartScript(const QString &scriptName);
QString serverStartScript() const;
void setUseServerStartScript(bool on);
bool useServerStartScript() const;
void setUseServerStartScript(bool on);
void setServerStartScript(const QString &scriptName);
private slots:
void updateState();
......@@ -141,11 +143,15 @@ public:
explicit StartExternalDialog(QWidget *parent);
~StartExternalDialog();
QString executableFile() const;
void setExecutableFile(const QString &executable);
void setExecutableArguments(const QString &args);
QString executableFile() const;
QString executableArguments() const;
void setExecutableArguments(const QString &args);
QString workingDirectory() const;
void setWorkingDirectory(const QString &str);
bool breakAtMain() const;
private:
......@@ -160,21 +166,26 @@ public:
explicit StartRemoteDialog(QWidget *parent);
~StartRemoteDialog();
void setRemoteChannel(const QString &host);
void setRemoteArchitecture(const QString &arch);
void setRemoteArchitectures(const QStringList &arches);
void setLocalExecutable(const QString &executable);
void setDebugger(const QString &debugger);
QString localExecutable() const;
void setLocalExecutable(const QString &executable);
QString remoteChannel() const;
void setRemoteChannel(const QString &host);
QString remoteArchitecture() const;
void setServerStartScript(const QString &scriptName);
QString serverStartScript() const;
void setUseServerStartScript(bool on);
void setRemoteArchitecture(const QString &arch);
void setRemoteArchitectures(const QStringList &arches);
bool useServerStartScript() const;
void setSysRoot(const QString &sysRoot);
void setUseServerStartScript(bool on);
QString serverStartScript() const;
void setServerStartScript(const QString &scriptName);
QString sysRoot() const;
void setSysRoot(const QString &sysRoot);
QString debugger() const;
void setDebugger(const QString &debugger);
private slots:
void updateState();
......
......@@ -181,7 +181,7 @@ DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
nospace << "executable=" << p.executable << " coreFile=" << p.coreFile
<< " processArgs=" << p.processArgs.join(sep)
<< " environment=<" << p.environment.size() << " variables>"
<< " workingDir=" << p.workingDir << " buildDir=" << p.buildDir
<< " workingDir=" << p.workingDirectory << " buildDir=" << p.buildDirectory
<< " attachPID=" << p.attachPID << " useTerminal=" << p.useTerminal
<< " remoteChannel=" << p.remoteChannel
<< " remoteArchitecture=" << p.remoteArchitecture
......@@ -2068,7 +2068,7 @@ void DebuggerManager::runTest(const QString &fileName)
{
d->m_startParameters->executable = fileName;
d->m_startParameters->processArgs = QStringList() << "--run-debuggee";
d->m_startParameters->workingDir.clear();
d->m_startParameters->workingDirectory.clear();
//startNewDebugger(StartInternal);
}
......
......@@ -111,8 +111,8 @@ public:
QString coreFile;
QStringList processArgs;
QStringList environment;
QString workingDir;
QString buildDir;
QString workingDirectory;
QString buildDirectory;
qint64 attachPID;
bool useTerminal;
QString crashParameter; // for AttachCrashedExternal
......
......@@ -1401,6 +1401,8 @@ void DebuggerPlugin::startExternalApplication()
configValue(_("LastExternalExecutableFile")).toString());
dlg.setExecutableArguments(
configValue(_("LastExternalExecutableArguments")).toString());
dlg.setWorkingDirectory(
configValue(_("LastExternalWorkingDirectory")).toString());
if (dlg.exec() != QDialog::Accepted)
return;
......@@ -1408,8 +1410,11 @@ void DebuggerPlugin::startExternalApplication()
dlg.executableFile());
setConfigValue(_("LastExternalExecutableArguments"),
dlg.executableArguments());
setConfigValue(_("LastExternalWorkingDirectory"),
dlg.workingDirectory());
sp->executable = dlg.executableFile();
sp->startMode = StartExternal;
sp->workingDirectory = dlg.workingDirectory();
if (!dlg.executableArguments().isEmpty())
sp->processArgs = dlg.executableArguments().split(QLatin1Char(' '));
......
......@@ -118,7 +118,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
m_startParameters->startMode = StartInternal;
m_startParameters->executable = runConfiguration->executable();
m_startParameters->environment = runConfiguration->environment().toStringList();
m_startParameters->workingDir = runConfiguration->workingDirectory();
m_startParameters->workingDirectory = runConfiguration->workingDirectory();
m_startParameters->processArgs = runConfiguration->commandLineArguments();
switch (m_startParameters->toolChainType) {
......@@ -130,7 +130,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
break;
}
if (runConfiguration->target()->project()) {
m_startParameters->buildDir =
m_startParameters->buildDirectory =
runConfiguration->target()->activeBuildConfiguration()->buildDirectory();
}
m_startParameters->useTerminal =
......
......@@ -79,8 +79,8 @@ void LocalPlainGdbAdapter::startAdapter()
}
gdbArgs.append(_("--tty=") + m_outputCollector.serverName());
if (!startParameters().workingDir.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDir);
if (!startParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
if (!startParameters().environment.isEmpty())
m_gdbProc.setEnvironment(startParameters().environment);
......
......@@ -50,8 +50,8 @@ void RemotePlainGdbAdapter::startAdapter()
setState(AdapterStarting);
debugMessage(QLatin1String("TRYING TO START ADAPTER"));
if (!startParameters().workingDir.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDir);
if (!startParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
if (!startParameters().environment.isEmpty())
m_gdbProc.setEnvironment(startParameters().environment);
......
......@@ -91,7 +91,7 @@ void TermGdbAdapter::startAdapter()
// m_stubProc.stop();
// m_stubProc.blockSignals(false);
m_stubProc.setWorkingDirectory(startParameters().workingDir);
m_stubProc.setWorkingDirectory(startParameters().workingDirectory);
// Set environment + dumper preload.
QStringList environment = startParameters().environment;
m_stubProc.setEnvironment(environment);
......
......@@ -48,6 +48,9 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="execFile" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="argLabel">
<property name="text">
......@@ -58,17 +61,24 @@
<item row="1" column="1">
<widget class="QLineEdit" name="argsEdit"/>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="execFile" native="true"/>
<item row="2" column="0">
<widget class="QLabel" name="workingDirectoryLabel">
<property name="text">
<string>Working directory:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="workingDirectory" native="true"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxBreakAtMain">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="labelBreakAtMain">
<property name="text">
<string>Break at 'main':</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment