forked from qt-creator/qt-creator
debugger: reorganizing settings and actions in progress
This commit is contained in:
@@ -105,6 +105,7 @@ PathChooser::PathChooser(QWidget *parent) :
|
||||
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(validChanged()), this, SIGNAL(validChanged()));
|
||||
connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
|
||||
|
||||
m_d->m_lineEdit->setMinimumWidth(200);
|
||||
hLayout->addWidget(m_d->m_lineEdit);
|
||||
|
||||
@@ -89,6 +89,7 @@ private:
|
||||
signals:
|
||||
void validChanged();
|
||||
void changed();
|
||||
void editingFinished();
|
||||
void beforeBrowsing();
|
||||
void browsingFinished();
|
||||
void returnPressed();
|
||||
|
||||
@@ -94,7 +94,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
QAction *act3 = new QAction("Edit condition...", &menu);
|
||||
act0->setEnabled(index.isValid());
|
||||
QAction *act4 = new QAction("Syncronize breakpoints", &menu);
|
||||
QAction *act5 = action(SettingsDialog);
|
||||
|
||||
menu.addAction(act0);
|
||||
menu.addAction(act3);
|
||||
@@ -102,7 +101,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
menu.addAction(act1);
|
||||
menu.addAction(act2);
|
||||
menu.addAction(act4);
|
||||
menu.addAction(act5);
|
||||
menu.addAction(theDebuggerSettings()->action(SettingsDialog));
|
||||
|
||||
QAction *act = menu.exec(ev->globalPos());
|
||||
|
||||
@@ -116,8 +115,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
editCondition(index);
|
||||
else if (act == act4)
|
||||
emit breakpointSynchronizationRequested();
|
||||
else if (act == act5)
|
||||
act->trigger();
|
||||
}
|
||||
|
||||
void BreakWindow::deleteBreakpoint(const QModelIndex &idx)
|
||||
|
||||
@@ -29,12 +29,315 @@
|
||||
|
||||
#include "debuggeractions.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QAbstractButton>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QLineEdit>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QtcSettingsItem
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QtcSettingsItem::QtcSettingsItem(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_action = new QAction(this);
|
||||
connect(m_action, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)));
|
||||
}
|
||||
|
||||
QVariant QtcSettingsItem::value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setValue(const QVariant &value, bool doemit)
|
||||
{
|
||||
if (value != m_value) {
|
||||
m_value = value;
|
||||
if (m_action->isCheckable())
|
||||
m_action->setChecked(m_value.toBool());
|
||||
if (doemit) {
|
||||
emit valueChanged(m_value);
|
||||
emit boolValueChanged(m_value.toBool());
|
||||
emit stringValueChanged(m_value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant QtcSettingsItem::defaultValue() const
|
||||
{
|
||||
return m_defaultValue;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setDefaultValue(const QVariant &value)
|
||||
{
|
||||
m_defaultValue = value;
|
||||
}
|
||||
|
||||
QString QtcSettingsItem::settingsKey() const
|
||||
{
|
||||
return m_settingsKey;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setSettingsKey(const QString &key)
|
||||
{
|
||||
m_settingsKey = key;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setSettingsKey(const QString &group, const QString &key)
|
||||
{
|
||||
m_settingsKey = key;
|
||||
m_settingsGroup = group;
|
||||
}
|
||||
|
||||
QString QtcSettingsItem::settingsGroup() const
|
||||
{
|
||||
return m_settingsGroup;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setSettingsGroup(const QString &group)
|
||||
{
|
||||
m_settingsGroup = group;
|
||||
}
|
||||
|
||||
QString QtcSettingsItem::text() const
|
||||
{
|
||||
return m_action->text();
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setText(const QString &value)
|
||||
{
|
||||
if (!value.isEmpty() && !m_textPattern.isEmpty())
|
||||
m_action->setText(m_textPattern.arg(value));
|
||||
else
|
||||
m_action->setText(value);
|
||||
}
|
||||
|
||||
QString QtcSettingsItem::textPattern() const
|
||||
{
|
||||
return m_textPattern;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::setTextPattern(const QString &value)
|
||||
{
|
||||
m_textPattern = value;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::readSettings(QSettings *settings)
|
||||
{
|
||||
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
|
||||
return;
|
||||
settings->beginGroup(m_settingsGroup);
|
||||
setValue(settings->value(m_settingsKey, m_defaultValue), false);
|
||||
qDebug() << "READING: " << m_settingsKey << " -> " << m_value;
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void QtcSettingsItem::writeSettings(QSettings *settings)
|
||||
{
|
||||
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
|
||||
return;
|
||||
settings->beginGroup(m_settingsGroup);
|
||||
settings->setValue(m_settingsKey, m_value);
|
||||
qDebug() << "WRITING: " << m_settingsKey << " -> " << m_value;
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
QAction *QtcSettingsItem::action() const
|
||||
{
|
||||
return m_action;
|
||||
}
|
||||
|
||||
void QtcSettingsItem::connectWidget(QWidget *widget, ApplyMode applyMode)
|
||||
{
|
||||
using namespace Core::Utils;
|
||||
//qDebug() << "CONNECT WIDGET " << widget << " TO " << m_settingsKey;
|
||||
m_applyModes[widget] = applyMode;
|
||||
m_deferedValue = m_value;
|
||||
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) {
|
||||
if (button->isCheckable()) {
|
||||
button->setChecked(m_value.toBool());
|
||||
connect(button, SIGNAL(clicked(bool)),
|
||||
this, SLOT(checkableButtonClicked(bool)));
|
||||
} else {
|
||||
connect(button, SIGNAL(clicked()),
|
||||
this, SLOT(uncheckableButtonClicked()));
|
||||
}
|
||||
} else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) {
|
||||
lineEdit->setText(m_value.toString());
|
||||
//qDebug() << "SETTING TEXT" << lineEdit->text();
|
||||
connect(lineEdit, SIGNAL(editingFinished()),
|
||||
this, SLOT(lineEditEditingFinished()));
|
||||
} else if (PathChooser *pathChooser = qobject_cast<PathChooser *>(widget)) {
|
||||
pathChooser->setPath(m_value.toString());
|
||||
connect(pathChooser, SIGNAL(editingFinished()),
|
||||
this, SLOT(pathChooserEditingFinished()));
|
||||
connect(pathChooser, SIGNAL(browsingFinished()),
|
||||
this, SLOT(pathChooserEditingFinished()));
|
||||
} else {
|
||||
qDebug() << "CANNOT CONNECT WIDGET " << widget;
|
||||
}
|
||||
}
|
||||
|
||||
void QtcSettingsItem::applyDeferedChange()
|
||||
{
|
||||
setValue(m_deferedValue);
|
||||
}
|
||||
|
||||
void QtcSettingsItem::uncheckableButtonClicked()
|
||||
{
|
||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
||||
QTC_ASSERT(button, return);
|
||||
qDebug() << "UNCHECKABLE BUTTON: " << sender();
|
||||
m_action->trigger();
|
||||
}
|
||||
|
||||
void QtcSettingsItem::checkableButtonClicked(bool)
|
||||
{
|
||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
||||
QTC_ASSERT(button, return);
|
||||
qDebug() << "CHECKABLE BUTTON: " << sender();
|
||||
if (m_applyModes[sender()] == DeferedApply)
|
||||
m_deferedValue = button->isChecked();
|
||||
else
|
||||
setValue(button->isChecked());
|
||||
}
|
||||
|
||||
void QtcSettingsItem::lineEditEditingFinished()
|
||||
{
|
||||
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender());
|
||||
QTC_ASSERT(lineEdit, return);
|
||||
qDebug() << "LINEEDIT: " << sender() << lineEdit->text();
|
||||
if (m_applyModes[sender()] == DeferedApply)
|
||||
m_deferedValue = lineEdit->text();
|
||||
else
|
||||
setValue(lineEdit->text());
|
||||
}
|
||||
|
||||
void QtcSettingsItem::pathChooserEditingFinished()
|
||||
{
|
||||
using namespace Core::Utils;
|
||||
PathChooser *pathChooser = qobject_cast<PathChooser *>(sender());
|
||||
QTC_ASSERT(pathChooser, return);
|
||||
qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path();
|
||||
if (m_applyModes[sender()] == DeferedApply)
|
||||
m_deferedValue = pathChooser->path();
|
||||
else
|
||||
setValue(pathChooser->path());
|
||||
}
|
||||
|
||||
void QtcSettingsItem::actionTriggered(bool on)
|
||||
{
|
||||
Q_UNUSED(on);
|
||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
if (action->isCheckable())
|
||||
setValue(action->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QtcSettings
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QtcSettings::QtcSettings(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
QtcSettings::~QtcSettings()
|
||||
{
|
||||
qDeleteAll(m_items);
|
||||
}
|
||||
|
||||
QtcSettingsItem *QtcSettings::createItem(int code)
|
||||
{
|
||||
return m_items[code] = new QtcSettingsItem;
|
||||
}
|
||||
|
||||
void QtcSettings::insertItem(int code, QtcSettingsItem *item)
|
||||
{
|
||||
m_items[code] = item;
|
||||
}
|
||||
|
||||
void QtcSettings::readSettings(QSettings *settings)
|
||||
{
|
||||
foreach (QtcSettingsItem *item, m_items)
|
||||
item->readSettings(settings);
|
||||
}
|
||||
|
||||
void QtcSettings::writeSettings(QSettings *settings)
|
||||
{
|
||||
foreach (QtcSettingsItem *item, m_items)
|
||||
item->writeSettings(settings);
|
||||
}
|
||||
|
||||
QtcSettingsItem *QtcSettings::item(int code)
|
||||
{
|
||||
QTC_ASSERT(m_items.value(code, 0), return 0);
|
||||
return m_items.value(code, 0);
|
||||
}
|
||||
|
||||
bool QtcSettings::boolValue(int code)
|
||||
{
|
||||
return item(code)->value().toBool();
|
||||
}
|
||||
|
||||
QString QtcSettings::stringValue(int code)
|
||||
{
|
||||
return item(code)->value().toString();
|
||||
}
|
||||
|
||||
int QtcSettings::intValue(int code)
|
||||
{
|
||||
return item(code)->value().toInt();
|
||||
}
|
||||
|
||||
QAction *QtcSettings::action(int code)
|
||||
{
|
||||
return item(code)->action();
|
||||
}
|
||||
|
||||
void QtcSettings::applyDeferedChanges()
|
||||
{
|
||||
foreach (QtcSettingsItem *item, m_items)
|
||||
item->applyDeferedChange();
|
||||
}
|
||||
|
||||
void QtcSettings::applyDeferedChange(int code)
|
||||
{
|
||||
return item(code)->applyDeferedChange();
|
||||
}
|
||||
|
||||
void QtcSettings::connectWidget(int code, QWidget *widget, ApplyMode applyMode)
|
||||
{
|
||||
item(code)->connectWidget(widget, applyMode);
|
||||
}
|
||||
|
||||
QString QtcSettings::dump()
|
||||
{
|
||||
QString out;
|
||||
QTextStream ts(&out);
|
||||
ts << "Debugger settings: ";
|
||||
foreach (QtcSettingsItem *item, m_items)
|
||||
ts << "\n" << item->value().toString();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -42,60 +345,135 @@ namespace Internal {
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct ActionData
|
||||
{
|
||||
ActionCode code;
|
||||
const char *text;
|
||||
bool checkable;
|
||||
};
|
||||
#if 0
|
||||
QString dump();
|
||||
|
||||
static ActionData data[] =
|
||||
{
|
||||
//
|
||||
// General
|
||||
//
|
||||
{ AdjustColumnWidths,
|
||||
QT_TR_NOOP("Adjust column widths to contents"), false },
|
||||
{ AlwaysAdjustColumnWidths,
|
||||
QT_TR_NOOP("Adjust column widths to contents"), true },
|
||||
QString m_gdbCmd;
|
||||
QString m_gdbEnv;
|
||||
bool m_autoRun;
|
||||
bool m_autoQuit;
|
||||
|
||||
//
|
||||
// Locals & Watchers
|
||||
//
|
||||
{ WatchExpression,
|
||||
QT_TR_NOOP("Watch expression '%1'"), false },
|
||||
{ WatchExpression,
|
||||
QT_TR_NOOP("Watch expression '%1'"), false },
|
||||
{ SettingsDialog,
|
||||
QT_TR_NOOP("Debugger properties..."), false },
|
||||
{ UseDumpers,
|
||||
QT_TR_NOOP("Use custom dumpers"), true },
|
||||
{ DebugDumpers,
|
||||
QT_TR_NOOP("Debug custom dumpers"), true },
|
||||
{ RecheckDumpers,
|
||||
QT_TR_NOOP("Recheck custom dumper availability"), true },
|
||||
bool m_useDumpers;
|
||||
bool m_skipKnownFrames;
|
||||
bool m_debugDumpers;
|
||||
bool m_useToolTips;
|
||||
bool m_listSourceFiles;
|
||||
|
||||
QString m_scriptFile;
|
||||
|
||||
bool m_pluginAllBreakpoints;
|
||||
bool m_pluginSelectedBreakpoints;
|
||||
bool m_pluginNoBreakpoints;
|
||||
QString m_pluginSelectedBreakpointsPattern;
|
||||
#endif
|
||||
|
||||
|
||||
QtcSettings *theDebuggerSettings()
|
||||
{
|
||||
static QtcSettings *instance = 0;
|
||||
if (instance)
|
||||
return instance;
|
||||
|
||||
instance = new QtcSettings;
|
||||
|
||||
QtcSettingsItem *item = 0;
|
||||
|
||||
item = instance->createItem(AdjustColumnWidths);
|
||||
item->setText(QObject::tr("Adjust column widths to contents"));
|
||||
|
||||
item = instance->createItem(AlwaysAdjustColumnWidths);
|
||||
item->setText(QObject::tr("Always adjust column widths to contents"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
item = instance->createItem(WatchExpression);
|
||||
item->setTextPattern(QObject::tr("Watch expression \"%1\""));
|
||||
|
||||
item = instance->createItem(RemoveWatchExpression);
|
||||
item->setTextPattern(QObject::tr("Remove watch expression \"%1\""));
|
||||
|
||||
item = instance->createItem(SettingsDialog);
|
||||
item->setText(QObject::tr("Debugger properties..."));
|
||||
|
||||
item = instance->createItem(DebugDumpers);
|
||||
item->setText(QObject::tr("Debug custom dumpers"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
item = instance->createItem(RecheckDumpers);
|
||||
item->setText(QObject::tr("Recheck custom dumper availability"));
|
||||
|
||||
//
|
||||
// Breakpoints
|
||||
//
|
||||
{ SynchronizeBreakpoints,
|
||||
QT_TR_NOOP("Syncronize breakpoints"), false },
|
||||
};
|
||||
item = instance->createItem(SynchronizeBreakpoints);
|
||||
item->setText(QObject::tr("Syncronize breakpoints"));
|
||||
|
||||
QAction *action(ActionCode code)
|
||||
{
|
||||
static QHash<ActionCode, QAction *> actions;
|
||||
//
|
||||
item = instance->createItem(AutoQuit);
|
||||
item->setText(QObject::tr("Automatically quit debugger"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
if (actions.isEmpty()) {
|
||||
for (int i = 0; i != sizeof(data)/sizeof(data[0]); ++i) {
|
||||
const ActionData &d = data[i];
|
||||
QAction *act = new QAction(QObject::tr(d.text), 0);
|
||||
act->setCheckable(d.checkable);
|
||||
actions[d.code] = act;
|
||||
}
|
||||
}
|
||||
item = instance->createItem(SkipKnownFrames);
|
||||
item->setText(QObject::tr("Skip known frames"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
return actions.value(code);
|
||||
item = instance->createItem(UseToolTips);
|
||||
item->setText(QObject::tr("Use tooltips when debugging"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
item = instance->createItem(ListSourceFiles);
|
||||
item->setText(QObject::tr("List source files"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
|
||||
//
|
||||
// Settings
|
||||
//
|
||||
item = instance->createItem(GdbLocation);
|
||||
item->setSettingsKey("DebugMode", "Location");
|
||||
|
||||
item = instance->createItem(GdbEnvironment);
|
||||
item->setSettingsKey("DebugMode", "Environment");
|
||||
|
||||
item = instance->createItem(GdbScriptFile);
|
||||
item->setSettingsKey("DebugMode", "ScriptFile");
|
||||
|
||||
item = instance->createItem(GdbAutoQuit);
|
||||
item->setSettingsKey("DebugMode", "AutoQuit");
|
||||
|
||||
item = instance->createItem(GdbAutoRun);
|
||||
item->setSettingsKey("DebugMode", "AutoRun");
|
||||
|
||||
item = instance->createItem(UseToolTips);
|
||||
item->setSettingsKey("DebugMode", "UseToolTips");
|
||||
|
||||
item = instance->createItem(UseDumpers);
|
||||
item->setSettingsKey("DebugMode", "UseCustomDumpers");
|
||||
item->setText(QObject::tr("Use custom dumpers"));
|
||||
item->action()->setCheckable(true);
|
||||
|
||||
|
||||
item = instance->createItem(ListSourceFiles);
|
||||
item->setSettingsKey("DebugMode", "ListSourceFiles");
|
||||
|
||||
item = instance->createItem(SkipKnownFrames);
|
||||
item->setSettingsKey("DebugMode", "SkipKnownFrames");
|
||||
|
||||
item = instance->createItem(DebugDumpers);
|
||||
item->setSettingsKey("DebugMode", "DebugDumpers");
|
||||
|
||||
item = instance->createItem(AllPluginBreakpoints);
|
||||
item->setSettingsKey("DebugMode", "AllPluginBreakpoints");
|
||||
|
||||
item = instance->createItem(SelectedPluginBreakpoints);
|
||||
item->setSettingsKey("DebugMode", "SelectedPluginBreakpoints");
|
||||
|
||||
item = instance->createItem(NoPluginBreakpoints);
|
||||
item->setSettingsKey("DebugMode", "NoPluginBreakpoints");
|
||||
|
||||
item = instance->createItem(SelectedPluginBreakpointsPattern);
|
||||
item->setSettingsKey("DebugMode", "SelectedPluginBreakpointsPattern");
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -30,12 +30,114 @@
|
||||
#ifndef DEBUGGER_ACTIONS_H
|
||||
#define DEBUGGER_ACTIONS_H
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
enum ActionCode
|
||||
enum ApplyMode { ImmediateApply, DeferedApply };
|
||||
|
||||
class QtcSettingsItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtcSettingsItem(QObject *parent = 0);
|
||||
|
||||
virtual QVariant value() const;
|
||||
Q_SLOT virtual void setValue(const QVariant &value, bool doemit = true);
|
||||
|
||||
virtual QVariant defaultValue() const;
|
||||
Q_SLOT virtual void setDefaultValue(const QVariant &value);
|
||||
|
||||
virtual QAction *action() const;
|
||||
|
||||
// used for persistency
|
||||
virtual QString settingsKey() const;
|
||||
Q_SLOT virtual void setSettingsKey(const QString &key);
|
||||
Q_SLOT virtual void setSettingsKey(const QString &group, const QString &key);
|
||||
|
||||
virtual QString settingsGroup() const;
|
||||
Q_SLOT virtual void setSettingsGroup(const QString &group);
|
||||
|
||||
virtual void readSettings(QSettings *settings);
|
||||
Q_SLOT virtual void writeSettings(QSettings *settings);
|
||||
|
||||
virtual void connectWidget(QWidget *widget, ApplyMode applyMode = DeferedApply);
|
||||
Q_SLOT virtual void applyDeferedChange();
|
||||
|
||||
virtual QString text() const;
|
||||
Q_SLOT virtual void setText(const QString &value);
|
||||
|
||||
virtual QString textPattern() const;
|
||||
Q_SLOT virtual void setTextPattern(const QString &value);
|
||||
|
||||
signals:
|
||||
void valueChanged(const QVariant &newValue);
|
||||
void boolValueChanged(bool newValue);
|
||||
void stringValueChanged(const QString &newValue);
|
||||
|
||||
private:
|
||||
Q_SLOT void uncheckableButtonClicked();
|
||||
Q_SLOT void checkableButtonClicked(bool);
|
||||
Q_SLOT void lineEditEditingFinished();
|
||||
Q_SLOT void pathChooserEditingFinished();
|
||||
Q_SLOT void actionTriggered(bool);
|
||||
|
||||
QVariant m_value;
|
||||
QVariant m_defaultValue;
|
||||
QVariant m_deferedValue; // basically a temporary copy of m_value
|
||||
QString m_settingsKey;
|
||||
QString m_settingsGroup;
|
||||
QString m_textPattern;
|
||||
QAction *m_action;
|
||||
QHash<QObject *, ApplyMode> m_applyModes;
|
||||
};
|
||||
|
||||
class QtcSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtcSettings(QObject *parent = 0);
|
||||
~QtcSettings();
|
||||
|
||||
void insertItem(int code, QtcSettingsItem *item);
|
||||
|
||||
QAction *action(int code);
|
||||
QtcSettingsItem *item(int code);
|
||||
QtcSettingsItem *createItem(int code);
|
||||
|
||||
// Convienience
|
||||
bool boolValue(int code);
|
||||
int intValue(int code);
|
||||
QString stringValue(int code);
|
||||
virtual QString dump();
|
||||
|
||||
void connectWidget(int code, QWidget *, ApplyMode applyMode = DeferedApply);
|
||||
void applyDeferedChange(int code);
|
||||
void applyDeferedChanges();
|
||||
|
||||
public slots:
|
||||
void readSettings(QSettings *settings);
|
||||
void writeSettings(QSettings *settings);
|
||||
|
||||
private:
|
||||
QHash<int, QtcSettingsItem *> m_items;
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
enum DebuggerSettingsCode
|
||||
{
|
||||
// General
|
||||
SettingsDialog,
|
||||
@@ -64,7 +166,7 @@ enum ActionCode
|
||||
ListSourceFiles,
|
||||
|
||||
// Running
|
||||
SkipKnowFrames,
|
||||
SkipKnownFrames,
|
||||
|
||||
// Breakpoints
|
||||
SynchronizeBreakpoints,
|
||||
@@ -72,10 +174,12 @@ enum ActionCode
|
||||
SelectedPluginBreakpoints,
|
||||
NoPluginBreakpoints,
|
||||
SelectedPluginBreakpointsPattern,
|
||||
|
||||
AutoQuit,
|
||||
};
|
||||
|
||||
QAction *action(ActionCode code);
|
||||
|
||||
// singleton access
|
||||
QtcSettings *theDebuggerSettings();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -88,40 +88,6 @@ using namespace Debugger::Constants;
|
||||
static const QString tooltipIName = "tooltip";
|
||||
|
||||
|
||||
DebuggerSettings::DebuggerSettings()
|
||||
{
|
||||
m_autoRun = false;
|
||||
m_autoQuit = false;
|
||||
m_skipKnownFrames = false;
|
||||
m_debugDumpers = false;
|
||||
m_useToolTips = false;
|
||||
m_useDumpers = true;
|
||||
m_listSourceFiles = false;
|
||||
}
|
||||
|
||||
|
||||
QString DebuggerSettings::dump()
|
||||
{
|
||||
QString out;
|
||||
QTextStream ts(&out);
|
||||
ts << "Debugger settings: "
|
||||
<< " gdbCmd: " << m_gdbCmd
|
||||
<< " gdbEnv: " << m_gdbEnv
|
||||
<< " autoRun: " << m_autoRun
|
||||
<< " autoQuit: " << m_autoQuit
|
||||
<< " useCustomDumpers: " << m_useDumpers
|
||||
<< " skipKnownFrames: " << m_skipKnownFrames
|
||||
<< " debugDumpers: " << m_debugDumpers
|
||||
<< " useToolTips: " << m_useToolTips
|
||||
<< " listSourceFiles: " << m_listSourceFiles
|
||||
<< " scriptFile: " << m_scriptFile
|
||||
<< " pluginAllBreakpoints: " << m_pluginAllBreakpoints
|
||||
<< " pluginSelectedBreakpoints: " << m_pluginSelectedBreakpoints
|
||||
<< " pluginNoBreakpoints: " << m_pluginNoBreakpoints
|
||||
<< " pluginSelectedBreakpointsPattern: " << m_pluginSelectedBreakpointsPattern;
|
||||
return out;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BreakByFunctionDialog
|
||||
@@ -291,8 +257,6 @@ void DebuggerManager::init()
|
||||
this, SLOT(collapseChildren(QModelIndex)));
|
||||
connect(localsView, SIGNAL(requestAssignValue(QString,QString)),
|
||||
this, SLOT(assignValueInDebugger(QString,QString)));
|
||||
connect(localsView, SIGNAL(requestWatchExpression(QString)),
|
||||
this, SLOT(watchExpression(QString)));
|
||||
|
||||
// Watchers
|
||||
QTreeView *watchersView = qobject_cast<QTreeView *>(m_watchersWindow);
|
||||
@@ -303,10 +267,6 @@ void DebuggerManager::init()
|
||||
this, SLOT(expandChildren(QModelIndex)));
|
||||
connect(watchersView, SIGNAL(requestCollapseChildren(QModelIndex)),
|
||||
this, SLOT(collapseChildren(QModelIndex)));
|
||||
connect(watchersView, SIGNAL(requestWatchExpression(QString)),
|
||||
this, SLOT(watchExpression(QString)));
|
||||
connect(watchersView, SIGNAL(requestRemoveWatchExpression(QString)),
|
||||
this, SLOT(removeWatchExpression(QString)));
|
||||
connect(m_watchHandler, SIGNAL(sessionValueRequested(QString,QVariant*)),
|
||||
this, SIGNAL(sessionValueRequested(QString,QVariant*)));
|
||||
connect(m_watchHandler, SIGNAL(setSessionValueRequested(QString,QVariant)),
|
||||
@@ -467,11 +427,6 @@ void DebuggerManager::init()
|
||||
setDebuggerType(GdbDebugger);
|
||||
if (Debugger::Constants::Internal::debug)
|
||||
qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine;
|
||||
|
||||
connect(action(UseDumpers), SIGNAL(triggered(bool)),
|
||||
this, SLOT(setUseDumpers(bool)));
|
||||
connect(action(DebugDumpers), SIGNAL(triggered(bool)),
|
||||
this, SLOT(setDebugDumpers(bool)));
|
||||
}
|
||||
|
||||
void DebuggerManager::setDebuggerType(DebuggerType type)
|
||||
@@ -777,12 +732,6 @@ void DebuggerManager::collapseChildren(const QModelIndex &idx)
|
||||
m_watchHandler->collapseChildren(idx);
|
||||
}
|
||||
|
||||
void DebuggerManager::removeWatchExpression(const QString &exp)
|
||||
{
|
||||
QTC_ASSERT(m_watchHandler, return);
|
||||
m_watchHandler->removeWatchExpression(exp);
|
||||
}
|
||||
|
||||
QVariant DebuggerManager::sessionValue(const QString &name)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
@@ -1143,13 +1092,7 @@ void DebuggerManager::addToWatchWindow()
|
||||
if (!editor)
|
||||
return;
|
||||
QTextCursor tc = editor->textCursor();
|
||||
watchExpression(tc.selectedText());
|
||||
}
|
||||
|
||||
void DebuggerManager::watchExpression(const QString &expression)
|
||||
{
|
||||
QTC_ASSERT(m_watchHandler, return);
|
||||
m_watchHandler->watchExpression(expression);
|
||||
theDebuggerSettings()->item(WatchExpression)->setValue(tc.selectedText());
|
||||
}
|
||||
|
||||
void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)
|
||||
@@ -1278,38 +1221,6 @@ void DebuggerManager::setBusyCursor(bool busy)
|
||||
m_watchersWindow->setCursor(cursor);
|
||||
}
|
||||
|
||||
bool DebuggerManager::skipKnownFrames() const
|
||||
{
|
||||
return m_settings.m_skipKnownFrames;
|
||||
}
|
||||
|
||||
bool DebuggerManager::debugDumpers() const
|
||||
{
|
||||
return m_settings.m_debugDumpers;
|
||||
}
|
||||
|
||||
bool DebuggerManager::useDumpers() const
|
||||
{
|
||||
return m_settings.m_useDumpers;
|
||||
}
|
||||
|
||||
void DebuggerManager::setUseDumpers(bool on)
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_settings.m_useDumpers = on;
|
||||
}
|
||||
|
||||
void DebuggerManager::setDebugDumpers(bool on)
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_settings.m_debugDumpers = on;
|
||||
}
|
||||
|
||||
void DebuggerManager::setSkipKnownFrames(bool on)
|
||||
{
|
||||
m_settings.m_skipKnownFrames = on;
|
||||
}
|
||||
|
||||
void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
|
||||
QObject **object)
|
||||
{
|
||||
@@ -1335,7 +1246,6 @@ void DebuggerManager::interruptDebuggingRequest()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DebuggerManager::runToLineExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
|
||||
@@ -160,16 +160,7 @@ private:
|
||||
virtual SourceFilesWindow *sourceFileWindow() = 0;
|
||||
|
||||
virtual void showApplicationOutput(const QString &data) = 0;
|
||||
virtual bool skipKnownFrames() const = 0;
|
||||
virtual bool debugDumpers() const = 0;
|
||||
virtual bool useDumpers() const = 0;
|
||||
|
||||
virtual bool wantsSourceFileList() const = 0;
|
||||
virtual bool wantsAllPluginBreakpoints() const = 0;
|
||||
virtual bool wantsSelectedPluginBreakpoints() const = 0;
|
||||
virtual bool wantsNoPluginBreakpoints() const = 0;
|
||||
virtual QString selectedPluginBreakpointsPattern() const = 0;
|
||||
|
||||
virtual void reloadDisassembler() = 0;
|
||||
virtual void reloadModules() = 0;
|
||||
virtual void reloadSourceFiles() = 0;
|
||||
@@ -177,36 +168,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// DebuggerSettings
|
||||
//
|
||||
|
||||
class DebuggerSettings
|
||||
{
|
||||
public:
|
||||
DebuggerSettings();
|
||||
QString dump();
|
||||
|
||||
public:
|
||||
QString m_gdbCmd;
|
||||
QString m_gdbEnv;
|
||||
bool m_autoRun;
|
||||
bool m_autoQuit;
|
||||
|
||||
bool m_useDumpers;
|
||||
bool m_skipKnownFrames;
|
||||
bool m_debugDumpers;
|
||||
bool m_useToolTips;
|
||||
bool m_listSourceFiles;
|
||||
|
||||
QString m_scriptFile;
|
||||
|
||||
bool m_pluginAllBreakpoints;
|
||||
bool m_pluginSelectedBreakpoints;
|
||||
bool m_pluginNoBreakpoints;
|
||||
QString m_pluginSelectedBreakpointsPattern;
|
||||
};
|
||||
|
||||
//
|
||||
// DebuggerManager
|
||||
//
|
||||
@@ -223,7 +184,6 @@ public:
|
||||
IDebuggerManagerAccessForEngines *engineInterface();
|
||||
QMainWindow *mainWindow() const { return m_mainWindow; }
|
||||
QLabel *statusLabel() const { return m_statusLabel; }
|
||||
DebuggerSettings *settings() { return &m_settings; }
|
||||
|
||||
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
|
||||
|
||||
@@ -258,7 +218,6 @@ public slots:
|
||||
void breakByFunction();
|
||||
void breakByFunction(const QString &functionName);
|
||||
void setBreakpoint(const QString &fileName, int lineNumber);
|
||||
void watchExpression(const QString &expression);
|
||||
void breakAtMain();
|
||||
void activateFrame(int index);
|
||||
void selectThread(int index);
|
||||
@@ -272,7 +231,6 @@ public slots:
|
||||
|
||||
void addToWatchWindow();
|
||||
void updateWatchModel();
|
||||
void removeWatchExpression(const QString &iname);
|
||||
void expandChildren(const QModelIndex &idx);
|
||||
void collapseChildren(const QModelIndex &idx);
|
||||
|
||||
@@ -284,11 +242,7 @@ public slots:
|
||||
|
||||
void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever
|
||||
|
||||
void setSkipKnownFrames(bool on);
|
||||
|
||||
private slots:
|
||||
void setDebugDumpers(bool on);
|
||||
void setUseDumpers(bool on);
|
||||
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
||||
void showDebuggerInput(const QString &prefix, const QString &msg);
|
||||
void showApplicationOutput(const QString &data);
|
||||
@@ -323,20 +277,6 @@ private:
|
||||
WatchHandler *watchHandler() { return m_watchHandler; }
|
||||
SourceFilesWindow *sourceFileWindow() { return m_sourceFilesWindow; }
|
||||
|
||||
bool skipKnownFrames() const;
|
||||
bool debugDumpers() const;
|
||||
bool useDumpers() const;
|
||||
bool wantsSourceFileList() const
|
||||
{ return m_settings.m_listSourceFiles; }
|
||||
bool wantsAllPluginBreakpoints() const
|
||||
{ return m_settings.m_pluginAllBreakpoints; }
|
||||
bool wantsSelectedPluginBreakpoints() const
|
||||
{ return m_settings.m_pluginSelectedBreakpoints; }
|
||||
bool wantsNoPluginBreakpoints() const
|
||||
{ return m_settings.m_pluginNoBreakpoints; }
|
||||
QString selectedPluginBreakpointsPattern() const
|
||||
{ return m_settings.m_pluginSelectedBreakpointsPattern; }
|
||||
|
||||
void notifyInferiorStopped();
|
||||
void notifyInferiorRunningRequested();
|
||||
void notifyInferiorStopRequested();
|
||||
@@ -383,7 +323,6 @@ signals:
|
||||
void configValueRequested(const QString &name, QVariant *value);
|
||||
void setConfigValueRequested(const QString &name, const QVariant &value);
|
||||
void applicationOutputAvailable(const QString &output);
|
||||
void settingsDialogRequested();
|
||||
|
||||
public:
|
||||
// FIXME: make private
|
||||
@@ -473,7 +412,6 @@ private:
|
||||
|
||||
IDebuggerEngine *engine();
|
||||
IDebuggerEngine *m_engine;
|
||||
DebuggerSettings m_settings;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -257,40 +257,41 @@ private:
|
||||
friend class DebuggerPlugin;
|
||||
Ui::GdbOptionPage m_ui;
|
||||
|
||||
DebuggerSettings m_settings;
|
||||
DebuggerPlugin *m_plugin;
|
||||
};
|
||||
|
||||
QWidget *GdbOptionPage::createPage(QWidget *parent)
|
||||
{
|
||||
QWidget *w = new QWidget(parent);
|
||||
m_settings = *m_plugin->m_manager->settings();
|
||||
m_ui.setupUi(w);
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
|
||||
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
|
||||
m_ui.gdbLocationChooser->setPath(m_settings.m_gdbCmd);
|
||||
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
|
||||
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
|
||||
m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile);
|
||||
m_ui.environmentEdit->setText(m_settings.m_gdbEnv);
|
||||
|
||||
m_ui.radioButtonAllPluginBreakpoints->
|
||||
setChecked(m_settings.m_pluginAllBreakpoints);
|
||||
m_ui.radioButtonSelectedPluginBreakpoints->
|
||||
setChecked(m_settings.m_pluginSelectedBreakpoints);
|
||||
m_ui.radioButtonNoPluginBreakpoints->
|
||||
setChecked(m_settings.m_pluginNoBreakpoints);
|
||||
s->connectWidget(GdbLocation, m_ui.gdbLocationChooser);
|
||||
s->connectWidget(GdbScriptFile, m_ui.scriptFileChooser);
|
||||
s->connectWidget(GdbEnvironment, m_ui.environmentEdit);
|
||||
|
||||
s->connectWidget(AllPluginBreakpoints,
|
||||
m_ui.radioButtonAllPluginBreakpoints);
|
||||
s->connectWidget(SelectedPluginBreakpoints,
|
||||
m_ui.radioButtonSelectedPluginBreakpoints);
|
||||
s->connectWidget(NoPluginBreakpoints,
|
||||
m_ui.radioButtonNoPluginBreakpoints);
|
||||
s->connectWidget(SelectedPluginBreakpointsPattern,
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern);
|
||||
|
||||
s->connectWidget(UseDumpers, m_ui.checkBoxUseDumpers);
|
||||
s->connectWidget(SkipKnownFrames, m_ui.checkBoxSkipKnownFrames);
|
||||
s->connectWidget(UseToolTips, m_ui.checkBoxUseToolTips);
|
||||
s->connectWidget(DebugDumpers, m_ui.checkBoxDebugDumpers);
|
||||
s->connectWidget(SelectedPluginBreakpointsPattern,
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern);
|
||||
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern->
|
||||
setText(m_settings.m_pluginSelectedBreakpointsPattern);
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern->
|
||||
setEnabled(m_settings.m_pluginSelectedBreakpoints);
|
||||
|
||||
m_ui.checkBoxListSourceFiles->setChecked(m_settings.m_listSourceFiles);
|
||||
m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames);
|
||||
m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
|
||||
m_ui.checkBoxUseDumpers->setChecked(m_settings.m_useDumpers);
|
||||
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
|
||||
|
||||
setEnabled(s->boolValue(SelectedPluginBreakpoints));
|
||||
connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
|
||||
|
||||
@@ -310,36 +311,15 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
|
||||
|
||||
//m_dumpLogAction = new QAction(this);
|
||||
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
|
||||
//
|
||||
connect(m_ui.checkBoxUseDumpers, SIGNAL(clicked()),
|
||||
action(UseDumpers), SLOT(trigger()));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void GdbOptionPage::apply()
|
||||
{
|
||||
m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path();
|
||||
m_settings.m_gdbEnv = m_ui.environmentEdit->text();
|
||||
m_settings.m_scriptFile = m_ui.scriptFileChooser->path();
|
||||
|
||||
m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
|
||||
m_settings.m_listSourceFiles = m_ui.checkBoxListSourceFiles->isChecked();
|
||||
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked();
|
||||
m_settings.m_useDumpers = m_ui.checkBoxUseDumpers->isChecked();
|
||||
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
|
||||
|
||||
m_settings.m_pluginAllBreakpoints =
|
||||
m_ui.radioButtonAllPluginBreakpoints->isChecked();
|
||||
m_settings.m_pluginSelectedBreakpoints =
|
||||
m_ui.radioButtonSelectedPluginBreakpoints->isChecked();
|
||||
m_settings.m_pluginNoBreakpoints =
|
||||
m_ui.radioButtonNoPluginBreakpoints->isChecked();
|
||||
m_settings.m_pluginSelectedBreakpointsPattern =
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern->text();
|
||||
|
||||
*m_plugin->m_manager->settings() = m_settings;
|
||||
m_plugin->writeSettings();
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
s->applyDeferedChanges();
|
||||
s->writeSettings(ICore::instance()->settings());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
@@ -716,7 +696,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
||||
connect(m_manager, SIGNAL(debugModeRequested()),
|
||||
this, SLOT(activateDebugMode()));
|
||||
|
||||
connect(m_manager, SIGNAL(settingsDialogRequested()),
|
||||
connect(theDebuggerSettings()->action(SettingsDialog), SIGNAL(triggered()),
|
||||
this, SLOT(showSettingsDialog()));
|
||||
|
||||
return true;
|
||||
@@ -810,7 +790,7 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
|
||||
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
||||
const QPoint &point, int pos)
|
||||
{
|
||||
if (!m_manager->settings()->m_useToolTips)
|
||||
if (!theDebuggerSettings()->boolValue(UseToolTips))
|
||||
return;
|
||||
|
||||
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||
@@ -899,34 +879,17 @@ void DebuggerPlugin::writeSettings() const
|
||||
QTC_ASSERT(m_manager->mainWindow(), return);
|
||||
|
||||
QSettings *s = settings();
|
||||
DebuggerSettings *m = m_manager->settings();
|
||||
theDebuggerSettings()->writeSettings(s);
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
s->setValue("State", m_manager->mainWindow()->saveState());
|
||||
s->setValue("Locked", m_toggleLockedAction->isChecked());
|
||||
s->setValue("Location", m->m_gdbCmd);
|
||||
s->setValue("Environment", m->m_gdbEnv);
|
||||
s->setValue("ScriptFile", m->m_scriptFile);
|
||||
s->setValue("AutoRun", m->m_autoRun);
|
||||
s->setValue("AutoQuit", m->m_autoQuit);
|
||||
|
||||
s->setValue("UseToolTips", m->m_useToolTips);
|
||||
s->setValue("UseCustomDumpers", m->m_useDumpers);
|
||||
s->setValue("ListSourceFiles", m->m_listSourceFiles);
|
||||
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
|
||||
s->setValue("DebugDumpers", m->m_debugDumpers);
|
||||
|
||||
s->setValue("AllPluginBreakpoints", m->m_pluginAllBreakpoints);
|
||||
s->setValue("SelectedPluginBreakpoints", m->m_pluginSelectedBreakpoints);
|
||||
s->setValue("NoPluginBreakpoints", m->m_pluginNoBreakpoints);
|
||||
s->setValue("SelectedPluginBreakpointsPattern", m->m_pluginSelectedBreakpointsPattern);
|
||||
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void DebuggerPlugin::readSettings()
|
||||
{
|
||||
QSettings *s = settings();
|
||||
DebuggerSettings *m = &m_manager->m_settings;
|
||||
theDebuggerSettings()->readSettings(s);
|
||||
|
||||
QString defaultCommand("gdb");
|
||||
#if defined(Q_OS_WIN32)
|
||||
@@ -937,31 +900,8 @@ void DebuggerPlugin::readSettings()
|
||||
QString defaultScript;
|
||||
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
|
||||
QByteArray ba = s->value("State", QByteArray()).toByteArray();
|
||||
m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
|
||||
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
|
||||
m->m_scriptFile = s->value("ScriptFile", defaultScript).toString();
|
||||
m->m_gdbEnv = s->value("Environment", "").toString();
|
||||
m->m_autoRun = s->value("AutoRun", true).toBool();
|
||||
m->m_autoQuit = s->value("AutoQuit", true).toBool();
|
||||
|
||||
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
|
||||
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
|
||||
m->m_useDumpers = s->value("UseCustomDumpers", true).toBool();
|
||||
action(UseDumpers)->setChecked(m->m_useDumpers);
|
||||
m->m_useToolTips = s->value("UseToolTips", false).toBool();
|
||||
m->m_listSourceFiles = s->value("ListSourceFiles", false).toBool();
|
||||
|
||||
m->m_pluginAllBreakpoints =
|
||||
s->value("AllPluginBreakpoints", true).toBool();
|
||||
m->m_pluginSelectedBreakpoints =
|
||||
s->value("SelectedPluginBreakpoints", false).toBool();
|
||||
m->m_pluginNoBreakpoints =
|
||||
s->value("NoPluginBreakpoints", false).toBool();
|
||||
m->m_pluginSelectedBreakpointsPattern =
|
||||
s->value("SelectedPluginBreakpointsPattern").toString();
|
||||
|
||||
s->endGroup();
|
||||
|
||||
m_manager->mainWindow()->restoreState(ba);
|
||||
|
||||
@@ -285,11 +285,12 @@ void GdbEngine::initializeConnections()
|
||||
q, SLOT(showApplicationOutput(QString)),
|
||||
Qt::QueuedConnection);
|
||||
|
||||
connect(action(UseDumpers), SIGNAL(triggered(bool)),
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
connect(s->item(UseDumpers), SIGNAL(boolValueChanged(bool)),
|
||||
this, SLOT(setUseDumpers(bool)));
|
||||
connect(action(DebugDumpers), SIGNAL(triggered(bool)),
|
||||
connect(s->item(DebugDumpers), SIGNAL(boolValueChanged(bool)),
|
||||
this, SLOT(setDebugDumpers(bool)));
|
||||
connect(action(RecheckDumpers), SIGNAL(triggered()),
|
||||
connect(s->action(RecheckDumpers), SIGNAL(triggered()),
|
||||
this, SLOT(recheckCustomDumperAvailability()));
|
||||
}
|
||||
|
||||
@@ -319,7 +320,8 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
|
||||
case QProcess::FailedToStart:
|
||||
msg = QString(tr("The Gdb process failed to start. Either the "
|
||||
"invoked program '%1' is missing, or you may have insufficient "
|
||||
"permissions to invoke the program.")).arg(q->settings()->m_gdbCmd);
|
||||
"permissions to invoke the program."))
|
||||
.arg(theDebuggerSettings()->stringValue(GdbLocation));
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
msg = tr("The Gdb process crashed some time after starting "
|
||||
@@ -1144,22 +1146,24 @@ void GdbEngine::handleAqcuiredInferior()
|
||||
#if defined(Q_OS_MAC)
|
||||
sendCommand("info pid", GdbInfoProc, QVariant(), NeedsStop);
|
||||
#endif
|
||||
if (qq->wantsSourceFileList())
|
||||
if (theDebuggerSettings()->boolValue(UseDumpers))
|
||||
reloadSourceFiles();
|
||||
tryLoadCustomDumpers();
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
// intentionally after tryLoadCustomDumpers(),
|
||||
// otherwise we'd interupt solib loading.
|
||||
if (qq->wantsAllPluginBreakpoints()) {
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
if (s->boolValue(AllPluginBreakpoints)) {
|
||||
sendCommand("set auto-solib-add on");
|
||||
sendCommand("set stop-on-solib-events 0");
|
||||
sendCommand("sharedlibrary .*");
|
||||
} else if (qq->wantsSelectedPluginBreakpoints()) {
|
||||
} else if (s->boolValue(SelectedPluginBreakpoints)) {
|
||||
sendCommand("set auto-solib-add on");
|
||||
sendCommand("set stop-on-solib-events 1");
|
||||
sendCommand("sharedlibrary " + qq->selectedPluginBreakpointsPattern());
|
||||
} else if (qq->wantsNoPluginBreakpoints()) {
|
||||
sendCommand("sharedlibrary "
|
||||
+ s->stringValue(SelectedPluginBreakpointsPattern));
|
||||
} else if (s->boolValue(NoPluginBreakpoints)) {
|
||||
// should be like that already
|
||||
sendCommand("set auto-solib-add off");
|
||||
sendCommand("set stop-on-solib-events 0");
|
||||
@@ -1232,11 +1236,13 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
||||
}
|
||||
|
||||
QString msg = data.findChild("consolestreamoutput").data();
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
|
||||
if (qq->wantsSelectedPluginBreakpoints()) {
|
||||
if (s->boolValue(SelectedPluginBreakpoints)) {
|
||||
debugMessage("SHARED LIBRARY EVENT: " + data.toString());
|
||||
debugMessage("PATTERN: " + qq->selectedPluginBreakpointsPattern());
|
||||
sendCommand("sharedlibrary " + qq->selectedPluginBreakpointsPattern());
|
||||
QString pattern = s->stringValue(SelectedPluginBreakpointsPattern);
|
||||
debugMessage("PATTERN: " + pattern);
|
||||
sendCommand("sharedlibrary " + pattern);
|
||||
continueInferior();
|
||||
q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString())));
|
||||
return;
|
||||
@@ -1260,7 +1266,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
||||
|
||||
// jump over well-known frames
|
||||
static int stepCounter = 0;
|
||||
if (qq->skipKnownFrames()) {
|
||||
if (s->boolValue(SkipKnownFrames)) {
|
||||
if (reason == "end-stepping-range" || reason == "function-finished") {
|
||||
GdbMi frame = data.findChild("frame");
|
||||
//debugMessage(frame.toString());
|
||||
@@ -1302,7 +1308,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
||||
frame.findChild("func").data() + '%';
|
||||
|
||||
QApplication::alert(q->mainWindow(), 3000);
|
||||
if (qq->wantsSourceFileList())
|
||||
if (s->boolValue(ListSourceFiles))
|
||||
reloadSourceFiles();
|
||||
sendCommand("-break-list", BreakList);
|
||||
QVariant var = QVariant::fromValue<GdbMi>(data);
|
||||
@@ -1562,7 +1568,7 @@ int GdbEngine::currentFrame() const
|
||||
|
||||
bool GdbEngine::startDebugger()
|
||||
{
|
||||
debugMessage(q->settings()->dump());
|
||||
debugMessage(theDebuggerSettings()->dump());
|
||||
QStringList gdbArgs;
|
||||
|
||||
if (m_gdbProc.state() != QProcess::NotRunning) {
|
||||
@@ -1608,8 +1614,9 @@ bool GdbEngine::startDebugger()
|
||||
qDebug() << "ExeFile: " << q->m_executable;
|
||||
#endif
|
||||
|
||||
q->showStatusMessage(tr("Starting Debugger: ") + q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" "));
|
||||
m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs);
|
||||
QString loc = theDebuggerSettings()->stringValue(GdbLocation);
|
||||
q->showStatusMessage(tr("Starting Debugger: ") + loc + ' ' + gdbArgs.join(" "));
|
||||
m_gdbProc.start(loc, gdbArgs);
|
||||
if (!m_gdbProc.waitForStarted()) {
|
||||
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
|
||||
tr("Cannot start debugger: %1").arg(m_gdbProc.errorString()));
|
||||
@@ -1683,7 +1690,7 @@ bool GdbEngine::startDebugger()
|
||||
"dyld \".*CarbonDataFormatters.*\" all");
|
||||
#endif
|
||||
|
||||
QString scriptFileName = q->settings()->m_scriptFile;
|
||||
QString scriptFileName = theDebuggerSettings()->stringValue(GdbScriptFile);
|
||||
if (!scriptFileName.isEmpty()) {
|
||||
QFile scriptFile(scriptFileName);
|
||||
if (scriptFile.open(QIODevice::ReadOnly)) {
|
||||
@@ -2759,7 +2766,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (q->settings()->m_debugDumpers) {
|
||||
if (theDebuggerSettings()->boolValue(DebugDumpers)) {
|
||||
// minimize interference
|
||||
return;
|
||||
}
|
||||
@@ -3093,8 +3100,7 @@ void GdbEngine::setUseDumpers(bool on)
|
||||
|
||||
bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
||||
{
|
||||
DebuggerSettings *s = q->settings();
|
||||
if (!s->m_useDumpers)
|
||||
if (!theDebuggerSettings()->boolValue(UseDumpers))
|
||||
return false;
|
||||
|
||||
if (q->startMode() == AttachCore) {
|
||||
@@ -3103,8 +3109,10 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
||||
|| type == "QStringList" || type.endsWith("::QStringList");
|
||||
}
|
||||
|
||||
if (s->m_debugDumpers && qq->stackHandler()->isDebuggingDumpers())
|
||||
if (theDebuggerSettings()->boolValue(DebugDumpers)
|
||||
&& qq->stackHandler()->isDebuggingDumpers())
|
||||
return false;
|
||||
|
||||
if (m_dataDumperState != DataDumperAvailable)
|
||||
return false;
|
||||
|
||||
@@ -3696,7 +3704,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
||||
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
||||
#ifdef QT_DEBUG
|
||||
// Make debugging of dumpers easier
|
||||
if (q->settings()->m_debugDumpers
|
||||
if (theDebuggerSettings()->boolValue(DebugDumpers)
|
||||
&& msg.startsWith("The program being debugged stopped while")
|
||||
&& msg.contains("qDumpObjectData440")) {
|
||||
// Fake full stop
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "watchhandler.h"
|
||||
#include "debuggeractions.h"
|
||||
|
||||
#if USE_MODEL_TEST
|
||||
#include "modeltest.h"
|
||||
@@ -38,6 +39,7 @@
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QEvent>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QToolTip>
|
||||
@@ -365,6 +367,14 @@ WatchHandler::WatchHandler()
|
||||
m_completeSet = initialSet();
|
||||
m_incompleteSet.clear();
|
||||
m_displaySet = m_completeSet;
|
||||
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
|
||||
connect(s->item(WatchExpression), SIGNAL(stringValueChanged(QString)),
|
||||
this, SLOT(watchExpression(QString)));
|
||||
|
||||
connect(s->item(RemoveWatchExpression), SIGNAL(stringValueChanged(QString)),
|
||||
this, SLOT(removeWatchExpression(QString)));
|
||||
}
|
||||
|
||||
bool WatchHandler::setData(const QModelIndex &idx,
|
||||
|
||||
@@ -160,8 +160,8 @@ public:
|
||||
|
||||
//public slots:
|
||||
void cleanup();
|
||||
void watchExpression(const QString &exp);
|
||||
void removeWatchExpression(const QString &exp);
|
||||
Q_SLOT void watchExpression(const QString &exp);
|
||||
Q_SLOT void removeWatchExpression(const QString &exp);
|
||||
void reinitializeWatchers();
|
||||
|
||||
void collapseChildren(const QModelIndex &idx);
|
||||
|
||||
@@ -92,23 +92,20 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
||||
QModelIndex idx = currentIndex();
|
||||
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
||||
QString exp = model()->data(idx1).toString();
|
||||
emit requestRemoveWatchExpression(exp);
|
||||
theDebuggerSettings()->item(RemoveWatchExpression)->setValue(exp);
|
||||
}
|
||||
QTreeView::keyPressEvent(ev);
|
||||
}
|
||||
|
||||
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
QtcSettings *s = theDebuggerSettings();
|
||||
QMenu menu;
|
||||
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
|
||||
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
|
||||
act2->setCheckable(true);
|
||||
act2->setChecked(m_alwaysResizeColumnsToContents);
|
||||
QAction *act3 = 0;
|
||||
QAction *act4 = 0;
|
||||
QAction *act5 = action(RecheckDumpers);
|
||||
QAction *act6 = action(UseDumpers);
|
||||
QAction *act7 = action(SettingsDialog);
|
||||
|
||||
menu.addAction(act1);
|
||||
menu.addAction(act2);
|
||||
@@ -121,10 +118,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
bool visual = false;
|
||||
if (idx.isValid()) {
|
||||
menu.addSeparator();
|
||||
if (m_type == LocalsType)
|
||||
act3 = new QAction("Watch expression '" + exp + "'", &menu);
|
||||
else
|
||||
act3 = new QAction("Remove expression '" + exp + "'", &menu);
|
||||
int type = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression;
|
||||
QAction *act3 = s->action(type);
|
||||
act3->setText(exp);
|
||||
menu.addAction(act3);
|
||||
|
||||
visual = model()->data(mi0, VisualRole).toBool();
|
||||
@@ -134,28 +130,19 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
// FIXME: menu.addAction(act4);
|
||||
}
|
||||
menu.addSeparator();
|
||||
menu.addAction(act5);
|
||||
menu.addAction(act6);
|
||||
menu.addAction(s->action(RecheckDumpers));
|
||||
menu.addAction(s->action(UseDumpers));
|
||||
menu.addSeparator();
|
||||
menu.addAction(act7);
|
||||
menu.addAction(s->action(SettingsDialog));
|
||||
|
||||
QAction *act = menu.exec(ev->globalPos());
|
||||
|
||||
if (!act)
|
||||
;
|
||||
else if (act == act1)
|
||||
if (act == act1)
|
||||
resizeColumnsToContents();
|
||||
else if (act == act2)
|
||||
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
|
||||
else if (act == act3)
|
||||
if (m_type == LocalsType)
|
||||
emit requestWatchExpression(exp);
|
||||
else
|
||||
emit requestRemoveWatchExpression(exp);
|
||||
else if (act == act4)
|
||||
model()->setData(mi0, !visual, VisualRole);
|
||||
else
|
||||
act->trigger();
|
||||
}
|
||||
|
||||
void WatchWindow::resizeColumnsToContents()
|
||||
|
||||
@@ -58,8 +58,6 @@ public slots:
|
||||
void setModel(QAbstractItemModel *model);
|
||||
|
||||
signals:
|
||||
void requestWatchExpression(const QString &exp);
|
||||
void requestRemoveWatchExpression(const QString &exp);
|
||||
void requestAssignValue(const QString &exp, const QString &value);
|
||||
void requestExpandChildren(const QModelIndex &idx);
|
||||
void requestCollapseChildren(const QModelIndex &idx);
|
||||
|
||||
@@ -5,6 +5,6 @@ Thinks to check:
|
||||
- availability of Qt debug information (custom display of QObject derived
|
||||
class)
|
||||
- availabitily of Qt sources (single step into some Qt *._cpp_ file)
|
||||
- setting of breakpoints on dynamically loaded plugins (try plugin.cpp here)
|
||||
- setting of breakpoints on dynamically loaded plugins (try plugin.cpp here, especially in constructors)
|
||||
- check I/O (qDebug, std::cout, std::cerr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user