From 57634ab2d1eeda09a19e77c3f52e4624e2be7229 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Thu, 10 Dec 2009 16:57:45 +0100 Subject: [PATCH] debugger: add a line edit to specify the local executable for gdb remote debugging Long term that would probably better as a run configuration. --- src/plugins/debugger/debuggerdialogs.cpp | 18 ++++++++++++--- src/plugins/debugger/debuggerdialogs.h | 6 +++-- src/plugins/debugger/debuggerplugin.cpp | 16 +++++++++----- src/plugins/debugger/gdb/remotegdbadapter.cpp | 2 +- src/plugins/debugger/startremotedialog.ui | 22 ++++++++++++++----- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index e79a4a27c31..bb903e30ced 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -385,8 +385,10 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent) { m_ui->setupUi(this); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); + m_ui->executablePathChooser->setExpectedKind(Utils::PathChooser::File); + m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable")); m_ui->serverStartScript->setExpectedKind(Utils::PathChooser::File); - m_ui->serverStartScript->setPromptDialogTitle(tr("Select Executable")); + m_ui->serverStartScript->setPromptDialogTitle(tr("Select Start Script")); connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateState())); @@ -412,6 +414,16 @@ QString StartRemoteDialog::remoteChannel() const return m_ui->channelLineEdit->text(); } +void StartRemoteDialog::setLocalExecutable(const QString &executable) +{ + m_ui->executablePathChooser->setPath(executable); +} + +QString StartRemoteDialog::localExecutable() const +{ + return m_ui->executablePathChooser->path(); +} + void StartRemoteDialog::setRemoteArchitectures(const QStringList &list) { m_ui->architectureComboBox->clear(); @@ -453,12 +465,12 @@ bool StartRemoteDialog::useServerStartScript() const return m_ui->useServerStartScriptCheckBox->isChecked(); } -void StartRemoteDialog::setSysroot(const QString &sysroot) +void StartRemoteDialog::setSysRoot(const QString &sysroot) { m_ui->sysrootPathChooser->setPath(sysroot); } -const QString StartRemoteDialog::sysroot() const +QString StartRemoteDialog::sysRoot() const { return m_ui->sysrootPathChooser->path(); } diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h index 03c323259a5..87d59d11bbc 100644 --- a/src/plugins/debugger/debuggerdialogs.h +++ b/src/plugins/debugger/debuggerdialogs.h @@ -134,14 +134,16 @@ public: void setRemoteChannel(const QString &host); void setRemoteArchitecture(const QString &arch); void setRemoteArchitectures(const QStringList &arches); + void setLocalExecutable(const QString &executable); + QString localExecutable() const; QString remoteChannel() const; QString remoteArchitecture() const; void setServerStartScript(const QString &scriptName); QString serverStartScript() const; void setUseServerStartScript(bool on); bool useServerStartScript() const; - void setSysroot(const QString &sysroot); - const QString sysroot() const; + void setSysRoot(const QString &sysRoot); + QString sysRoot() const; private slots: void updateState(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e823fb85258..b46d9b7cdd4 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1340,7 +1340,8 @@ void DebuggerPlugin::attachCore(const QString &core, const QString &exe) sp->coreFile = core; sp->startMode = AttachCore; if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) - ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE); + ProjectExplorerPlugin::instance()-> + startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE); } void DebuggerPlugin::startRemoteApplication() @@ -1356,28 +1357,33 @@ void DebuggerPlugin::startRemoteApplication() dlg.setRemoteArchitectures(arches); dlg.setRemoteChannel( configValue(_("LastRemoteChannel")).toString()); + dlg.setLocalExecutable( + configValue(_("LastLocalExecutable")).toString()); dlg.setRemoteArchitecture(lastUsed); dlg.setServerStartScript( configValue(_("LastServerStartScript")).toString()); dlg.setUseServerStartScript( configValue(_("LastUseServerStartScript")).toBool()); - dlg.setSysroot(configValue(_("LastSysroot")).toString()); + dlg.setSysRoot(configValue(_("LastSysroot")).toString()); if (dlg.exec() != QDialog::Accepted) return; setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel()); + setConfigValue(_("LastLocalExecutable"), dlg.localExecutable()); setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture()); setConfigValue(_("LastServerStartScript"), dlg.serverStartScript()); setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript()); - setConfigValue(_("LastSysroot"), dlg.sysroot()); + setConfigValue(_("LastSysroot"), dlg.sysRoot()); sp->remoteChannel = dlg.remoteChannel(); sp->remoteArchitecture = dlg.remoteArchitecture(); + sp->executable = dlg.localExecutable(); sp->startMode = StartRemote; if (dlg.useServerStartScript()) sp->serverStartScript = dlg.serverStartScript(); - sp->sysRoot = dlg.sysroot(); + sp->sysRoot = dlg.sysRoot(); if (RunControl *runControl = m_debuggerRunControlFactory->create(sp)) - ProjectExplorerPlugin::instance()->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE); + ProjectExplorerPlugin::instance() + ->startRunControl(runControl, ProjectExplorer::Constants::DEBUGMODE); } #include "debuggerplugin.moc" diff --git a/src/plugins/debugger/gdb/remotegdbadapter.cpp b/src/plugins/debugger/gdb/remotegdbadapter.cpp index a18aba05b4d..79b1fd5a5d5 100644 --- a/src/plugins/debugger/gdb/remotegdbadapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbadapter.cpp @@ -166,7 +166,7 @@ void RemoteGdbAdapter::startInferior() + startParameters().processArgs.join(_(" "))); m_engine->postCommand(_("set target-async on"), CB(handleSetTargetAsync)); - + QString x = startParameters().executable; QFileInfo fi(startParameters().executable); QString fileName = fi.absoluteFilePath(); m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName), diff --git a/src/plugins/debugger/startremotedialog.ui b/src/plugins/debugger/startremotedialog.ui index c72289f21b0..f6ac099ea58 100644 --- a/src/plugins/debugger/startremotedialog.ui +++ b/src/plugins/debugger/startremotedialog.ui @@ -25,28 +25,31 @@ <property name="fieldGrowthPolicy"> <enum>QFormLayout::ExpandingFieldsGrow</enum> </property> - <item row="0" column="0"> + <item row="1" column="0"> <widget class="QLabel" name="channelLabel"> <property name="text"> <string>Host and port:</string> </property> </widget> </item> - <item row="0" column="1"> + <item row="1" column="1"> <widget class="QLineEdit" name="channelLineEdit"> <property name="text"> <string notr="true">localhost:5115</string> </property> </widget> </item> - <item row="1" column="0"> + <item row="0" column="1"> + <widget class="Utils::PathChooser" name="executablePathChooser" native="true"/> + </item> + <item row="2" column="0"> <widget class="QLabel" name="architectureLabel"> <property name="text"> <string>Architecture:</string> </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QComboBox" name="architectureComboBox"> <property name="editable"> <bool>true</bool> @@ -73,16 +76,23 @@ </property> </widget> </item> - <item row="2" column="0"> + <item row="3" column="0"> <widget class="QLabel" name="sysrootLabel"> <property name="text"> <string>Sysroot:</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="1"> <widget class="Utils::PathChooser" name="sysrootPathChooser" native="true"/> </item> + <item row="0" column="0"> + <widget class="QLabel" name="executableLabel"> + <property name="text"> + <string>Local executable:</string> + </property> + </widget> + </item> </layout> </item> <item> -- GitLab