Commit fd7808a2 authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: better remote debugging

Add option to specify location of debug information to dialog.
Default is sysroot + usr/lib/debug.

Change-Id: I8c2ab448f4aba9385da617d23419e521e3ae263c
Reviewed-on: http://codereview.qt-project.org/4919

Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent f6847243
......@@ -665,6 +665,8 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_ui->debuggerPathChooser->setExpectedKind(PathChooser::File);
m_ui->debuggerPathChooser->setPromptDialogTitle(tr("Select Debugger"));
m_ui->debuginfoPathChooser->setExpectedKind(PathChooser::File);
m_ui->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information"));
m_ui->executablePathChooser->setExpectedKind(PathChooser::File);
m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable"));
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
......@@ -720,6 +722,16 @@ QString StartRemoteDialog::debugger() const
return m_ui->debuggerPathChooser->path();
}
void StartRemoteDialog::setDebugInfoLocation(const QString &location)
{
m_ui->debuginfoPathChooser->setPath(location);
}
QString StartRemoteDialog::debugInfoLocation() const
{
return m_ui->debuginfoPathChooser->path();
}
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
{
m_ui->architectureComboBox->clear();
......
......@@ -210,6 +210,9 @@ public:
QString debugger() const;
void setDebugger(const QString &debugger);
void setDebugInfoLocation(const QString &location);
QString debugInfoLocation() const;
private slots:
void updateState();
......
......@@ -1585,6 +1585,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
dlg.setUseServerStartScript(
configValue(_("LastUseServerStartScript")).toBool());
dlg.setSysroot(configValue(_("LastSysroot")).toString());
dlg.setDebugInfoLocation(configValue(_("LastDebugInfoLocation")).toString());
if (dlg.exec() != QDialog::Accepted)
return false;
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
......@@ -1596,6 +1597,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
setConfigValue(_("LastSysroot"), dlg.sysroot());
setConfigValue(_("LastDebugInfoLocation"), dlg.debugInfoLocation());
sp.remoteChannel = dlg.remoteChannel();
sp.remoteArchitecture = dlg.remoteArchitecture();
sp.gnuTarget = dlg.gnuTarget();
......@@ -1609,6 +1611,9 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
sp.sysroot = dlg.sysroot();
sp.debugInfoLocation = dlg.debugInfoLocation();
if (sp.debugInfoLocation.isEmpty())
sp.debugInfoLocation = sp.sysroot + "/usr/lib/debug";
return true;
}
......
......@@ -108,6 +108,7 @@ public:
bool useServerStartScript;
QString serverStartScript;
QString sysroot;
QString debugInfoLocation;
QByteArray remoteDumperLib;
QByteArray remoteSourcesDir;
QString remoteMountPoint;
......
......@@ -161,18 +161,19 @@ void RemoteGdbServerAdapter::uploadProcFinished()
void RemoteGdbServerAdapter::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
const DebuggerStartParameters &sp = startParameters();
QString fileName;
if (!startParameters().executable.isEmpty()) {
QFileInfo fi(startParameters().executable);
if (!sp.executable.isEmpty()) {
QFileInfo fi(sp.executable);
fileName = fi.absoluteFilePath();
}
const QByteArray sysroot = startParameters().sysroot.toLocal8Bit();
const QByteArray remoteArch = startParameters().remoteArchitecture.toLatin1();
const QByteArray gnuTarget = startParameters().gnuTarget.toLatin1();
const QByteArray solibPath =
QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit();
const QString args = startParameters().processArgs;
const QByteArray sysroot = sp.sysroot.toLocal8Bit();
const QByteArray debugInfoLocation = sp.debugInfoLocation.toLocal8Bit();
const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
const QByteArray gnuTarget = sp.gnuTarget.toLatin1();
const QByteArray solibPath = QFileInfo(sp.dumperLibrary).path().toLocal8Bit();
const QString args = sp.processArgs;
if (!remoteArch.isEmpty())
m_engine->postCommand("set architecture " + remoteArch);
......@@ -180,6 +181,8 @@ void RemoteGdbServerAdapter::setupInferior()
m_engine->postCommand("set gnutarget " + gnuTarget);
if (!sysroot.isEmpty())
m_engine->postCommand("set sysroot " + sysroot);
if (!sysroot.isEmpty())
m_engine->postCommand("set debug-file-directory " + debugInfoLocation);
if (!solibPath.isEmpty())
m_engine->postCommand("set solib-search-path " + solibPath);
if (!args.isEmpty())
......
......@@ -107,6 +107,19 @@
<widget class="Utils::PathChooser" name="sysrootPathChooser"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="debuginfoLabel">
<property name="text">
<string>Location of debugging information:</string>
</property>
<property name="buddy">
<cstring>debuginfoPathChooser</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Utils::PathChooser" name="debuginfoPathChooser"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="overrideStartScriptLabel">
<property name="text">
<string>Override host GDB s&amp;tart script:</string>
......@@ -116,10 +129,10 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptPathChooser"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="useServerStartScriptLabel">
<property name="text">
<string>&amp;Use server start script:</string>
......@@ -129,10 +142,10 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QCheckBox" name="useServerStartScriptCheckBox"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="serverStartScriptLabel">
<property name="text">
<string>&amp;Server start script:</string>
......@@ -142,7 +155,7 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="Utils::PathChooser" name="serverStartScriptPathChooser"/>
</item>
</layout>
......
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