Debugger/Remote Debugging: Add "GNU target" start parameter.

This is needed for multi-architecture gdb.

Reviewed-by: hjk
This commit is contained in:
Christian Kandeler
2010-10-29 14:04:23 +02:00
parent f900b90c46
commit 0bea245745
7 changed files with 66 additions and 17 deletions

View File

@@ -686,6 +686,27 @@ QString StartRemoteDialog::remoteArchitecture() const
return m_ui->architectureComboBox->currentText(); return m_ui->architectureComboBox->currentText();
} }
QString StartRemoteDialog::gnuTarget() const
{
return m_ui->gnuTargetComboBox->currentText();
}
void StartRemoteDialog::setGnuTargets(const QStringList &gnuTargets)
{
m_ui->gnuTargetComboBox->clear();
if (!gnuTargets.isEmpty()) {
m_ui->gnuTargetComboBox->insertItems(0, gnuTargets);
m_ui->gnuTargetComboBox->setCurrentIndex(0);
}
}
void StartRemoteDialog::setGnuTarget(const QString &gnuTarget)
{
const int index = m_ui->gnuTargetComboBox->findText(gnuTarget);
if (index != -1)
m_ui->gnuTargetComboBox->setCurrentIndex(index);
}
void StartRemoteDialog::setServerStartScript(const QString &scriptName) void StartRemoteDialog::setServerStartScript(const QString &scriptName)
{ {
m_ui->serverStartScript->setPath(scriptName); m_ui->serverStartScript->setPath(scriptName);

View File

@@ -178,6 +178,10 @@ public:
void setRemoteArchitecture(const QString &arch); void setRemoteArchitecture(const QString &arch);
void setRemoteArchitectures(const QStringList &arches); void setRemoteArchitectures(const QStringList &arches);
QString gnuTarget() const;
void setGnuTarget(const QString &gnuTarget);
void setGnuTargets(const QStringList &gnuTargets);
bool useServerStartScript() const; bool useServerStartScript() const;
void setUseServerStartScript(bool on); void setUseServerStartScript(bool on);
QString serverStartScript() const; QString serverStartScript() const;

View File

@@ -90,6 +90,7 @@ public:
// for remote debugging // for remote debugging
QString remoteChannel; QString remoteChannel;
QString remoteArchitecture; QString remoteArchitecture;
QString gnuTarget;
QString symbolFileName; QString symbolFileName;
bool useServerStartScript; bool useServerStartScript;
QString serverStartScript; QString serverStartScript;

View File

@@ -1877,16 +1877,28 @@ void DebuggerPluginPrivate::startRemoteApplication()
QStringList arches; QStringList arches;
arches.append(_("i386:x86-64:intel")); arches.append(_("i386:x86-64:intel"));
arches.append(_("i386")); arches.append(_("i386"));
arches.append(_("arm"));
QString lastUsed = configValue(_("LastRemoteArchitecture")).toString(); QString lastUsed = configValue(_("LastRemoteArchitecture")).toString();
if (!arches.contains(lastUsed)) if (!arches.contains(lastUsed))
arches.prepend(lastUsed); arches.prepend(lastUsed);
dlg.setRemoteArchitectures(arches); dlg.setRemoteArchitectures(arches);
QStringList gnuTargets;
gnuTargets.append(_("auto"));
gnuTargets.append(_("i686-linux-gnu"));
gnuTargets.append(_("x86_64-linux-gnu"));
gnuTargets.append(_("arm-none-linux-gnueabi"));
const QString lastUsedGnuTarget
= configValue(_("LastGnuTarget")).toString();
if (!gnuTargets.contains(lastUsedGnuTarget))
gnuTargets.prepend(lastUsedGnuTarget);
dlg.setGnuTargets(gnuTargets);
dlg.setRemoteChannel( dlg.setRemoteChannel(
configValue(_("LastRemoteChannel")).toString()); configValue(_("LastRemoteChannel")).toString());
dlg.setLocalExecutable( dlg.setLocalExecutable(
configValue(_("LastLocalExecutable")).toString()); configValue(_("LastLocalExecutable")).toString());
dlg.setDebugger(configValue(_("LastDebugger")).toString()); dlg.setDebugger(configValue(_("LastDebugger")).toString());
dlg.setRemoteArchitecture(lastUsed); dlg.setRemoteArchitecture(lastUsed);
dlg.setGnuTarget(lastUsedGnuTarget);
dlg.setServerStartScript( dlg.setServerStartScript(
configValue(_("LastServerStartScript")).toString()); configValue(_("LastServerStartScript")).toString());
dlg.setUseServerStartScript( dlg.setUseServerStartScript(
@@ -1898,11 +1910,13 @@ void DebuggerPluginPrivate::startRemoteApplication()
setConfigValue(_("LastLocalExecutable"), dlg.localExecutable()); setConfigValue(_("LastLocalExecutable"), dlg.localExecutable());
setConfigValue(_("LastDebugger"), dlg.debugger()); setConfigValue(_("LastDebugger"), dlg.debugger());
setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture()); setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
setConfigValue(_("LastGnuTarget"), dlg.gnuTarget());
setConfigValue(_("LastServerStartScript"), dlg.serverStartScript()); setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript()); setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
setConfigValue(_("LastSysroot"), dlg.sysRoot()); setConfigValue(_("LastSysroot"), dlg.sysRoot());
sp.remoteChannel = dlg.remoteChannel(); sp.remoteChannel = dlg.remoteChannel();
sp.remoteArchitecture = dlg.remoteArchitecture(); sp.remoteArchitecture = dlg.remoteArchitecture();
sp.gnuTarget = dlg.gnuTarget();
sp.executable = dlg.localExecutable(); sp.executable = dlg.localExecutable();
sp.displayName = dlg.localExecutable(); sp.displayName = dlg.localExecutable();
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection. sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.

View File

@@ -171,12 +171,15 @@ void RemoteGdbServerAdapter::setupInferior()
} }
const QByteArray sysRoot = startParameters().sysRoot.toLocal8Bit(); const QByteArray sysRoot = startParameters().sysRoot.toLocal8Bit();
const QByteArray remoteArch = startParameters().remoteArchitecture.toLatin1(); const QByteArray remoteArch = startParameters().remoteArchitecture.toLatin1();
const QByteArray gnuTarget = startParameters().gnuTarget.toLatin1();
const QByteArray solibPath = const QByteArray solibPath =
QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit(); QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit();
const QString args = startParameters().processArgs.join(_(" ")); const QString args = startParameters().processArgs.join(_(" "));
if (!remoteArch.isEmpty()) if (!remoteArch.isEmpty())
m_engine->postCommand("set architecture " + remoteArch); m_engine->postCommand("set architecture " + remoteArch);
if (!gnuTarget.isEmpty())
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 (!solibPath.isEmpty()) if (!solibPath.isEmpty())

