Split apart debugger options pages, allow specifying a path to CDB.

Modify engine creation funcs to populate a list of option pages
to be able to handle engine enabling independently of the
actual engine creation.
This commit is contained in:
Friedemann Kleint
2009-04-17 09:03:32 +02:00
parent bc89f5dc4f
commit 7d41e04884
24 changed files with 914 additions and 216 deletions

View File

@@ -44,15 +44,17 @@
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
#ifdef Q_OS_MAC
/*static*/ const char * const Core::Utils::PathChooser::browseButtonLabel =
QT_TRANSLATE_NOOP("Core::Utils::PathChooser", "Choose...");
#else
/*static*/ const char * const Core::Utils::PathChooser::browseButtonLabel =
QT_TRANSLATE_NOOP("Core::Utils::PathChooser", "Browse...");
#endif
namespace Core { namespace Core {
namespace Utils { namespace Utils {
#ifdef Q_OS_MAC
/*static*/ const char * const PathChooser::browseButtonLabel = "Choose...";
#else
/*static*/ const char * const PathChooser::browseButtonLabel = "Browse...";
#endif
// ------------------ PathValidatingLineEdit // ------------------ PathValidatingLineEdit
class PathValidatingLineEdit : public BaseValidatingLineEdit class PathValidatingLineEdit : public BaseValidatingLineEdit
{ {
@@ -83,6 +85,7 @@ struct PathChooserPrivate
{ {
PathChooserPrivate(PathChooser *chooser); PathChooserPrivate(PathChooser *chooser);
QHBoxLayout *m_hLayout;
PathValidatingLineEdit *m_lineEdit; PathValidatingLineEdit *m_lineEdit;
PathChooser::Kind m_acceptingKind; PathChooser::Kind m_acceptingKind;
QString m_dialogTitleOverride; QString m_dialogTitleOverride;
@@ -90,6 +93,7 @@ struct PathChooserPrivate
}; };
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) : PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
m_hLayout(new QHBoxLayout),
m_lineEdit(new PathValidatingLineEdit(chooser)), m_lineEdit(new PathValidatingLineEdit(chooser)),
m_acceptingKind(PathChooser::Directory) m_acceptingKind(PathChooser::Directory)
{ {
@@ -99,8 +103,8 @@ PathChooser::PathChooser(QWidget *parent) :
QWidget(parent), QWidget(parent),
m_d(new PathChooserPrivate(this)) m_d(new PathChooserPrivate(this))
{ {
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setContentsMargins(0, 0, 0, 0); m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);
connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed())); connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
@@ -108,19 +112,12 @@ PathChooser::PathChooser(QWidget *parent) :
connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
m_d->m_lineEdit->setMinimumWidth(200); m_d->m_lineEdit->setMinimumWidth(200);
hLayout->addWidget(m_d->m_lineEdit); m_d->m_hLayout->addWidget(m_d->m_lineEdit);
hLayout->setSizeConstraint(QLayout::SetMinimumSize); m_d->m_hLayout->setSizeConstraint(QLayout::SetMinimumSize);
#ifdef Q_OS_MAC addButton(tr(browseButtonLabel), this, SLOT(slotBrowse()));
QPushButton *browseButton = new QPushButton;
#else
QToolButton *browseButton = new QToolButton;
#endif
browseButton->setText(tr(browseButtonLabel));
connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
hLayout->addWidget(browseButton); setLayout(m_d->m_hLayout);
setLayout(hLayout);
setFocusProxy(m_d->m_lineEdit); setFocusProxy(m_d->m_lineEdit);
} }
@@ -129,6 +126,18 @@ PathChooser::~PathChooser()
delete m_d; delete m_d;
} }
void PathChooser::addButton(const QString &text, QObject *receiver, const char *slotFunc)
{
#ifdef Q_OS_MAC
QPushButton *button = new QPushButton;
#else
QToolButton *button = new QToolButton;
#endif
button->setText(text);
connect(button, SIGNAL(clicked()), receiver, slotFunc);
m_d->m_hLayout->addWidget(button);
}
QString PathChooser::path() const QString PathChooser::path() const
{ {
return m_d->m_lineEdit->text(); return m_d->m_lineEdit->text();

View File

@@ -82,6 +82,8 @@ public:
/** Return the home directory, which needs some fixing under Windows. */ /** Return the home directory, which needs some fixing under Windows. */
static QString homePath(); static QString homePath();
void addButton(const QString &text, QObject *receiver, const char *slotFunc);
private: private:
// Returns overridden title or the one from <title> // Returns overridden title or the one from <title>
QString makeDialogTitle(const QString &title); QString makeDialogTitle(const QString &title);

View File

@@ -25,6 +25,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="Find" version="1.1.80"/> <dependency name="Find" version="1.1.80"/>
</dependencyList> </dependencyList>
<argumentList> <argumentList>
<argument name="-enable-cdb"/> <argument name="-disable-cdb">Disable CDB debugger engine</argument>
</argumentList> </argumentList>
</plugin> </plugin>

View File

@@ -10,6 +10,10 @@ CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk"
CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x86)/sdk" CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x86)/sdk"
} }
!exists ($$CDB_PATH) {
CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows (x64)/sdk"
}
exists ($$CDB_PATH) { exists ($$CDB_PATH) {
message("Experimental: Adding support for $$CDB_PATH") message("Experimental: Adding support for $$CDB_PATH")
@@ -31,7 +35,9 @@ HEADERS += \
$$PWD/cdbstacktracecontext.h \ $$PWD/cdbstacktracecontext.h \
$$PWD/cdbbreakpoint.h \ $$PWD/cdbbreakpoint.h \
$$PWD/cdbmodules.h \ $$PWD/cdbmodules.h \
$$PWD/cdbassembler.h $$PWD/cdbassembler.h \
$$PWD/cdboptions.h \
$$PWD/cdboptionspage.h
SOURCES += \ SOURCES += \
$$PWD/cdbdebugengine.cpp \ $$PWD/cdbdebugengine.cpp \
@@ -41,7 +47,11 @@ SOURCES += \
$$PWD/cdbstacktracecontext.cpp \ $$PWD/cdbstacktracecontext.cpp \
$$PWD/cdbbreakpoint.cpp \ $$PWD/cdbbreakpoint.cpp \
$$PWD/cdbmodules.cpp \ $$PWD/cdbmodules.cpp \
$$PWD/cdbassembler.cpp $$PWD/cdbassembler.cpp \
$$PWD/cdboptions.cpp \
$$PWD/cdboptionspage.cpp
FORMS += $$PWD/cdboptionspagewidget.ui
} else { } else {
message("Debugging Tools for Windows could not be found in $$CDB_PATH") message("Debugging Tools for Windows could not be found in $$CDB_PATH")

View File

@@ -34,6 +34,8 @@
#include "cdbbreakpoint.h" #include "cdbbreakpoint.h"
#include "cdbmodules.h" #include "cdbmodules.h"
#include "cdbassembler.h" #include "cdbassembler.h"
#include "cdboptionspage.h"
#include "cdboptions.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggermanager.h" #include "debuggermanager.h"
@@ -45,6 +47,7 @@
#include "disassemblerhandler.h" #include "disassemblerhandler.h"
#include "watchutils.h" #include "watchutils.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/winutils.h> #include <utils/winutils.h>
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
@@ -140,10 +143,15 @@ DebuggerEngineLibrary::DebuggerEngineLibrary() :
{ {
} }
bool DebuggerEngineLibrary::init(QString *errorMessage) bool DebuggerEngineLibrary::init(const QString &path, QString *errorMessage)
{ {
// Load // Load from path
QLibrary lib(QLatin1String(dbgEngineDllC), 0); QString dllPath = path;
if (!dllPath.isEmpty())
dllPath += QDir::separator();
dllPath += QLatin1String(dbgEngineDllC);
QLibrary lib(dllPath, 0);
if (!lib.isLoaded() && !lib.load()) { if (!lib.isLoaded() && !lib.load()) {
*errorMessage = CdbDebugEngine::tr("Unable to load the debugger engine library '%1': %2"). *errorMessage = CdbDebugEngine::tr("Unable to load the debugger engine library '%1': %2").
@@ -191,7 +199,10 @@ SyntaxSetter::~SyntaxSetter()
// --- CdbDebugEnginePrivate // --- CdbDebugEnginePrivate
CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine) : CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options,
CdbDebugEngine* engine) :
m_options(options),
m_hDebuggeeProcess(0), m_hDebuggeeProcess(0),
m_hDebuggeeThread(0), m_hDebuggeeThread(0),
m_breakEventMode(BreakEventHandle), m_breakEventMode(BreakEventHandle),
@@ -215,7 +226,7 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
{ {
// Load the DLL // Load the DLL
DebuggerEngineLibrary lib; DebuggerEngineLibrary lib;
if (!lib.init(errorMessage)) if (!lib.init(m_options->path, errorMessage))
return false; return false;
// Initialize the COM interfaces // Initialize the COM interfaces
@@ -259,18 +270,15 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
return true; return true;
} }
IDebuggerEngine *CdbDebugEngine::create(DebuggerManager *parent) IDebuggerEngine *CdbDebugEngine::create(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options,
QString *errorMessage)
{ {
QString errorMessage; CdbDebugEngine *rc = new CdbDebugEngine(parent, options);
IDebuggerEngine *rc = 0; if (rc->m_d->init(errorMessage))
CdbDebugEngine *e = new CdbDebugEngine(parent);
if (e->m_d->init(&errorMessage)) {
rc = e;
} else {
delete e;
qWarning("%s", qPrintable(errorMessage));
}
return rc; return rc;
delete rc;
return 0;
} }
CdbDebugEnginePrivate::~CdbDebugEnginePrivate() CdbDebugEnginePrivate::~CdbDebugEnginePrivate()
@@ -306,9 +314,9 @@ void CdbDebugEnginePrivate::cleanStackTrace()
} }
} }
CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) : CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent, const QSharedPointer<CdbOptions> &options) :
IDebuggerEngine(parent), IDebuggerEngine(parent),
m_d(new CdbDebugEnginePrivate(parent, this)) m_d(new CdbDebugEnginePrivate(parent, options, this))
{ {
// m_d->m_consoleStubProc.setDebug(true); // m_d->m_consoleStubProc.setDebug(true);
connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString))); connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString)));
@@ -1327,8 +1335,24 @@ void CdbDebugEngine::reloadSourceFiles()
} // namespace Debugger } // namespace Debugger
// Accessed by DebuggerManager // Accessed by DebuggerManager
Debugger::Internal::IDebuggerEngine *createWinEngine(Debugger::Internal::DebuggerManager *parent) Debugger::Internal::IDebuggerEngine *createWinEngine(Debugger::Internal::DebuggerManager *parent,
bool cmdLineDisabled,
QList<Core::IOptionsPage*> *opts)
{ {
return Debugger::Internal::CdbDebugEngine::create(parent); // Create options page
QSharedPointer<Debugger::Internal::CdbOptions> options(new Debugger::Internal::CdbOptions);
options->fromSettings(Core::ICore::instance()->settings());
Debugger::Internal::CdbOptionsPage *optionsPage = new Debugger::Internal::CdbOptionsPage(options);
opts->push_back(optionsPage);
if (cmdLineDisabled || !options->enabled)
return 0;
// Create engine
QString errorMessage;
Debugger::Internal::IDebuggerEngine *engine =
Debugger::Internal::CdbDebugEngine::create(parent, options, &errorMessage);
if (!engine) {
optionsPage->setFailureMessage(errorMessage);
qWarning("%s", qPrintable(errorMessage));
}
return engine;
} }

