Commit 7f8473f4 authored by hjk's avatar hjk

move debugger options to configuration dialog

parent 73f9b175
......@@ -26,7 +26,6 @@ HEADERS += attachexternaldialog.h \
disassemblerwindow.h \
gdbengine.h \
gdbmi.h \
gdboptionpage.h \
idebuggerengine.h \
imports.h \
moduleshandler.h \
......@@ -55,7 +54,6 @@ SOURCES += attachexternaldialog.cpp \
disassemblerwindow.cpp \
gdbengine.cpp \
gdbmi.cpp \
gdboptionpage.cpp \
gdbengine.h \
moduleshandler.cpp \
moduleswindow.cpp \
......
......@@ -86,6 +86,18 @@ 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_useToolTips = false;
m_useCustomDumpers = true;
}
///////////////////////////////////////////////////////////////////////
//
// BreakByFunctionDialog
......@@ -322,56 +334,6 @@ void DebuggerManager::init()
m_breakAtMainAction = new QAction(this);
m_breakAtMainAction->setText(tr("Set Breakpoint at Function 'main'"));
m_debugDumpersAction = new QAction(this);
m_debugDumpersAction->setText(tr("Debug Custom Dumpers"));
m_debugDumpersAction->setToolTip(tr("This is an internal tool to "
"make debugging the Custom Data Dumper code easier. "
"Using this action is in general not needed unless you "
"want do debug Qt Creator itself."));
m_debugDumpersAction->setCheckable(true);
m_skipKnownFramesAction = new QAction(this);
m_skipKnownFramesAction->setText(tr("Skip Known Frames When Stepping"));
m_skipKnownFramesAction->setToolTip(tr("After checking this option"
"'Step Into' combines in certain situations several steps, "
"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"));
m_skipKnownFramesAction->setCheckable(true);
m_useCustomDumpersAction = new QAction(this);
m_useCustomDumpersAction->setText(tr("Use Custom Display for Qt Objects"));
m_useCustomDumpersAction->setToolTip(tr("Checking this will make the debugger "
"try to use code to format certain data (QObject, QString, ...) nicely. "));
m_useCustomDumpersAction->setCheckable(true);
m_useCustomDumpersAction->setChecked(true);
m_useFastStartAction = new QAction(this);
m_useFastStartAction->setText(tr("Fast Debugger Start"));
m_useFastStartAction->setToolTip(tr("Checking this will make the debugger "
"start fast by loading only very few debug symbols on start up. This "
"might lead to situations where breakpoints can not be set properly. "
"So uncheck this option if you experience breakpoint related problems."));
m_useFastStartAction->setCheckable(true);
m_useFastStartAction->setChecked(true);
m_useToolTipsAction = new QAction(this);
m_useToolTipsAction->setText(tr("Use Tooltips While Debugging"));
m_useToolTipsAction->setToolTip(tr("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."));
m_useToolTipsAction->setCheckable(true);
m_useToolTipsAction->setChecked(false);
// FIXME
m_useFastStartAction->setChecked(false);
m_useFastStartAction->setEnabled(false);
m_dumpLogAction = new QAction(this);
m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
m_watchAction = new QAction(this);
m_watchAction->setText(tr("Add to Watch Window"));
......@@ -416,14 +378,6 @@ void DebuggerManager::init()
connect(m_breakAtMainAction, SIGNAL(triggered()),
this, SLOT(breakAtMain()));
connect(m_useFastStartAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_useCustomDumpersAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_skipKnownFramesAction, SIGNAL(triggered()),
this, SLOT(saveSessionData()));
connect(m_dumpLogAction, SIGNAL(triggered()),
this, SLOT(dumpLog()));
connect(m_statusTimer, SIGNAL(timeout()),
this, SLOT(clearStatusMessage()));
......@@ -947,16 +901,6 @@ void DebuggerManager::loadSessionData()
{
m_breakHandler->loadSessionData();
m_watchHandler->loadSessionData();
QVariant value;
querySessionValue(QLatin1String("UseFastStart"), &value);
m_useFastStartAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseToolTips"), &value);
m_useToolTipsAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
m_skipKnownFramesAction->setChecked(value.toBool());
engine()->loadSessionData();
}
......@@ -964,15 +908,6 @@ void DebuggerManager::saveSessionData()
{
m_breakHandler->saveSessionData();
m_watchHandler->saveSessionData();
setSessionValue(QLatin1String("UseFastStart"),
m_useFastStartAction->isChecked());
setSessionValue(QLatin1String("UseToolTips"),
m_useToolTipsAction->isChecked());
setSessionValue(QLatin1String("UseCustomDumpers"),
m_useCustomDumpersAction->isChecked());
setSessionValue(QLatin1String("SkipKnownFrames"),
m_skipKnownFramesAction->isChecked());
engine()->saveSessionData();
}
......@@ -1139,22 +1074,22 @@ void DebuggerManager::setBusyCursor(bool busy)
bool DebuggerManager::skipKnownFrames() const
{
return m_skipKnownFramesAction->isChecked();
return m_settings.m_skipKnownFrames;
}
bool DebuggerManager::debugDumpers() const
{
return m_debugDumpersAction->isChecked();
return m_settings.m_debugDumpers;
}
bool DebuggerManager::useCustomDumpers() const
{
return m_useCustomDumpersAction->isChecked();
return m_settings.m_useCustomDumpers;
}
bool DebuggerManager::useFastStart() const
{
return 0; // && m_useFastStartAction->isChecked();
return 0; // && m_settings.m_useFastStart;
}
void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
......
......@@ -167,8 +167,8 @@ private:
virtual WatchHandler *watchHandler() = 0;
virtual void showApplicationOutput(const QString &prefix, const QString &data) = 0;
virtual QAction *useCustomDumpersAction() const = 0;
virtual QAction *debugDumpersAction() const = 0;
//virtual QAction *useCustomDumpersAction() const = 0;
//virtual QAction *debugDumpersAction() const = 0;
virtual bool skipKnownFrames() const = 0;
virtual bool debugDumpers() const = 0;
virtual bool useCustomDumpers() const = 0;
......@@ -180,6 +180,30 @@ private:
};
//
// DebuggerSettings
//
class DebuggerSettings
{
public:
DebuggerSettings();
public:
QString m_gdbCmd;
QString m_gdbEnv;
bool m_autoRun;
bool m_autoQuit;
bool m_useCustomDumpers;
bool m_skipKnownFrames;
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
QString m_scriptFile;
};
//
// DebuggerManager
//
......@@ -196,6 +220,7 @@ public:
IDebuggerManagerAccessForEngines *engineInterface();
QMainWindow *mainWindow() const { return m_mainWindow; }
QLabel *statusLabel() const { return m_statusLabel; }
DebuggerSettings *settings() { return &m_settings; }
enum StartMode { startInternal, startExternal, attachExternal };
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
......@@ -286,9 +311,9 @@ private:
StackHandler *stackHandler() { return m_stackHandler; }
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; }
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
QAction *useToolTipsAction() const { return m_useToolTipsAction; }
QAction *debugDumpersAction() const { return m_debugDumpersAction; }
//QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
//QAction *useToolTipsAction() const { return m_useToolTipsAction; }
//QAction *debugDumpersAction() const { return m_debugDumpersAction; }
bool skipKnownFrames() const;
bool debugDumpers() const;
bool useCustomDumpers() const;
......@@ -342,7 +367,6 @@ signals:
void setConfigValueRequested(const QString &name, const QVariant &value);
void applicationOutputAvailable(const QString &prefix, const QString &msg);
public:
// FIXME: make private
QString m_executable;
......@@ -406,13 +430,6 @@ private:
QAction *m_sepAction;
QAction *m_stepIAction;
QAction *m_nextIAction;
QAction *m_skipKnownFramesAction;
QAction *m_debugDumpersAction;
QAction *m_useCustomDumpersAction;
QAction *m_useFastStartAction;
QAction *m_useToolTipsAction;
QAction *m_dumpLogAction;
QWidget *m_breakWindow;
QWidget *m_disassemblerWindow;
......@@ -432,9 +449,9 @@ private:
IDebuggerEngine *engine();
IDebuggerEngine *m_engine;
DebuggerSettings m_settings;
};
} // namespace Internal
} // namespace Debugger
......
This diff is collapsed.
......@@ -78,7 +78,6 @@ private slots:
void changeStatus(int status);
void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos);
void querySessionValue(const QString &name, QVariant *value);
void setSessionValue(const QString &name, const QVariant &value);
void queryConfigValue(const QString &name, QVariant *value);
......@@ -97,6 +96,7 @@ private:
void writeSettings() const;
friend class DebuggerManager;
friend class GdbOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
......
......@@ -84,19 +84,6 @@ Q_DECLARE_METATYPE(Debugger::Internal::GdbMi);
static const QString tooltipIName = "tooltip";
///////////////////////////////////////////////////////////////////////
//
// GdbSettings
//
///////////////////////////////////////////////////////////////////////
GdbSettings &Debugger::Internal::theGdbSettings()
{
static GdbSettings settings;
return settings;
}
///////////////////////////////////////////////////////////////////////
//
// GdbCommandType
......@@ -265,7 +252,6 @@ void GdbEngine::init()
m_pendingRequests = 0;
m_gdbVersion = 100;
m_shared = 0;
qq->debugDumpersAction()->setChecked(false);
m_oldestAcceptableToken = -1;
......@@ -279,11 +265,6 @@ void GdbEngine::init()
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
SLOT(exitDebugger()));
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setDebugDumpers(bool)));
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setCustomDumpersWanted(bool)));
// Output
connect(this, SIGNAL(gdbResponseAvailable()),
this, SLOT(handleResponse()), Qt::QueuedConnection);
......@@ -306,7 +287,7 @@ 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(theGdbSettings().m_gdbCmd);
"permissions to invoke the program.")).arg(q->settings()->m_gdbCmd);
break;
case QProcess::Crashed:
msg = tr("The Gdb process crashed some time after starting "
......@@ -1503,7 +1484,7 @@ void GdbEngine::exitDebugger()
m_varToType.clear();
m_dataDumperState = DataDumperUninitialized;
m_shared = 0;
qq->debugDumpersAction()->setChecked(false);
//q->settings()->m_debugDumpers = false;
}
......@@ -1535,7 +1516,7 @@ bool GdbEngine::startDebugger()
m_gdbProc.setEnvironment(q->m_environment);
#if 0
qDebug() << "Command: " << theGdbSettings().m_gdbCmd;
qDebug() << "Command: " << q->settings()->m_gdbCmd;
qDebug() << "WorkingDirectory: " << m_gdbProc.workingDirectory();
qDebug() << "Environment: " << m_gdbProc.environment();
qDebug() << "Arguments: " << gdbArgs;
......@@ -1544,9 +1525,9 @@ bool GdbEngine::startDebugger()
#endif
q->showStatusMessage(tr("Starting Debugger"));
emit gdbInputAvailable(QString(), theGdbSettings().m_gdbCmd + ' ' + gdbArgs.join(" "));
emit gdbInputAvailable(QString(), q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" "));
m_gdbProc.start(theGdbSettings().m_gdbCmd, gdbArgs);
m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs);
m_gdbProc.waitForStarted();
if (m_gdbProc.state() != QProcess::Running)
......@@ -2589,7 +2570,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
return;
}
if (qq->debugDumpersAction()->isChecked()) {
if (q->settings()->m_debugDumpers) {
// minimize interference
return;
}
......@@ -2909,10 +2890,10 @@ void GdbEngine::setCustomDumpersWanted(bool on)
bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
{
if (!qq->useCustomDumpers())
DebuggerSettings *s = q->settings();
if (!s->m_useCustomDumpers)
return false;
if (qq->debugDumpersAction()->isChecked()
&& qq->stackHandler()->isDebuggingDumpers())
if (s->m_debugDumpers && qq->stackHandler()->isDebuggingDumpers())
return false;
if (m_dataDumperState != DataDumperAvailable)
return false;
......@@ -3470,7 +3451,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
#ifdef QT_DEBUG
// Make debugging of dumers easier
if (qq->debugDumpersAction()->isChecked()
if (q->settings()->m_debugDumpers
&& msg.startsWith("The program being debugged stopped while")
&& msg.contains("qDumpObjectData440")) {
// Fake full stop
......
......@@ -81,23 +81,6 @@ enum DataDumperState
};
class GdbSettings
{
public:
GdbSettings() { m_autoRun = m_autoQuit = false; }
public:
QString m_gdbCmd;
QString m_gdbEnv;
bool m_autoRun;
bool m_autoQuit;
QString m_scriptFile;
QMap<QString, QVariant> m_typeMacros;
};
GdbSettings &theGdbSettings();
class GdbEngine : public IDebuggerEngine
{
Q_OBJECT
......
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "gdboptionpage.h"
#include "gdbengine.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtGui/QLineEdit>
#include <QtGui/QFileDialog>
using namespace Debugger::Internal;
GdbOptionPage::GdbOptionPage(GdbSettings *settings)
{
m_pm = ExtensionSystem::PluginManager::instance();
m_settings = settings;
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions");
QString defaultCommand("gdb");
#if defined(Q_OS_WIN32)
defaultCommand.append(".exe");
#endif
QString defaultScript = coreIFace->resourcePath() +
QLatin1String("/gdb/qt4macros");
m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString();
m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString();
m_settings->m_gdbEnv = s->value("Environment", "").toString();
m_settings->m_autoRun = s->value("AutoRun", true).toBool();
m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
s->endGroup();
}
QString GdbOptionPage::name() const
{
return tr("Gdb");
}
QString GdbOptionPage::category() const
{
return "Debugger";
}
QString GdbOptionPage::trCategory() const
{
return tr("Debugger");
}
QWidget *GdbOptionPage::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.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.autoStartBox->setChecked(m_settings->m_autoRun);
m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
// FIXME
m_ui.autoStartBox->hide();
m_ui.autoQuitBox->hide();
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
this, SLOT(onGdbLocationChanged()));
connect(m_ui.scriptFileChooser, SIGNAL(changed()),
this, SLOT(onScriptFileChanged()));
return w;
}
void GdbOptionPage::onGdbLocationChanged()
{
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
}
void GdbOptionPage::onScriptFileChanged()
{
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::apply()
{
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
m_settings->m_gdbEnv = m_ui.environmentEdit->text();
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())
return;
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions");
s->setValue("Location", m_settings->m_gdbCmd);
s->setValue("Environment", m_settings->m_gdbEnv);
s->setValue("AutoRun", m_settings->m_autoRun);
s->setValue("AutoQuit", m_settings->m_autoQuit);
s->endGroup();
}
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef GDBOPTIONPAGE_H
#define GDBOPTIONPAGE_H
#include "ui_gdboptionpage.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QWidget>
namespace ExtensionSystem { class PluginManager; }
namespace Debugger {
namespace Internal {
class GdbSettings;
class GdbOptionPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GdbOptionPage(GdbSettings *settings);
QString name() const;
QString category() const;
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
public slots:
void onGdbLocationChanged();
void onScriptFileChanged();
private:
ExtensionSystem::PluginManager *m_pm;
Ui::GdbOptionPage m_ui;
GdbSettings *m_settings;
};
#if 0
class TypeMacroPage : public Core::IOptionsPage
{
Q_OBJECT
public:
TypeMacroPage(GdbSettings *settings);
QString name() const;
QString category() const;