View File

@@ -6,25 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>439</width> <width>446</width>
<height>224</height> <height>269</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Start Debugger</string> <string>Start Debugger</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="debuggerLabel"> <widget class="QLabel" name="debuggerLabel">
<property name="text"> <property name="text">
@@ -74,33 +65,47 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="gnuTargetLabel">
<property name="text">
<string>GNU target</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="gnuTargetComboBox">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="sysrootLabel"> <widget class="QLabel" name="sysrootLabel">
<property name="text"> <property name="text">
<string>Sysroot:</string> <string>Sysroot:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="Utils::PathChooser" name="sysrootPathChooser" native="true"/> <widget class="Utils::PathChooser" name="sysrootPathChooser" native="true"/>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="useServerStartScriptLabel"> <widget class="QLabel" name="useServerStartScriptLabel">
<property name="text"> <property name="text">
<string>Use server start script:</string> <string>Use server start script:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QCheckBox" name="useServerStartScriptCheckBox"/> <widget class="QCheckBox" name="useServerStartScriptCheckBox"/>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<widget class="QLabel" name="serverStartScriptLabel"> <widget class="QLabel" name="serverStartScriptLabel">
<property name="text"> <property name="text">
<string>Server start script:</string> <string>Server start script:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="Utils::PathChooser" name="serverStartScript" native="true"/> <widget class="Utils::PathChooser" name="serverStartScript" native="true"/>
</item> </item>
</layout> </layout>

View File

@@ -99,6 +99,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
+ QString::number(gdbServerPort(runConfig)); + QString::number(gdbServerPort(runConfig));
params.useServerStartScript = true; params.useServerStartScript = true;
params.remoteArchitecture = QLatin1String("arm"); params.remoteArchitecture = QLatin1String("arm");
params.gnuTarget = QLatin1String("arm-none-linux-gnueabi");
} }
} else { } else {
params.startMode = AttachToRemote; params.startMode = AttachToRemote;