View File

@@ -33,6 +33,8 @@
#include "idebuggerengine.h" #include "idebuggerengine.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include <QtCore/QSharedPointer>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -40,18 +42,22 @@ class DebuggerManager;
class CdbDebugEventCallback; class CdbDebugEventCallback;
class CdbDebugOutput; class CdbDebugOutput;
struct CdbDebugEnginePrivate; struct CdbDebugEnginePrivate;
struct CdbOptions;
class CdbDebugEngine : public IDebuggerEngine class CdbDebugEngine : public IDebuggerEngine
{ {
Q_DISABLE_COPY(CdbDebugEngine) Q_DISABLE_COPY(CdbDebugEngine)
Q_OBJECT Q_OBJECT
explicit CdbDebugEngine(DebuggerManager *parent); explicit CdbDebugEngine(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options);
public: public:
~CdbDebugEngine(); ~CdbDebugEngine();
// Factory function that returns 0 if the debug engine library cannot be found. // Factory function that returns 0 if the debug engine library cannot be found.
static IDebuggerEngine *create(DebuggerManager *parent); static IDebuggerEngine *create(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options,
QString *errorMessage);
virtual void shutdown(); virtual void shutdown();
virtual void setToolTipExpression(const QPoint &pos, const QString &exp); virtual void setToolTipExpression(const QPoint &pos, const QString &exp);

View File

@@ -32,9 +32,12 @@
#include "cdbdebugeventcallback.h" #include "cdbdebugeventcallback.h"
#include "cdbdebugoutput.h" #include "cdbdebugoutput.h"
#include "cdboptions.h"
#include "stackhandler.h" #include "stackhandler.h"
#include "debuggermanager.h" #include "debuggermanager.h"
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
#include <QtCore/QSharedPointer>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -52,7 +55,7 @@ class DebuggerEngineLibrary
{ {
public: public:
DebuggerEngineLibrary(); DebuggerEngineLibrary();
bool init(QString *errorMessage); bool init(const QString &path, QString *errorMessage);
inline HRESULT debugCreate(REFIID interfaceId, PVOID *interfaceHandle) const inline HRESULT debugCreate(REFIID interfaceId, PVOID *interfaceHandle) const
{ return m_debugCreate(interfaceId, interfaceHandle); } { return m_debugCreate(interfaceId, interfaceHandle); }
@@ -72,7 +75,9 @@ struct CdbDebugEnginePrivate
BreakEventSyncBreakPoints, BreakEventSyncBreakPoints,
}; };
explicit CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine); explicit CdbDebugEnginePrivate(DebuggerManager *parent,
const QSharedPointer<CdbOptions> &options,
CdbDebugEngine* engine);
bool init(QString *errorMessage); bool init(QString *errorMessage);
~CdbDebugEnginePrivate(); ~CdbDebugEnginePrivate();
@@ -98,6 +103,7 @@ struct CdbDebugEnginePrivate
bool attemptBreakpointSynchronization(QString *errorMessage); bool attemptBreakpointSynchronization(QString *errorMessage);
const QSharedPointer<CdbOptions> m_options;
HANDLE m_hDebuggeeProcess; HANDLE m_hDebuggeeProcess;
HANDLE m_hDebuggeeThread; HANDLE m_hDebuggeeThread;
int m_currentThreadId; int m_currentThreadId;

View File

@@ -0,0 +1,113 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#include "cdboptions.h"
#include <QtCore/QSettings>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
static const char *settingsGroupC = "CDB";
static const char *enabledKeyC = "enabled";
static const char *pathKeyC = "path";
namespace Debugger {
namespace Internal {
CdbOptions::CdbOptions() :
enabled(false)
{
}
void CdbOptions::clear()
{
enabled = false;
path.clear();
}
void CdbOptions::fromSettings(const QSettings *s)
{
clear();
// Is this the first time we are called ->
// try to find automatically
const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/');
const QString enabledKey = keyRoot + QLatin1String(enabledKeyC);
const bool firstTime = !s->contains(enabledKey);
if (firstTime) {
enabled = autoDetectPath(&path);
return;
}
enabled = s->value(enabledKey, false).toBool();
path = s->value(keyRoot + QLatin1String(pathKeyC), QString()).toString();
}
void CdbOptions::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(enabledKeyC), enabled);
s->setValue(QLatin1String(pathKeyC), path);
s->endGroup();
}
bool CdbOptions::autoDetectPath(QString *outPath)
{
// Look for $ProgramFiles/"Debugging Tools For Windows" and its
// :" (x86)", " (x64)" variations
static const char *postFixes[] = { " (x86)", " (x64)" };
outPath->clear();
const QByteArray programDirB = qgetenv("ProgramFiles");
if (programDirB.isEmpty())
return false;
const QString programDir = QString::fromLocal8Bit(programDirB) + QDir::separator();
const QString installDir = QLatin1String("Debugging Tools For Windows");
QString path = programDir + installDir;
if (QFileInfo(path).isDir()) {
*outPath = QDir::toNativeSeparators(path);
return true;
}
const int rootLength = path.size();
for (int i = 0; i < sizeof(postFixes)/sizeof(const char*); i++) {
path.truncate(rootLength);
path += QLatin1String(postFixes[i]);
if (QFileInfo(path).isDir()) {
*outPath = QDir::toNativeSeparators(path);
return true;
}
}
return false;
}
bool CdbOptions::equals(const CdbOptions &rhs) const
{
return enabled == rhs.enabled && path == rhs.path;
}
} // namespace Internal
} // namespace Debugger

