diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a45eba421def80d75c62f7a044d6466a6b7510f2..90942a961756335d9ed55be316aff182121f9ed4 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -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) diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 4ad8b2d247832c5b86349577d91f7798e413d372..850242242902f1518347b0c827d99b0c2ef6ae1c 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -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()) diff --git a/src/plugins/debugger/lldb/lldbhost.pri b/src/plugins/debugger/lldb/lldbhost.pri index 31ed06dbfea959a2c7cc9973fbfd5f4935b112bf..0e9297d7e3dd914b2ab5ebaf3ec6955904a3366e 100644 --- a/src/plugins/debugger/lldb/lldbhost.pri +++ b/src/plugins/debugger/lldb/lldbhost.pri @@ -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 index 0000000000000000000000000000000000000000..7e62a64a66fd02e28262345dee34d63e2b29a171 --- /dev/null +++ b/src/plugins/debugger/lldb/lldboptionspage.cpp @@ -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 index 0000000000000000000000000000000000000000..3482a3a4e021c458170d3faab4f4267d4e3a00ab --- /dev/null +++ b/src/plugins/debugger/lldb/lldboptionspage.h @@ -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 index 0000000000000000000000000000000000000000..7e8753305b278e11810a1582ac562b6b738c81a0 --- /dev/null +++ b/src/plugins/debugger/lldb/lldboptionspagewidget.ui @@ -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>