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