View File

@@ -0,0 +1,68 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#ifndef CDBSETTINGS_H
#define CDBSETTINGS_H
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
struct CdbOptions
{
public:
CdbOptions();
void clear();
void fromSettings(const QSettings *s);
void toSettings(QSettings *s) const;
bool equals(const CdbOptions &s) const;
// Locate the debugging tools
static bool autoDetectPath(QString *path);
bool enabled;
QString path;
};
inline bool operator==(const CdbOptions &s1, const CdbOptions &s2)
{ return s1.equals(s2); }
inline bool operator!=(const CdbOptions &s1, const CdbOptions &s2)
{ return !s1.equals(s2); }
} // namespace Internal
} // namespace Debugger
#endif // CDBSETTINGS_H

View File

@@ -0,0 +1,135 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#include "cdboptionspage.h"
#include "cdboptions.h"
#include "debuggerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
const char * const CDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::CdbOptionsPageWidget", "CDB");
namespace Debugger {
namespace Internal {
CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
m_ui.pathChooser->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui.pathChooser->addButton(tr("Autodetect"), this, SLOT(autoDetect()));
m_ui.failureLabel->setVisible(false);
}
void CdbOptionsPageWidget::setOptions(CdbOptions &o)
{
m_ui.pathChooser->setPath(o.path);
m_ui.cdbOptionsGroupBox->setChecked(o.enabled);
}
CdbOptions CdbOptionsPageWidget::options() const
{
CdbOptions rc;
rc.path = m_ui.pathChooser->path();
rc.enabled = m_ui.cdbOptionsGroupBox->isChecked();
return rc;
}
void CdbOptionsPageWidget::autoDetect()
{
QString path;
const bool ok = CdbOptions::autoDetectPath(&path);
m_ui.cdbOptionsGroupBox->setChecked(ok);
if (ok)
m_ui.pathChooser->setPath(path);
}
void CdbOptionsPageWidget::setFailureMessage(const QString &msg)
{
m_ui.failureLabel->setText(msg);
m_ui.failureLabel->setVisible(!msg.isEmpty());
}
// ---------- CdbOptionsPage
CdbOptionsPage::CdbOptionsPage(const QSharedPointer<CdbOptions> &options) :
m_options(options)
{
}
CdbOptionsPage::~CdbOptionsPage()
{
}
QString CdbOptionsPage::settingsId()
{
return QLatin1String(CDB_SETTINGS_ID);
}
QString CdbOptionsPage::trName() const
{
return tr(CDB_SETTINGS_ID);
}
QString CdbOptionsPage::category() const
{
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QString CdbOptionsPage::trCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QWidget *CdbOptionsPage::createPage(QWidget *parent)
{
m_widget = new CdbOptionsPageWidget(parent);
m_widget->setOptions(*m_options);
m_widget->setFailureMessage(m_failureMessage);
return m_widget;
}
void CdbOptionsPage::apply()
{
if (!m_widget)
return;
const CdbOptions newOptions = m_widget->options();
if (newOptions != *m_options) {
*m_options = newOptions;
m_options->toSettings(Core::ICore::instance()->settings());
}
}
void CdbOptionsPage::finish()
{
}
} // namespace Internal
} // namespace Debugger

