From feef5cac4ce92df71ec320ae7484d63b3b5e4a30 Mon Sep 17 00:00:00 2001 From: hjk <hjk121@nokiamail.com> Date: Fri, 28 Jun 2013 13:56:42 +0200 Subject: [PATCH] Debugger/RemoteLinux: Make gdbserver location configurable This helps in situation where the location of the gdbserver installation is not under the control of the user and he also can't tweak path settings on the device. Change-Id: Iab5bbfef765879bf59930cc416385c692056da93 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> --- .../debugger/gdb/startgdbserverdialog.cpp | 5 ++- .../projectexplorer/devicesupport/idevice.cpp | 17 ++++++++ .../projectexplorer/devicesupport/idevice.h | 3 ++ .../genericlinuxdeviceconfigurationwidget.cpp | 8 ++++ .../genericlinuxdeviceconfigurationwidget.h | 1 + .../genericlinuxdeviceconfigurationwidget.ui | 40 +++++++++++++++++-- .../remotelinux/remotelinuxdebugsupport.cpp | 10 +++-- 7 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/plugins/debugger/gdb/startgdbserverdialog.cpp b/src/plugins/debugger/gdb/startgdbserverdialog.cpp index ce04b6fbeeb..dc6f4fe2d66 100644 --- a/src/plugins/debugger/gdb/startgdbserverdialog.cpp +++ b/src/plugins/debugger/gdb/startgdbserverdialog.cpp @@ -122,7 +122,10 @@ void GdbServerStarter::portListReady() connect(&d->runner, SIGNAL(readyReadStandardError()), SLOT(handleProcessErrorOutput())); connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int))); - QByteArray cmd = "gdbserver --attach :" + QByteArray gdbServerPath = d->device->debugServerPath().toUtf8(); + if (gdbServerPath.isEmpty()) + gdbServerPath = "gdbserver"; + QByteArray cmd = gdbServerPath + " --attach :" + QByteArray::number(port) + ' ' + QByteArray::number(d->process.pid); logMessage(tr("Running command: %1").arg(QString::fromLatin1(cmd))); d->runner.run(cmd, d->device->sshParameters()); diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index f39615def88..d4ebaf979d9 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -162,6 +162,8 @@ const char KeyFileKey[] = "KeyFile"; const char PasswordKey[] = "Password"; const char TimeoutKey[] = "Timeout"; +const char DebugServerKey[] = "DebugServerKey"; + typedef QSsh::SshConnectionParameters::AuthenticationType AuthType; const AuthType DefaultAuthType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey; const IDevice::MachineType DefaultMachineType = IDevice::Hardware; @@ -189,6 +191,7 @@ public: QSsh::SshConnectionParameters sshParameters; Utils::PortList freePorts; + QString debugServerPath; }; } // namespace Internal @@ -325,6 +328,8 @@ void IDevice::fromMap(const QVariantMap &map) QLatin1String("10000-10100")).toString()); d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt()); d->version = map.value(QLatin1String(VersionKey), 0).toInt(); + + d->debugServerPath = map.value(QLatin1String(DebugServerKey)).toString(); } QVariantMap IDevice::toMap() const @@ -347,6 +352,8 @@ QVariantMap IDevice::toMap() const map.insert(QLatin1String(PortsSpecKey), d->freePorts.toString()); map.insert(QLatin1String(VersionKey), d->version); + map.insert(QLatin1String(DebugServerKey), d->debugServerPath); + return map; } @@ -397,6 +404,16 @@ IDevice::MachineType IDevice::machineType() const return d->machineType; } +QString IDevice::debugServerPath() const +{ + return d->debugServerPath; +} + +void IDevice::setDebugServerPath(const QString &path) +{ + d->debugServerPath = path; +} + int IDevice::version() const { return d->version; diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index 8b416c04099..b8e928f6945 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -149,6 +149,9 @@ public: MachineType machineType() const; + QString debugServerPath() const; + void setDebugServerPath(const QString &path); + protected: IDevice(); IDevice(Core::Id type, Origin origin, MachineType machineType, Core::Id id = Core::Id()); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp index ee93658fc3f..34959f4a1c9 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.cpp @@ -60,6 +60,7 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget( connect(m_ui->showPasswordCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool))); connect(m_ui->portsLineEdit, SIGNAL(editingFinished()), this, SLOT(handleFreePortsChanged())); connect(m_ui->createKeyButton, SIGNAL(clicked()), SLOT(createNewKey())); + connect(m_ui->gdbServerLineEdit, SIGNAL(editingFinished()), SLOT(gdbServerEditingFinished())); initGui(); } @@ -125,6 +126,11 @@ void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished() device()->setSshParameters(sshParams); } +void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished() +{ + device()->setDebugServerPath(m_ui->gdbServerLineEdit->text()); +} + void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged() { device()->setFreePorts(PortList::fromString(m_ui->portsLineEdit->text())); @@ -159,6 +165,7 @@ void GenericLinuxDeviceConfigurationWidget::updateDeviceFromUi() passwordEditingFinished(); keyFileEditingFinished(); handleFreePortsChanged(); + gdbServerEditingFinished(); } void GenericLinuxDeviceConfigurationWidget::updatePortsWarningLabel() @@ -199,5 +206,6 @@ void GenericLinuxDeviceConfigurationWidget::initGui() m_ui->pwdLineEdit->setText(sshParams.password); m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile); m_ui->showPasswordCheckBox->setChecked(false); + m_ui->gdbServerLineEdit->setText(device()->debugServerPath()); updatePortsWarningLabel(); } diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.h b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.h index 420f4a761db..db0a6777d27 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.h +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.h @@ -58,6 +58,7 @@ private slots: void userNameEditingFinished(); void passwordEditingFinished(); void keyFileEditingFinished(); + void gdbServerEditingFinished(); void showPassword(bool showClearText); void handleFreePortsChanged(); void setPrivateKey(const QString &path); diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.ui b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.ui index a1b2dbea5cd..1d935a9c2cf 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.ui +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwidget.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>393</width> - <height>206</height> + <height>321</height> </rect> </property> <property name="windowTitle"> @@ -17,7 +17,16 @@ <property name="fieldGrowthPolicy"> <enum>QFormLayout::FieldsStayAtSizeHint</enum> </property> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item row="1" column="0"> @@ -30,7 +39,16 @@ <item row="1" column="1"> <widget class="QWidget" name="authTypeButtonsWidget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -233,6 +251,20 @@ <item row="0" column="1"> <widget class="QLabel" name="machineTypeValueLabel"/> </item> + <item row="7" column="0"> + <widget class="QLabel" name="gdbServerLabel"> + <property name="text"> + <string>GDB server executable:</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLineEdit" name="gdbServerLineEdit"> + <property name="placeholderText"> + <string>Leave empty to look up executable in $PATH</string> + </property> + </widget> + </item> </layout> <zorder>passwordLabel</zorder> <zorder>authTypeButtonsWidget</zorder> @@ -244,6 +276,8 @@ <zorder>keyLabel</zorder> <zorder>machineTypeLabel</zorder> <zorder>machineTypeValueLabel</zorder> + <zorder>gdbServerLabel</zorder> + <zorder>gdbServerLineEdit</zorder> </widget> <customwidgets> <customwidget> diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 9e53238bd32..030df3661ef 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -162,17 +162,19 @@ void LinuxDeviceDebugSupport::startExecution() connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); if (d->qmlDebugging && !d->cppDebugging) connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); - QString command; + QStringList args = arguments(); - if (d->qmlDebugging) - args += QString::fromLocal8Bit("-qmljsdebugger=port:%1,block").arg(d->qmlPort); + QString command; if (d->qmlDebugging && !d->cppDebugging) { command = remoteFilePath(); } else { - command = QLatin1String("gdbserver"); + command = device()->debugServerPath(); + if (command.isEmpty()) + command = QLatin1String("gdbserver"); args.prepend(remoteFilePath()); args.prepend(QString::fromLatin1(":%1").arg(d->gdbServerPort)); } + connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool))); connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString))); -- GitLab