OSDN Git Service

lldb: enable lldb through gui configure page
authorArvid Ephraim Picciani <arvid.picciani@nokia.com>
Fri, 26 Nov 2010 14:10:10 +0000 (15:10 +0100)
committerArvid Ephraim Picciani <arvid.picciani@nokia.com>
Fri, 26 Nov 2010 14:11:52 +0000 (15:11 +0100)
src/plugins/debugger/debuggerplugin.cpp
src/plugins/debugger/debuggerrunner.cpp
src/plugins/debugger/lldb/lldbhost.pri
src/plugins/debugger/lldb/lldboptionspage.cpp [new file with mode: 0644]
src/plugins/debugger/lldb/lldboptionspage.h [new file with mode: 0644]
src/plugins/debugger/lldb/lldboptionspagewidget.ui [new file with mode: 0644]

index a45eba4..90942a9 100644 (file)
@@ -418,6 +418,10 @@ void addTcfOptionPages(QList<IOptionsPage*> *opts);
 void addCdbOptionPages(QList<IOptionsPage*> *opts);
 #endif
 
+#ifdef WITH_LLDB
+void addLldbOptionPages(QList<IOptionsPage*> *opts);
+#endif
+
 static SessionManager *sessionManager()
 {
     return ProjectExplorerPlugin::instance()->session();
@@ -808,6 +812,10 @@ static bool parseArgument(QStringList::const_iterator &it,
         *enabledEngines &= ~TcfEngineType;
         return true;
     }
+    if (option == _("-disable-lldb")) {
+        *enabledEngines &= ~LldbEngineType;
+        return true;
+    }
 
     *errorMessage = DebuggerPlugin::tr("Invalid debugger option: %1").arg(option);
     return false;
@@ -1947,6 +1955,11 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
 #ifdef Q_OS_WIN
     Debugger::Cdb::addCdb2OptionPages(&engineOptionPages);
 #endif
+#ifdef WITH_LLDB
+    if (cmdLineEnabledEngines & LldbEngineType)
+        addLldbOptionPages(&engineOptionPages);
+#endif
+
     //if (cmdLineEnabledEngines & ScriptEngineType)
     //    addScriptOptionPages(&engineOptionPages);
     //if (cmdLineEnabledEngines & TcfEngineType)
index 4ad8b2d..8502422 100644 (file)
@@ -460,8 +460,14 @@ static DebuggerEngineType engineForToolChain(int toolChainType)
         case ProjectExplorer::ToolChain_RVCT_ARMV5_GNUPOC:
         case ProjectExplorer::ToolChain_GCCE_GNUPOC:
         case ProjectExplorer::ToolChain_GCC_MAEMO:
+#ifdef WITH_LLDB
+            // lldb override
+            if (Core::ICore::instance()->settings()->value("LLDB/enabled").toBool())
+                return LldbEngineType;
+#endif
             return GdbEngineType;
 
+
         case ProjectExplorer::ToolChain_MSVC:
         case ProjectExplorer::ToolChain_WINCE:
             return CdbEngineType;
@@ -499,9 +505,6 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
     if (sp.processArgs.startsWith(__("@tcf@ ")))
         engineType = GdbEngineType;
 
-    if (sp.processArgs.contains( _("@lldb@")))
-        engineType = LldbEngineType;
-
     if (engineType == NoEngineType
             && sp.startMode != AttachToRemote
             && !sp.executable.isEmpty())
index 31ed06d..0e9297d 100644 (file)
@@ -14,4 +14,7 @@ RESOURCES +=
 
 !isEmpty(WITH_LLDB) {
     DEFINES += WITH_LLDB
+    HEADERS += $$PWD/lldboptionspage.h
+    SOURCES += $$PWD/lldboptionspage.cpp
+    FORMS += $$PWD/lldboptionspagewidget.ui
 }
diff --git a/src/plugins/debugger/lldb/lldboptionspage.cpp b/src/plugins/debugger/lldb/lldboptionspage.cpp
new file mode 100644 (file)
index 0000000..7e62a64
--- /dev/null
@@ -0,0 +1,132 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "lldboptionspage.h"
+#include "debuggerconstants.h"
+
+#include <coreplugin/icore.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QUrl>
+#include <QtCore/QTextStream>
+#include <QtGui/QMessageBox>
+#include <QtGui/QDesktopServices>
+
+namespace Debugger {
+namespace Internal {
+
+LldbOptionsPageWidget::LldbOptionsPageWidget(QWidget *parent, QSettings *s_)
+    : QWidget(parent)
+    , s(s_)
+{
+    m_ui.setupUi(this);
+    load();
+}
+
+void LldbOptionsPageWidget::save()
+{
+    s->beginGroup(QLatin1String("LLDB"));
+    s->setValue(QLatin1String("enabled"), m_ui.enableLldb->isChecked ());
+    s->setValue(QLatin1String("gdbEmu"), m_ui.gdbEmu->isChecked ());
+    s->endGroup();
+}
+
+void LldbOptionsPageWidget::load()
+{
+    s->beginGroup(QLatin1String("LLDB"));
+    m_ui.enableLldb->setChecked(s->value(QLatin1String("enabled"), false).toBool());
+    m_ui.gdbEmu->setChecked(s->value(QLatin1String("gdbEmu"), true).toBool());
+    s->endGroup();
+}
+
+// ---------- LldbOptionsPage
+LldbOptionsPage::LldbOptionsPage()
+{
+//    m_options->fromSettings(Core::ICore::instance()->settings());
+}
+
+LldbOptionsPage::~LldbOptionsPage()
+{
+}
+
+QString LldbOptionsPage::settingsId()
+{
+    return QLatin1String("F.Lldb");
+}
+
+QString LldbOptionsPage::displayName() const
+{
+    return tr("LLDB");
+}
+
+QString LldbOptionsPage::category() const
+{
+    return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
+}
+
+QString LldbOptionsPage::displayCategory() const
+{
+    return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
+}
+
+QIcon LldbOptionsPage::categoryIcon() const
+{
+    return QIcon(QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
+}
+
+QWidget *LldbOptionsPage::createPage(QWidget *parent)
+{
+    m_widget = new LldbOptionsPageWidget(parent, Core::ICore::instance()->settings());
+    return m_widget;
+}
+
+void LldbOptionsPage::apply()
+{
+    if (!m_widget)
+        return;
+    m_widget->save();
+}
+
+void LldbOptionsPage::finish()
+{
+}
+
+bool LldbOptionsPage::matches(const QString &s) const
+{
+    return QString(s.toLower()).contains("lldb");
+}
+
+void addLldbOptionPages(QList<Core::IOptionsPage *> *opts)
+{
+    opts->push_back(new LldbOptionsPage);
+}
+
+
+} // namespace Internal
+} // namespace Debugger
diff --git a/src/plugins/debugger/lldb/lldboptionspage.h b/src/plugins/debugger/lldb/lldboptionspage.h
new file mode 100644 (file)
index 0000000..3482a3a
--- /dev/null
@@ -0,0 +1,88 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef LLDBSETTINGSPAGE_H
+#define LLDBSETTINGSPAGE_H
+
+#include <coreplugin/dialogs/ioptionspage.h>
+#include "ui_lldboptionspagewidget.h"
+
+#include <QtGui/QWidget>
+#include <QtCore/QPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QSettings>
+
+namespace Debugger {
+namespace Internal {
+
+class LldbOptionsPageWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit LldbOptionsPageWidget(QWidget *parent, QSettings *s);
+
+public slots:
+    void save();
+    void load();
+
+private:
+    Ui::LldbOptionsPageWidget m_ui;
+    QSettings *s;
+};
+
+class LldbOptionsPage : public Core::IOptionsPage
+{
+    Q_DISABLE_COPY(LldbOptionsPage)
+    Q_OBJECT
+public:
+    explicit LldbOptionsPage();
+    virtual ~LldbOptionsPage();
+
+    // IOptionsPage
+    virtual QString id() const { return settingsId(); }
+    virtual QString displayName() const;
+    virtual QString category() const;
+    virtual QString displayCategory() const;
+    QIcon categoryIcon() const;
+
+    virtual QWidget *createPage(QWidget *parent);
+    virtual void apply();
+    virtual void finish();
+    virtual bool matches(const QString &) const;
+
+    static QString settingsId();
+
+private:
+    QPointer<LldbOptionsPageWidget> m_widget;
+};
+
+} // namespace Internal
+} // namespace Debugger
+
+#endif // LLDBSETTINGSPAGE_H
diff --git a/src/plugins/debugger/lldb/lldboptionspagewidget.ui b/src/plugins/debugger/lldb/lldboptionspagewidget.ui
new file mode 100644 (file)
index 0000000..7e87533
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>LldbOptionsPageWidget</class>
+ <widget class="QWidget" name="LldbOptionsPageWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>522</width>
+    <height>512</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout"/>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="enableLldb">
+     <property name="title">
+      <string>Enable LLDB</string>
+     </property>
+     <property name="checkable">
+      <bool>true</bool>
+     </property>
+     <property name="checked">
+      <bool>false</bool>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QCheckBox" name="gdbEmu">
+        <property name="text">
+         <string>Use Gdb python dumpers</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>203</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>