View File

@@ -0,0 +1,95 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#ifndef CDBSETTINGSPAGE_H
#define CDBSETTINGSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include "ui_cdboptionspagewidget.h"
#include <QtGui/QWidget>
#include <QtCore/QPointer>
#include <QtCore/QSharedPointer>
namespace Debugger {
namespace Internal {
struct CdbOptions;
class CdbOptionsPageWidget : public QWidget
{
Q_OBJECT
public:
explicit CdbOptionsPageWidget(QWidget *parent);
void setOptions(CdbOptions &o);
CdbOptions options() const;
void setFailureMessage(const QString &);
private slots:
void autoDetect();
private:
Ui::CdbOptionsPageWidget m_ui;
};
class CdbOptionsPage : public Core::IOptionsPage
{
Q_DISABLE_COPY(CdbOptionsPage)
Q_OBJECT
public:
explicit CdbOptionsPage(const QSharedPointer<CdbOptions> &options);
virtual ~CdbOptionsPage();
// IOptionsPage
virtual QString id() const { return settingsId(); }
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
static QString settingsId();
// Load failure messages can be displayed here
void setFailureMessage(const QString &msg) { m_failureMessage = msg; }
private:
const QSharedPointer<CdbOptions> m_options;
QPointer<CdbOptionsPageWidget> m_widget;
QString m_failureMessage;
};
} // namespace Internal
} // namespace Debugger
#endif // CDBSETTINGSPAGE_H

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CdbOptionsPageWidget</class>
<widget class="QWidget" name="CdbOptionsPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>281</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="cdbOptionsGroupBox">
<property name="title">
<string>CDB</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Path to &quot;Debugging Tools for Windows&quot;:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>223</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="failureLabel">
<property name="styleSheet">
<string notr="true">background-color: 'red';</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CommonOptionsPage</class>
<widget class="QWidget" name="CommonOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>452</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>User interface</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxListSourceFiles">
<property name="toolTip">
<string>Checking this will populate the source file view automatically but might slow down debugger startup considerably.</string>
</property>
<property name="text">
<string>Populate source file view automatically</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it.</string>
</property>
<property name="text">
<string>Skip known frames when stepping</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTips">
<property name="toolTip">
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
</property>
<property name="text">
<string>Use tooltips while debugging</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="text">
<string>Maximal stack depth:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="specialValueText">
<string>&lt;unlimited&gt;</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -43,7 +43,8 @@ HEADERS += \
sourcefileswindow.h \ sourcefileswindow.h \
threadswindow.h \ threadswindow.h \
watchhandler.h \ watchhandler.h \
watchwindow.h watchwindow.h \
gdboptionspage.h
SOURCES += \ SOURCES += \
breakhandler.cpp \ breakhandler.cpp \
@@ -72,7 +73,8 @@ SOURCES += \
sourcefileswindow.cpp \ sourcefileswindow.cpp \
threadswindow.cpp \ threadswindow.cpp \
watchhandler.cpp \ watchhandler.cpp \
watchwindow.cpp watchwindow.cpp \
gdboptionspage.cpp
FORMS += attachexternaldialog.ui \ FORMS += attachexternaldialog.ui \
attachremotedialog.ui \ attachremotedialog.ui \
@@ -80,7 +82,8 @@ FORMS += attachexternaldialog.ui \
breakbyfunction.ui \ breakbyfunction.ui \
breakcondition.ui \ breakcondition.ui \
dumperoptionpage.ui \ dumperoptionpage.ui \
gdboptionpage.ui \ gdboptionspage.ui \
commonoptionspage.ui \
startexternaldialog.ui \ startexternaldialog.ui \
RESOURCES += debugger.qrc RESOURCES += debugger.qrc

