OSDN Git Service

Debugger/Remote Debugging: Add "GNU target" start parameter.
authorChristian Kandeler <christian.kandeler@nokia.com>
Fri, 29 Oct 2010 12:04:23 +0000 (14:04 +0200)
committerChristian Kandeler <christian.kandeler@nokia.com>
Fri, 29 Oct 2010 12:14:06 +0000 (14:14 +0200)
This is needed for multi-architecture gdb.

Reviewed-by: hjk
src/plugins/debugger/debuggerdialogs.cpp
src/plugins/debugger/debuggerdialogs.h
src/plugins/debugger/debuggerengine.h
src/plugins/debugger/debuggerplugin.cpp
src/plugins/debugger/gdb/remotegdbserveradapter.cpp
src/plugins/debugger/startremotedialog.ui
src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp

index 370b18e..7898dad 100644 (file)
@@ -686,6 +686,27 @@ QString StartRemoteDialog::remoteArchitecture() const
     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)
 {
     m_ui->serverStartScript->setPath(scriptName);
index e9b9b2f..4d168a3 100644 (file)
@@ -178,6 +178,10 @@ public:
     void setRemoteArchitecture(const QString &arch);
     void setRemoteArchitectures(const QStringList &arches);
 
+    QString gnuTarget() const;
+    void setGnuTarget(const QString &gnuTarget);
+    void setGnuTargets(const QStringList &gnuTargets);
+
     bool useServerStartScript() const;
     void setUseServerStartScript(bool on);
     QString serverStartScript() const;
index 60baa92..a3fe5e3 100644 (file)
@@ -90,6 +90,7 @@ public:
     // for remote debugging
     QString remoteChannel;
     QString remoteArchitecture;
+    QString gnuTarget;
     QString symbolFileName;
     bool useServerStartScript;
     QString serverStartScript;
index 2f01fd9..0f66486 100644 (file)
@@ -1877,16 +1877,28 @@ void DebuggerPluginPrivate::startRemoteApplication()
     QStringList arches;
     arches.append(_("i386:x86-64:intel"));
     arches.append(_("i386"));
+    arches.append(_("arm"));
     QString lastUsed = configValue(_("LastRemoteArchitecture")).toString();
     if (!arches.contains(lastUsed))
         arches.prepend(lastUsed);
     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(
             configValue(_("LastRemoteChannel")).toString());
     dlg.setLocalExecutable(
             configValue(_("LastLocalExecutable")).toString());
     dlg.setDebugger(configValue(_("LastDebugger")).toString());
     dlg.setRemoteArchitecture(lastUsed);
+    dlg.setGnuTarget(lastUsedGnuTarget);
     dlg.setServerStartScript(
             configValue(_("LastServerStartScript")).toString());
     dlg.setUseServerStartScript(
@@ -1898,11 +1910,13 @@ void DebuggerPluginPrivate::startRemoteApplication()
     setConfigValue(_("LastLocalExecutable"), dlg.localExecutable());
     setConfigValue(_("LastDebugger"), dlg.debugger());
     setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
+    setConfigValue(_("LastGnuTarget"), dlg.gnuTarget());
     setConfigValue(_("LastServerStartScript"), dlg.serverStartScript());
     setConfigValue(_("LastUseServerStartScript"), dlg.useServerStartScript());
     setConfigValue(_("LastSysroot"), dlg.sysRoot());
     sp.remoteChannel = dlg.remoteChannel();
     sp.remoteArchitecture = dlg.remoteArchitecture();
+    sp.gnuTarget = dlg.gnuTarget();
     sp.executable = dlg.localExecutable();
     sp.displayName = dlg.localExecutable();
     sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
index 86fa9ed..736b441 100644 (file)
@@ -171,12 +171,15 @@ void RemoteGdbServerAdapter::setupInferior()
     }
     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.join(_(" "));
 
     if (!remoteArch.isEmpty())
         m_engine->postCommand("set architecture " + remoteArch);
+    if (!gnuTarget.isEmpty())
+        m_engine->postCommand("set gnutarget " + gnuTarget);
     if (!sysRoot.isEmpty())
         m_engine->postCommand("set sysroot " + sysRoot);
     if (!solibPath.isEmpty())
index fe83dd2..f02da26 100644 (file)
@@ -6,25 +6,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>439</width>
-    <height>224</height>
+    <width>446</width>
+    <height>269</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Start Debugger</string>
   </property>
-  <layout class="QVBoxLayout">
-   <property name="spacing">
-    <number>6</number>
-   </property>
-   <property name="margin">
-    <number>9</number>
-   </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <layout class="QFormLayout" name="formLayout">
-     <property name="fieldGrowthPolicy">
-      <enum>QFormLayout::ExpandingFieldsGrow</enum>
-     </property>
      <item row="0" column="0">
       <widget class="QLabel" name="debuggerLabel">
        <property name="text">
       </widget>
      </item>
      <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">
        <property name="text">
         <string>Sysroot:</string>
        </property>
       </widget>
      </item>
-     <item row="4" column="1">
+     <item row="5" column="1">
       <widget class="Utils::PathChooser" name="sysrootPathChooser" native="true"/>
      </item>
-     <item row="5" column="0">
+     <item row="6" column="0">
       <widget class="QLabel" name="useServerStartScriptLabel">
        <property name="text">
         <string>Use server start script:</string>
        </property>
       </widget>
      </item>
-     <item row="5" column="1">
+     <item row="6" column="1">
       <widget class="QCheckBox" name="useServerStartScriptCheckBox"/>
      </item>
-     <item row="6" column="0">
+     <item row="7" column="0">
       <widget class="QLabel" name="serverStartScriptLabel">
        <property name="text">
         <string>Server start script:</string>
        </property>
       </widget>
      </item>
-     <item row="6" column="1">
+     <item row="7" column="1">
       <widget class="Utils::PathChooser" name="serverStartScript" native="true"/>
      </item>
     </layout>
index abac864..f045cf6 100644 (file)
@@ -99,6 +99,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
                 + QString::number(gdbServerPort(runConfig));
             params.useServerStartScript = true;
             params.remoteArchitecture = QLatin1String("arm");
+            params.gnuTarget = QLatin1String("arm-none-linux-gnueabi");
         }
     } else {
         params.startMode = AttachToRemote;