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: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-09-14 17:01:57 +02:00
committed by hjk
parent f68472433e
commit fd7808a26f
6 changed files with 50 additions and 13 deletions

View File

@@ -665,6 +665,8 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript)
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_ui->debuggerPathChooser->setExpectedKind(PathChooser::File); m_ui->debuggerPathChooser->setExpectedKind(PathChooser::File);
m_ui->debuggerPathChooser->setPromptDialogTitle(tr("Select Debugger")); 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->setExpectedKind(PathChooser::File);
m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable")); m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable"));
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot")); m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
@@ -720,6 +722,16 @@ QString StartRemoteDialog::debugger() const
return m_ui->debuggerPathChooser->path(); 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) void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
{ {
m_ui->architectureComboBox->clear(); m_ui->architectureComboBox->clear();

View File

@@ -210,6 +210,9 @@ public:
QString debugger() const; QString debugger() const;
void setDebugger(const QString &debugger); void setDebugger(const QString &debugger);
void setDebugInfoLocation(const QString &location);
QString debugInfoLocation() const;
private slots: private slots:
void updateState(); void updateState();

View File

@@ -1585,6 +1585,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
dlg.setUseServerStartScript( dlg.setUseServerStartScript(
configValue(_("LastUseServerStartScript")).toBool()); configValue(_("LastUseServerStartScript")).toBool());
dlg.setSysroot(configValue(_("LastSysroot")).toString()); dlg.setSysroot(configValue(_("LastSysroot")).toString());
dlg.setDebugInfoLocation(configValue(_("LastDebugInfoLocation")).toString());
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted)
return false; return false;
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel()); setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
@@ -1596,6 +1597,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript()); setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript()); setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
setConfigValue(_("LastSysroot"), dlg.sysroot()); setConfigValue(_("LastSysroot"), dlg.sysroot());
setConfigValue(_("LastDebugInfoLocation"), dlg.debugInfoLocation());
sp.remoteChannel = dlg.remoteChannel(); sp.remoteChannel = dlg.remoteChannel();
sp.remoteArchitecture = dlg.remoteArchitecture(); sp.remoteArchitecture = dlg.remoteArchitecture();
sp.gnuTarget = dlg.gnuTarget(); sp.gnuTarget = dlg.gnuTarget();
@@ -1609,6 +1611,9 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.useServerStartScript = dlg.useServerStartScript(); sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript(); sp.serverStartScript = dlg.serverStartScript();
sp.sysroot = dlg.sysroot(); sp.sysroot = dlg.sysroot();
sp.debugInfoLocation = dlg.debugInfoLocation();
if (sp.debugInfoLocation.isEmpty())
sp.debugInfoLocation = sp.sysroot + "/usr/lib/debug";
return true; return true;
} }

View File

@@ -108,6 +108,7 @@ public:
bool useServerStartScript; bool useServerStartScript;
QString serverStartScript; QString serverStartScript;
QString sysroot; QString sysroot;
QString debugInfoLocation;
QByteArray remoteDumperLib; QByteArray remoteDumperLib;
QByteArray remoteSourcesDir; QByteArray remoteSourcesDir;
QString remoteMountPoint; QString remoteMountPoint;

View File

@@ -161,18 +161,19 @@ void RemoteGdbServerAdapter::uploadProcFinished()
void RemoteGdbServerAdapter::setupInferior() void RemoteGdbServerAdapter::setupInferior()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
const DebuggerStartParameters &sp = startParameters();
QString fileName; QString fileName;
if (!startParameters().executable.isEmpty()) { if (!sp.executable.isEmpty()) {
QFileInfo fi(startParameters().executable); QFileInfo fi(sp.executable);
fileName = fi.absoluteFilePath(); fileName = fi.absoluteFilePath();
} }
const QByteArray sysroot = startParameters().sysroot.toLocal8Bit(); const QByteArray sysroot = sp.sysroot.toLocal8Bit();
const QByteArray remoteArch = startParameters().remoteArchitecture.toLatin1(); const QByteArray debugInfoLocation = sp.debugInfoLocation.toLocal8Bit();
const QByteArray gnuTarget = startParameters().gnuTarget.toLatin1(); const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
const QByteArray solibPath = const QByteArray gnuTarget = sp.gnuTarget.toLatin1();
QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit(); const QByteArray solibPath = QFileInfo(sp.dumperLibrary).path().toLocal8Bit();
const QString args = startParameters().processArgs; const QString args = sp.processArgs;
if (!remoteArch.isEmpty()) if (!remoteArch.isEmpty())
m_engine->postCommand("set architecture " + remoteArch); m_engine->postCommand("set architecture " + remoteArch);
@@ -180,6 +181,8 @@ void RemoteGdbServerAdapter::setupInferior()
m_engine->postCommand("set gnutarget " + gnuTarget); m_engine->postCommand("set gnutarget " + gnuTarget);
if (!sysroot.isEmpty()) if (!sysroot.isEmpty())
m_engine->postCommand("set sysroot " + sysroot); m_engine->postCommand("set sysroot " + sysroot);
if (!sysroot.isEmpty())
m_engine->postCommand("set debug-file-directory " + debugInfoLocation);
if (!solibPath.isEmpty()) if (!solibPath.isEmpty())
m_engine->postCommand("set solib-search-path " + solibPath); m_engine->postCommand("set solib-search-path " + solibPath);
if (!args.isEmpty()) if (!args.isEmpty())

View File

@@ -107,6 +107,19 @@
<widget class="Utils::PathChooser" name="sysrootPathChooser"/> <widget class="Utils::PathChooser" name="sysrootPathChooser"/>
</item> </item>
<item row="6" column="0"> <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"> <widget class="QLabel" name="overrideStartScriptLabel">
<property name="text"> <property name="text">
<string>Override host GDB s&amp;tart script:</string> <string>Override host GDB s&amp;tart script:</string>
@@ -116,10 +129,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="Utils::PathChooser" name="overrideStartScriptPathChooser"/> <widget class="Utils::PathChooser" name="overrideStartScriptPathChooser"/>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QLabel" name="useServerStartScriptLabel"> <widget class="QLabel" name="useServerStartScriptLabel">
<property name="text"> <property name="text">
<string>&amp;Use server start script:</string> <string>&amp;Use server start script:</string>
@@ -129,10 +142,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="8" column="1">
<widget class="QCheckBox" name="useServerStartScriptCheckBox"/> <widget class="QCheckBox" name="useServerStartScriptCheckBox"/>
</item> </item>
<item row="8" column="0"> <item row="9" column="0">
<widget class="QLabel" name="serverStartScriptLabel"> <widget class="QLabel" name="serverStartScriptLabel">
<property name="text"> <property name="text">
<string>&amp;Server start script:</string> <string>&amp;Server start script:</string>
@@ -142,7 +155,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<widget class="Utils::PathChooser" name="serverStartScriptPathChooser"/> <widget class="Utils::PathChooser" name="serverStartScriptPathChooser"/>
</item> </item>
</layout> </layout>