View File

@@ -30,6 +30,8 @@
#ifndef DEBUGGERCONSTANTS_H #ifndef DEBUGGERCONSTANTS_H
#define DEBUGGERCONSTANTS_H #define DEBUGGERCONSTANTS_H
#include <QtCore/QtGlobal>
namespace Debugger { namespace Debugger {
namespace Constants { namespace Constants {
@@ -51,6 +53,8 @@ const char * const M_DEBUG_VIEWS = "Debugger.Menu.View.Debug";
const char * const C_GDBDEBUGGER = "Gdb Debugger"; const char * const C_GDBDEBUGGER = "Gdb Debugger";
const char * const GDBRUNNING = "Gdb.Running"; const char * const GDBRUNNING = "Gdb.Running";
const char * const DEBUGGER_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("Debugger", "Debugger");
namespace Internal { namespace Internal {
enum { debug = 0 }; enum { debug = 0 };
} }

View File

@@ -139,18 +139,21 @@ static IDebuggerEngine *gdbEngine = 0;
static IDebuggerEngine *winEngine = 0; static IDebuggerEngine *winEngine = 0;
static IDebuggerEngine *scriptEngine = 0; static IDebuggerEngine *scriptEngine = 0;
extern IDebuggerEngine *createGdbEngine(DebuggerManager *parent); // The creation functions take a list of options pages they can add to.
extern IDebuggerEngine *createWinEngine(DebuggerManager *) // This allows for having a "enabled" toggle on the page indepently
// of the engine.
extern IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
extern IDebuggerEngine *createWinEngine(DebuggerManager *, bool /* cmdLineDisabled */, QList<Core::IOptionsPage*> *)
#ifdef CDB_ENABLED #ifdef CDB_ENABLED
; ;
#else #else
{ return 0; } { return 0; }
#endif #endif
extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent); extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
DebuggerManager::DebuggerManager(const QStringList &arguments) DebuggerManager::DebuggerManager()
{ {
init(arguments); init();
} }
DebuggerManager::~DebuggerManager() DebuggerManager::~DebuggerManager()
@@ -160,7 +163,7 @@ DebuggerManager::~DebuggerManager()
delete scriptEngine; delete scriptEngine;
} }
void DebuggerManager::init(const QStringList &arguments) void DebuggerManager::init()
{ {
m_status = -1; m_status = -1;
m_busy = false; m_busy = false;
@@ -426,13 +429,19 @@ void DebuggerManager::init(const QStringList &arguments)
m_threadsDock = createDockForWidget(m_threadsWindow); m_threadsDock = createDockForWidget(m_threadsWindow);
setStatus(DebuggerProcessNotReady); setStatus(DebuggerProcessNotReady);
gdbEngine = createGdbEngine(this); }
if (arguments.contains(QLatin1String("-enable-cdb")))
winEngine = createWinEngine(this); QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(const QStringList &arguments)
scriptEngine = createScriptEngine(this); {
QList<Core::IOptionsPage*> rc;
gdbEngine = createGdbEngine(this, &rc);
const bool cdbDisabled = arguments.contains(QLatin1String("-disable-cdb"));
winEngine = createWinEngine(this, cdbDisabled, &rc);
scriptEngine = createScriptEngine(this, &rc);
setDebuggerType(GdbDebugger); setDebuggerType(GdbDebugger);
if (Debugger::Constants::Internal::debug) if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine; qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine << rc.size();
return rc;
} }
void DebuggerManager::setDebuggerType(DebuggerType type) void DebuggerManager::setDebuggerType(DebuggerType type)

View File

@@ -48,6 +48,10 @@ class QTimer;
class QWidget; class QWidget;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core {
class IOptionsPage;
}
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -178,7 +182,9 @@ class DebuggerManager : public QObject,
Q_OBJECT Q_OBJECT
public: public:
DebuggerManager(const QStringList &arguments); DebuggerManager();
QList<Core::IOptionsPage*> initializeEngines(const QStringList &arguments);
~DebuggerManager(); ~DebuggerManager();
IDebuggerManagerAccessForEngines *engineInterface(); IDebuggerManagerAccessForEngines *engineInterface();
@@ -341,7 +347,7 @@ public:
bool m_useTerminal; bool m_useTerminal;
private: private:
void init(const QStringList &arguments); void init();
void setDebuggerType(DebuggerType type); void setDebuggerType(DebuggerType type);
void runTest(const QString &fileName); void runTest(const QString &fileName);
QDockWidget *createDockForWidget(QWidget *widget); QDockWidget *createDockForWidget(QWidget *widget);

View File

@@ -35,7 +35,7 @@
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "gdbengine.h" #include "gdbengine.h"
#include "ui_gdboptionpage.h" #include "ui_commonoptionspage.h"
#include "ui_dumperoptionpage.h" #include "ui_dumperoptionpage.h"
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -75,6 +75,7 @@
#include <QtCore/QPoint> #include <QtCore/QPoint>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#include <QtCore/QCoreApplication>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QDockWidget> #include <QtGui/QDockWidget>
@@ -230,62 +231,40 @@ QIcon LocationMark::icon() const
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// GdbOptionPage // CommonOptionsPage
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class GdbOptionPage : public Core::IOptionsPage class CommonOptionsPage : public Core::IOptionsPage
{ {
Q_OBJECT Q_OBJECT
public: public:
GdbOptionPage() {} CommonOptionsPage() {}
// IOptionsPage // IOptionsPage
QString id() const { return QLatin1String("General"); } QString id() const { return QLatin1String("Common"); }
QString trName() const { return tr("General"); } QString trName() const { return tr("Common"); }
QString category() const { return QLatin1String("Debugger"); } QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QString trCategory() const { return tr("Debugger"); } QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QWidget *createPage(QWidget *parent); QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(ICore::instance()->settings()); } void apply() { m_group.apply(ICore::instance()->settings()); }
void finish() { m_group.finish(); } void finish() { m_group.finish(); }
private: private:
friend class DebuggerPlugin; Ui::CommonOptionsPage m_ui;
Ui::GdbOptionPage m_ui;
Core::Utils::SavedActionSet m_group; Core::Utils::SavedActionSet m_group;
}; };
QWidget *GdbOptionPage::createPage(QWidget *parent) QWidget *CommonOptionsPage::createPage(QWidget *parent)
{ {
QWidget *w = new QWidget(parent); QWidget *w = new QWidget(parent);
m_ui.setupUi(w); m_ui.setupUi(w);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_group.clear(); m_group.clear();
m_group.insert(theDebuggerAction(GdbLocation),
m_ui.gdbLocationChooser);
m_group.insert(theDebuggerAction(GdbScriptFile),
m_ui.scriptFileChooser);
m_group.insert(theDebuggerAction(GdbEnvironment),
m_ui.environmentEdit);
m_group.insert(theDebuggerAction(AllPluginBreakpoints),
m_ui.radioButtonAllPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpoints),
m_ui.radioButtonSelectedPluginBreakpoints);
m_group.insert(theDebuggerAction(NoPluginBreakpoints),
m_ui.radioButtonNoPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpointsPattern),
m_ui.lineEditSelectedPluginBreakpointsPattern);
m_group.insert(theDebuggerAction(ListSourceFiles), m_group.insert(theDebuggerAction(ListSourceFiles),
m_ui.checkBoxListSourceFiles); m_ui.checkBoxListSourceFiles);
@@ -296,18 +275,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(MaximalStackDepth), m_group.insert(theDebuggerAction(MaximalStackDepth),
m_ui.spinBoxMaximalStackDepth); m_ui.spinBoxMaximalStackDepth);
m_ui.lineEditSelectedPluginBreakpointsPattern->
setEnabled(theDebuggerAction(SelectedPluginBreakpoints)->value().toBool());
connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
// FIXME
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
//m_dumpLogAction = new QAction(this);
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
return w; return w;
} }
@@ -334,8 +301,8 @@ public:
// IOptionsPage // IOptionsPage
QString id() const { return QLatin1String("DebuggingHelper"); } QString id() const { return QLatin1String("DebuggingHelper"); }
QString trName() const { return tr("Debugging Helper"); } QString trName() const { return tr("Debugging Helper"); }
QString category() const { return QLatin1String("Debugger"); } QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QString trCategory() const { return tr("Debugger"); } QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QWidget *createPage(QWidget *parent); QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(ICore::instance()->settings()); } void apply() { m_group.apply(ICore::instance()->settings()); }
@@ -404,20 +371,21 @@ void DebuggingHelperOptionPage::updateState()
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// DebuggerPlugin // DebuggerPlugin
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
DebuggerPlugin::DebuggerPlugin() DebuggerPlugin::DebuggerPlugin() :
m_manager(0),
m_debugMode(0),
m_locationMark(0),
m_gdbRunningContext(0),
m_breakpointMarginAction(0),
m_toggleLockedAction(0),
m_breakpointMarginActionLineNumber(0)
{ {
m_generalOptionPage = 0;
m_dumperOptionPage = 0;
m_locationMark = 0;
m_manager = 0;
m_debugMode = 0;
} }
DebuggerPlugin::~DebuggerPlugin() DebuggerPlugin::~DebuggerPlugin()
@@ -440,20 +408,12 @@ void DebuggerPlugin::shutdown()
//qDebug() << "DebuggerPlugin::~DebuggerPlugin"; //qDebug() << "DebuggerPlugin::~DebuggerPlugin";
removeObject(m_debugMode); removeObject(m_debugMode);
removeObject(m_generalOptionPage);
removeObject(m_dumperOptionPage);
// FIXME: when using the line below, BreakWindow etc gets deleted twice. // FIXME: when using the line below, BreakWindow etc gets deleted twice.
// so better leak for now... // so better leak for now...
delete m_debugMode; delete m_debugMode;
m_debugMode = 0; m_debugMode = 0;
delete m_generalOptionPage;
m_generalOptionPage = 0;
delete m_dumperOptionPage;
m_dumperOptionPage = 0;
delete m_locationMark; delete m_locationMark;
m_locationMark = 0; m_locationMark = 0;
@@ -466,7 +426,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
Q_UNUSED(arguments); Q_UNUSED(arguments);
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
m_manager = new DebuggerManager(arguments); m_manager = new DebuggerManager;
const QList<Core::IOptionsPage *> engineOptionPages = m_manager->initializeEngines(arguments);
ICore *core = ICore::instance(); ICore *core = ICore::instance();
QTC_ASSERT(core, return false); QTC_ASSERT(core, return false);
@@ -660,10 +621,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
m_manager, SLOT(reloadRegisters())); m_manager, SLOT(reloadRegisters()));
// FIXME: // FIXME:
m_generalOptionPage = new GdbOptionPage; addAutoReleasedObject(new CommonOptionsPage);
addObject(m_generalOptionPage); addAutoReleasedObject(new DebuggingHelperOptionPage);
m_dumperOptionPage = new DebuggingHelperOptionPage; foreach (Core::IOptionsPage* op, engineOptionPages)
addObject(m_dumperOptionPage); addAutoReleasedObject(op);
m_locationMark = 0; m_locationMark = 0;

