forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -122,7 +122,10 @@ void GdbServerStarter::portListReady()
|
|||||||
connect(&d->runner, SIGNAL(readyReadStandardError()), SLOT(handleProcessErrorOutput()));
|
connect(&d->runner, SIGNAL(readyReadStandardError()), SLOT(handleProcessErrorOutput()));
|
||||||
connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
|
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);
|
+ QByteArray::number(port) + ' ' + QByteArray::number(d->process.pid);
|
||||||
logMessage(tr("Running command: %1").arg(QString::fromLatin1(cmd)));
|
logMessage(tr("Running command: %1").arg(QString::fromLatin1(cmd)));
|
||||||
d->runner.run(cmd, d->device->sshParameters());
|
d->runner.run(cmd, d->device->sshParameters());
|
||||||
|
|||||||
@@ -162,6 +162,8 @@ const char KeyFileKey[] = "KeyFile";
|
|||||||
const char PasswordKey[] = "Password";
|
const char PasswordKey[] = "Password";
|
||||||
const char TimeoutKey[] = "Timeout";
|
const char TimeoutKey[] = "Timeout";
|
||||||
|
|
||||||
|
const char DebugServerKey[] = "DebugServerKey";
|
||||||
|
|
||||||
typedef QSsh::SshConnectionParameters::AuthenticationType AuthType;
|
typedef QSsh::SshConnectionParameters::AuthenticationType AuthType;
|
||||||
const AuthType DefaultAuthType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
|
const AuthType DefaultAuthType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
|
||||||
const IDevice::MachineType DefaultMachineType = IDevice::Hardware;
|
const IDevice::MachineType DefaultMachineType = IDevice::Hardware;
|
||||||
@@ -189,6 +191,7 @@ public:
|
|||||||
|
|
||||||
QSsh::SshConnectionParameters sshParameters;
|
QSsh::SshConnectionParameters sshParameters;
|
||||||
Utils::PortList freePorts;
|
Utils::PortList freePorts;
|
||||||
|
QString debugServerPath;
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
@@ -325,6 +328,8 @@ void IDevice::fromMap(const QVariantMap &map)
|
|||||||
QLatin1String("10000-10100")).toString());
|
QLatin1String("10000-10100")).toString());
|
||||||
d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
|
d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
|
||||||
d->version = map.value(QLatin1String(VersionKey), 0).toInt();
|
d->version = map.value(QLatin1String(VersionKey), 0).toInt();
|
||||||
|
|
||||||
|
d->debugServerPath = map.value(QLatin1String(DebugServerKey)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap IDevice::toMap() const
|
QVariantMap IDevice::toMap() const
|
||||||
@@ -347,6 +352,8 @@ QVariantMap IDevice::toMap() const
|
|||||||
map.insert(QLatin1String(PortsSpecKey), d->freePorts.toString());
|
map.insert(QLatin1String(PortsSpecKey), d->freePorts.toString());
|
||||||
map.insert(QLatin1String(VersionKey), d->version);
|
map.insert(QLatin1String(VersionKey), d->version);
|
||||||
|
|
||||||
|
map.insert(QLatin1String(DebugServerKey), d->debugServerPath);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,6 +404,16 @@ IDevice::MachineType IDevice::machineType() const
|
|||||||
return d->machineType;
|
return d->machineType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString IDevice::debugServerPath() const
|
||||||
|
{
|
||||||
|
return d->debugServerPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDevice::setDebugServerPath(const QString &path)
|
||||||
|
{
|
||||||
|
d->debugServerPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
int IDevice::version() const
|
int IDevice::version() const
|
||||||
{
|
{
|
||||||
return d->version;
|
return d->version;
|
||||||
|
|||||||
@@ -149,6 +149,9 @@ public:
|
|||||||
|
|
||||||
MachineType machineType() const;
|
MachineType machineType() const;
|
||||||
|
|
||||||
|
QString debugServerPath() const;
|
||||||
|
void setDebugServerPath(const QString &path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IDevice();
|
IDevice();
|
||||||
IDevice(Core::Id type, Origin origin, MachineType machineType, Core::Id id = Core::Id());
|
IDevice(Core::Id type, Origin origin, MachineType machineType, Core::Id id = Core::Id());
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget(
|
|||||||
connect(m_ui->showPasswordCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool)));
|
connect(m_ui->showPasswordCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool)));
|
||||||
connect(m_ui->portsLineEdit, SIGNAL(editingFinished()), this, SLOT(handleFreePortsChanged()));
|
connect(m_ui->portsLineEdit, SIGNAL(editingFinished()), this, SLOT(handleFreePortsChanged()));
|
||||||
connect(m_ui->createKeyButton, SIGNAL(clicked()), SLOT(createNewKey()));
|
connect(m_ui->createKeyButton, SIGNAL(clicked()), SLOT(createNewKey()));
|
||||||
|
connect(m_ui->gdbServerLineEdit, SIGNAL(editingFinished()), SLOT(gdbServerEditingFinished()));
|
||||||
|
|
||||||
initGui();
|
initGui();
|
||||||
}
|
}
|
||||||
@@ -125,6 +126,11 @@ void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished()
|
|||||||
device()->setSshParameters(sshParams);
|
device()->setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished()
|
||||||
|
{
|
||||||
|
device()->setDebugServerPath(m_ui->gdbServerLineEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged()
|
void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged()
|
||||||
{
|
{
|
||||||
device()->setFreePorts(PortList::fromString(m_ui->portsLineEdit->text()));
|
device()->setFreePorts(PortList::fromString(m_ui->portsLineEdit->text()));
|
||||||
@@ -159,6 +165,7 @@ void GenericLinuxDeviceConfigurationWidget::updateDeviceFromUi()
|
|||||||
passwordEditingFinished();
|
passwordEditingFinished();
|
||||||
keyFileEditingFinished();
|
keyFileEditingFinished();
|
||||||
handleFreePortsChanged();
|
handleFreePortsChanged();
|
||||||
|
gdbServerEditingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericLinuxDeviceConfigurationWidget::updatePortsWarningLabel()
|
void GenericLinuxDeviceConfigurationWidget::updatePortsWarningLabel()
|
||||||
@@ -199,5 +206,6 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
|
|||||||
m_ui->pwdLineEdit->setText(sshParams.password);
|
m_ui->pwdLineEdit->setText(sshParams.password);
|
||||||
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
||||||
m_ui->showPasswordCheckBox->setChecked(false);
|
m_ui->showPasswordCheckBox->setChecked(false);
|
||||||
|
m_ui->gdbServerLineEdit->setText(device()->debugServerPath());
|
||||||
updatePortsWarningLabel();
|
updatePortsWarningLabel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ private slots:
|
|||||||
void userNameEditingFinished();
|
void userNameEditingFinished();
|
||||||
void passwordEditingFinished();
|
void passwordEditingFinished();
|
||||||
void keyFileEditingFinished();
|
void keyFileEditingFinished();
|
||||||
|
void gdbServerEditingFinished();
|
||||||
void showPassword(bool showClearText);
|
void showPassword(bool showClearText);
|
||||||
void handleFreePortsChanged();
|
void handleFreePortsChanged();
|
||||||
void setPrivateKey(const QString &path);
|
void setPrivateKey(const QString &path);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>393</width>
|
<width>393</width>
|
||||||
<height>206</height>
|
<height>321</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -17,7 +17,16 @@
|
|||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
|
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
|
||||||
</property>
|
</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>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
@@ -30,7 +39,16 @@
|
|||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QWidget" name="authTypeButtonsWidget" native="true">
|
<widget class="QWidget" name="authTypeButtonsWidget" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<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>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@@ -233,6 +251,20 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="machineTypeValueLabel"/>
|
<widget class="QLabel" name="machineTypeValueLabel"/>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
<zorder>passwordLabel</zorder>
|
<zorder>passwordLabel</zorder>
|
||||||
<zorder>authTypeButtonsWidget</zorder>
|
<zorder>authTypeButtonsWidget</zorder>
|
||||||
@@ -244,6 +276,8 @@
|
|||||||
<zorder>keyLabel</zorder>
|
<zorder>keyLabel</zorder>
|
||||||
<zorder>machineTypeLabel</zorder>
|
<zorder>machineTypeLabel</zorder>
|
||||||
<zorder>machineTypeValueLabel</zorder>
|
<zorder>machineTypeValueLabel</zorder>
|
||||||
|
<zorder>gdbServerLabel</zorder>
|
||||||
|
<zorder>gdbServerLineEdit</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|||||||
@@ -162,17 +162,19 @@ void LinuxDeviceDebugSupport::startExecution()
|
|||||||
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||||
if (d->qmlDebugging && !d->cppDebugging)
|
if (d->qmlDebugging && !d->cppDebugging)
|
||||||
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
|
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
|
||||||
QString command;
|
|
||||||
QStringList args = arguments();
|
QStringList args = arguments();
|
||||||
if (d->qmlDebugging)
|
QString command;
|
||||||
args += QString::fromLocal8Bit("-qmljsdebugger=port:%1,block").arg(d->qmlPort);
|
|
||||||
if (d->qmlDebugging && !d->cppDebugging) {
|
if (d->qmlDebugging && !d->cppDebugging) {
|
||||||
command = remoteFilePath();
|
command = remoteFilePath();
|
||||||
} else {
|
} else {
|
||||||
command = QLatin1String("gdbserver");
|
command = device()->debugServerPath();
|
||||||
|
if (command.isEmpty())
|
||||||
|
command = QLatin1String("gdbserver");
|
||||||
args.prepend(remoteFilePath());
|
args.prepend(remoteFilePath());
|
||||||
args.prepend(QString::fromLatin1(":%1").arg(d->gdbServerPort));
|
args.prepend(QString::fromLatin1(":%1").arg(d->gdbServerPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
|
connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
|
||||||
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
|
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
|
||||||
connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
|
connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
|
||||||
|
|||||||
Reference in New Issue
Block a user