View File

@@ -56,8 +56,6 @@ namespace Internal {
class DebuggerManager; class DebuggerManager;
class DebugMode; class DebugMode;
class GdbOptionPage;
class DebuggingHelperOptionPage;
class LocationMark; class LocationMark;
class DebuggerPlugin : public ExtensionSystem::IPlugin class DebuggerPlugin : public ExtensionSystem::IPlugin
@@ -108,9 +106,6 @@ private:
DebuggerManager *m_manager; DebuggerManager *m_manager;
DebugMode *m_debugMode; DebugMode *m_debugMode;
GdbOptionPage *m_generalOptionPage;
DebuggingHelperOptionPage *m_dumperOptionPage;
QString m_previousMode; QString m_previousMode;
LocationMark *m_locationMark; LocationMark *m_locationMark;
int m_gdbRunningContext; int m_gdbRunningContext;

View File

@@ -28,6 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "gdbengine.h" #include "gdbengine.h"
#include "gdboptionspage.h"
#include "watchutils.h" #include "watchutils.h"
#include "debuggeractions.h" #include "debuggeractions.h"
@@ -4197,7 +4198,8 @@ void GdbEngine::recheckDebuggingHelperAvailability()
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper); sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper);
} }
IDebuggerEngine *createGdbEngine(DebuggerManager *parent) IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *opts)
{ {
opts->push_back(new GdbOptionsPage);
return new GdbEngine(parent); return new GdbEngine(parent);
} }

View File

@@ -0,0 +1,85 @@
#include "gdboptionspage.h"
#include "debuggeractions.h"
#include "debuggerconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
const char * const GDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::GdbOptionsPage", "Gdb");
namespace Debugger {
namespace Internal {
GdbOptionsPage::GdbOptionsPage()
{
}
QString GdbOptionsPage::settingsId()
{
return QLatin1String(GDB_SETTINGS_ID);
}
QString GdbOptionsPage::trName() const
{
return tr(GDB_SETTINGS_ID);
}
QString GdbOptionsPage::category() const
{
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QString GdbOptionsPage::trCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}
QWidget *GdbOptionsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
m_group.clear();
m_group.insert(theDebuggerAction(GdbLocation),
m_ui.gdbLocationChooser);
m_group.insert(theDebuggerAction(GdbScriptFile),
m_ui.scriptFileChooser);
m_group.insert(theDebuggerAction(GdbEnvironment),
m_ui.environmentEdit);
m_group.insert(theDebuggerAction(AllPluginBreakpoints),
m_ui.radioButtonAllPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpoints),
m_ui.radioButtonSelectedPluginBreakpoints);
m_group.insert(theDebuggerAction(NoPluginBreakpoints),
m_ui.radioButtonNoPluginBreakpoints);
m_group.insert(theDebuggerAction(SelectedPluginBreakpointsPattern),
m_ui.lineEditSelectedPluginBreakpointsPattern);
m_ui.lineEditSelectedPluginBreakpointsPattern->
setEnabled(theDebuggerAction(SelectedPluginBreakpoints)->value().toBool());
connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
// FIXME
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
return w;
}
void GdbOptionsPage::apply()
{
m_group.apply(Core::ICore::instance()->settings());
}
void GdbOptionsPage::finish()
{
m_group.finish();
}
} // namespace Internal
} // namespace Debugger

View File

@@ -0,0 +1,37 @@
#ifndef GDBOPTIONSPAGE_H
#define GDBOPTIONSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/savedaction.h>
#include "ui_gdboptionspage.h"
namespace Debugger {
namespace Internal {
class GdbOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GdbOptionsPage();
virtual QString id() const { return settingsId(); }
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
static QString settingsId();
private:
Ui::GdbOptionsPage m_ui;
Core::Utils::SavedActionSet m_group;
};
} // namespace Internal
} // namespace Debugger
#endif // GDBOPTIONSPAGE_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>GdbOptionPage</class> <class>GdbOptionsPage</class>
<widget class="QWidget" name="GdbOptionPage"> <widget class="QWidget" name="GdbOptionsPage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -13,7 +13,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBoxLocations"> <widget class="QGroupBox" name="groupBoxLocations">
<property name="title"> <property name="title">
@@ -131,82 +131,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>User interface</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxListSourceFiles">
<property name="toolTip">
<string>Checking this will populate the source file view automatically but might slow down debugger startup considerably.</string>
</property>
<property name="text">
<string>Populate source file view automatically</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it.</string>
</property>
<property name="text">
<string>Skip known frames when stepping</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTips">
<property name="toolTip">
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
</property>
<property name="text">
<string>Use tooltips while debugging</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="text">
<string>Maximal stack depth:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="specialValueText">
<string>&lt;unlimited&gt;</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@@ -740,7 +740,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
QTC_ASSERT(false, return); QTC_ASSERT(false, return);
} }
IDebuggerEngine *createScriptEngine(DebuggerManager *parent) IDebuggerEngine *createScriptEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *)
{ {
return new ScriptEngine(parent); return new ScriptEngine(parent);
} }