Commit 92a15600 authored by David Schulz's avatar David Schulz

Debugger: Add options page for cdb paths.

Change-Id: Iafb5fd88c101e716f538edc44113d21a880f2d3f
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 5374a4f3
HEADERS += $$PWD/cdbengine.h \ HEADERS += $$PWD/cdbengine.h \
cdb/bytearrayinputstream.h \ cdb/bytearrayinputstream.h \
cdb/cdbparsehelpers.h \ cdb/cdbparsehelpers.h \
cdb/cdboptions.h \
cdb/cdboptionspage.h cdb/cdboptionspage.h
SOURCES += $$PWD/cdbengine.cpp \ SOURCES += $$PWD/cdbengine.cpp \
cdb/bytearrayinputstream.cpp \ cdb/bytearrayinputstream.cpp \
cdb/cdbparsehelpers.cpp \ cdb/cdbparsehelpers.cpp \
cdb/cdboptions.cpp \
cdb/cdboptionspage.cpp cdb/cdboptionspage.cpp
FORMS += cdb/cdboptionspagewidget.ui FORMS += cdb/cdboptionspagewidget.ui
......
...@@ -195,9 +195,9 @@ Q_DECLARE_METATYPE(Debugger::Internal::ConditionalBreakPointCookie) ...@@ -195,9 +195,9 @@ Q_DECLARE_METATYPE(Debugger::Internal::ConditionalBreakPointCookie)
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
static inline bool isCreatorConsole(const DebuggerStartParameters &sp, const CdbOptions &o) static inline bool isCreatorConsole(const DebuggerStartParameters &sp)
{ {
return !o.cdbConsole && sp.useTerminal return !debuggerCore()->boolSetting(UseCdbConsole) && sp.useTerminal
&& (sp.startMode == StartInternal || sp.startMode == StartExternal); && (sp.startMode == StartInternal || sp.startMode == StartExternal);
} }
...@@ -316,35 +316,29 @@ static inline bool validMode(DebuggerStartMode sm) ...@@ -316,35 +316,29 @@ static inline bool validMode(DebuggerStartMode sm)
DebuggerEngine *createCdbEngine(const DebuggerStartParameters &sp, QString *errorMessage) DebuggerEngine *createCdbEngine(const DebuggerStartParameters &sp, QString *errorMessage)
{ {
if (Utils::HostOsInfo::isWindowsHost()) { if (Utils::HostOsInfo::isWindowsHost()) {
CdbOptionsPage *op = CdbOptionsPage::instance(); if (validMode(sp.startMode))
if (!op || !validMode(sp.startMode)) { return new CdbEngine(sp);
*errorMessage = QLatin1String("Internal error: Invalid start parameters passed for thee CDB engine."); *errorMessage = QLatin1String("Internal error: Invalid start parameters passed for thee CDB engine.");
return 0; } else {
} *errorMessage = QString::fromLatin1("Unsupported debug mode");
return new CdbEngine(sp, op->options());
} }
*errorMessage = QString::fromLatin1("Unsupported debug mode");
return 0; return 0;
} }
void addCdbOptionPages(QList<Core::IOptionsPage *> *opts) void addCdbOptionPages(QList<Core::IOptionsPage *> *opts)
{ {
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost()) {
opts->push_back(new CdbOptionsPage); opts->push_back(new CdbOptionsPage);
opts->push_back(new CdbPathsPage);
}
} }
#define QT_CREATOR_CDB_EXT "qtcreatorcdbext" #define QT_CREATOR_CDB_EXT "qtcreatorcdbext"
static inline Utils::SavedAction *theAssemblerAction() CdbEngine::CdbEngine(const DebuggerStartParameters &sp) :
{
return debuggerCore()->action(OperateByInstruction);
}
CdbEngine::CdbEngine(const DebuggerStartParameters &sp, const OptionsPtr &options) :
DebuggerEngine(sp), DebuggerEngine(sp),
m_creatorExtPrefix("<qtcreatorcdbext>|"), m_creatorExtPrefix("<qtcreatorcdbext>|"),
m_tokenPrefix("<token>"), m_tokenPrefix("<token>"),
m_options(options),
m_effectiveStartMode(NoStartMode), m_effectiveStartMode(NoStartMode),
m_accessible(false), m_accessible(false),
m_specialStopMode(NoSpecialStop), m_specialStopMode(NoSpecialStop),
...@@ -363,7 +357,8 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp, const OptionsPtr &option ...@@ -363,7 +357,8 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp, const OptionsPtr &option
m_watchPointY(0), m_watchPointY(0),
m_ignoreCdbOutput(false) m_ignoreCdbOutput(false)
{ {
connect(theAssemblerAction(), SIGNAL(triggered(bool)), this, SLOT(operateByInstructionTriggered(bool))); connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered(bool)),
this, SLOT(operateByInstructionTriggered(bool)));
setObjectName(QLatin1String("CdbEngine")); setObjectName(QLatin1String("CdbEngine"));
connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished())); connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished()));
...@@ -380,7 +375,7 @@ void CdbEngine::init() ...@@ -380,7 +375,7 @@ void CdbEngine::init()
m_specialStopMode = NoSpecialStop; m_specialStopMode = NoSpecialStop;
m_nextCommandToken = 0; m_nextCommandToken = 0;
m_currentBuiltinCommandIndex = -1; m_currentBuiltinCommandIndex = -1;
m_operateByInstructionPending = theAssemblerAction()->isChecked(); m_operateByInstructionPending = debuggerCore()->action(OperateByInstruction)->isChecked();
m_operateByInstruction = true; // Default CDB setting m_operateByInstruction = true; // Default CDB setting
m_notifyEngineShutdownOnTermination = false; m_notifyEngineShutdownOnTermination = false;
m_hasDebuggee = false; m_hasDebuggee = false;
...@@ -583,9 +578,9 @@ void CdbEngine::setupEngine() ...@@ -583,9 +578,9 @@ void CdbEngine::setupEngine()
if (debug) if (debug)
qDebug(">setupEngine"); qDebug(">setupEngine");
// Nag to add symbol server and cache // Nag to add symbol server and cache
if (CdbSymbolPathListEditor::promptToAddSymbolPaths(CdbOptions::settingsGroup(), QStringList symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths);
&(m_options->symbolPaths))) if (CdbSymbolPathListEditor::promptToAddSymbolPaths(&symbolPaths))
m_options->toSettings(Core::ICore::settings()); debuggerCore()->action(CdbSymbolPaths)->setValue(symbolPaths);
init(); init();
if (!m_logTime.elapsed()) if (!m_logTime.elapsed())
...@@ -596,7 +591,7 @@ void CdbEngine::setupEngine() ...@@ -596,7 +591,7 @@ void CdbEngine::setupEngine()
// console, too, but that immediately closes when the debuggee quits. // console, too, but that immediately closes when the debuggee quits.
// Use the Creator stub instead. // Use the Creator stub instead.
const DebuggerStartParameters &sp = startParameters(); const DebuggerStartParameters &sp = startParameters();
const bool launchConsole = isCreatorConsole(sp, *m_options); const bool launchConsole = isCreatorConsole(sp);
m_effectiveStartMode = launchConsole ? AttachExternal : sp.startMode; m_effectiveStartMode = launchConsole ? AttachExternal : sp.startMode;
const bool ok = launchConsole ? const bool ok = launchConsole ?
startConsole(startParameters(), &errorMessage) : startConsole(startParameters(), &errorMessage) :
...@@ -668,14 +663,18 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa ...@@ -668,14 +663,18 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
<< QLatin1String(".idle_cmd ") + QString::fromLatin1(m_extensionCommandPrefixBA) + QLatin1String("idle"); << QLatin1String(".idle_cmd ") + QString::fromLatin1(m_extensionCommandPrefixBA) + QLatin1String("idle");
if (sp.useTerminal) // Separate console if (sp.useTerminal) // Separate console
arguments << QLatin1String("-2"); arguments << QLatin1String("-2");
if (m_options->ignoreFirstChanceAccessViolation) if (debuggerCore()->boolSetting(IgnoreFirstChanceAccessViolation))
arguments << QLatin1String("-x"); arguments << QLatin1String("-x");
if (!m_options->symbolPaths.isEmpty())
arguments << QLatin1String("-y") << m_options->symbolPaths.join(QString(QLatin1Char(';'))); const QStringList &symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths);
if (!m_options->sourcePaths.isEmpty()) if (!symbolPaths.isEmpty())
arguments << QLatin1String("-srcpath") << m_options->sourcePaths.join(QString(QLatin1Char(';'))); arguments << QLatin1String("-y") << symbolPaths.join(QString(QLatin1Char(';')));
const QStringList &sourcePaths = debuggerCore()->stringListSetting(CdbSourcePaths);
if (!sourcePaths.isEmpty())
arguments << QLatin1String("-srcpath") << sourcePaths.join(QString(QLatin1Char(';')));
// Compile argument string preserving quotes // Compile argument string preserving quotes
QString nativeArguments = m_options->additionalArguments; QString nativeArguments = debuggerCore()->stringSetting(CdbAdditionalArguments);
switch (sp.startMode) { switch (sp.startMode) {
case StartInternal: case StartInternal:
case StartExternal: case StartExternal:
...@@ -692,7 +691,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa ...@@ -692,7 +691,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
if (sp.startMode == AttachCrashedExternal) { if (sp.startMode == AttachCrashedExternal) {
arguments << QLatin1String("-e") << sp.crashParameter << QLatin1String("-g"); arguments << QLatin1String("-e") << sp.crashParameter << QLatin1String("-g");
} else { } else {
if (isCreatorConsole(startParameters(), *m_options)) if (isCreatorConsole(startParameters()))
arguments << QLatin1String("-pr") << QLatin1String("-pb"); arguments << QLatin1String("-pr") << QLatin1String("-pb");
} }
break; break;
...@@ -808,25 +807,21 @@ void CdbEngine::runEngine() ...@@ -808,25 +807,21 @@ void CdbEngine::runEngine()
{ {
if (debug) if (debug)
qDebug("runEngine"); qDebug("runEngine");
foreach (const QString &breakEvent, m_options->breakEvents)
postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0); const QStringList &breakEvents =
debuggerCore()->stringListSetting(CdbBreakEvents);
foreach (const QString &breakEvent, breakEvents)
postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0);
// Break functions: each function must be fully qualified, // Break functions: each function must be fully qualified,
// else the debugger will slow down considerably. // else the debugger will slow down considerably.
foreach (const QString &breakFunctionS, m_options->breakFunctions) { if (debuggerCore()->boolSetting(CdbBreakOnCrtDbgReport)) {
const QByteArray breakFunction = breakFunctionS.toLatin1(); const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor());
if (breakFunction == CdbOptions::crtDbgReport) { const QByteArray debugModule = module + 'D';
// CrtDbgReport(): Add MSVC runtime (debug, release) const QByteArray wideFunc = CdbOptionsPage::crtDbgReport + 'W';
// and stop at Wide character version as well postCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module), 0);
const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor()); postCommand(breakAtFunctionCommand(wideFunc, module), 0);
const QByteArray debugModule = module + 'D'; postCommand(breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule), 0);
const QByteArray wideFunc = breakFunction + 'W'; postCommand(breakAtFunctionCommand(wideFunc, debugModule), 0);
postCommand(breakAtFunctionCommand(breakFunction, module), 0);
postCommand(breakAtFunctionCommand(wideFunc, module), 0);
postCommand(breakAtFunctionCommand(breakFunction, debugModule), 0);
postCommand(breakAtFunctionCommand(wideFunc, debugModule), 0);
} else {
postCommand(breakAtFunctionCommand(breakFunction), 0);
}
} }
if (debuggerCore()->boolSetting(BreakOnWarning)) { if (debuggerCore()->boolSetting(BreakOnWarning)) {
postCommand("bm /( QtCored4!qWarning", 0); // 'bm': All overloads. postCommand("bm /( QtCored4!qWarning", 0); // 'bm': All overloads.
...@@ -2785,7 +2780,7 @@ void CdbEngine::attemptBreakpointSynchronization() ...@@ -2785,7 +2780,7 @@ void CdbEngine::attemptBreakpointSynchronization()
switch (handler->state(id)) { switch (handler->state(id)) {
case BreakpointInsertRequested: case BreakpointInsertRequested:
if (parameters.type == BreakpointByFileAndLine if (parameters.type == BreakpointByFileAndLine
&& m_options->breakpointCorrection) { && debuggerCore()->boolSetting(CdbBreakPointCorrection)) {
if (lineCorrection.isNull()) if (lineCorrection.isNull())
lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(), lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(),
CppTools::CppModelManagerInterface::instance()->workingCopy())); CppTools::CppModelManagerInterface::instance()->workingCopy()));
......
...@@ -47,7 +47,6 @@ namespace Internal { ...@@ -47,7 +47,6 @@ namespace Internal {
class DisassemblerAgent; class DisassemblerAgent;
struct CdbBuiltinCommand; struct CdbBuiltinCommand;
struct CdbExtensionCommand; struct CdbExtensionCommand;
struct CdbOptions;
struct MemoryViewCookie; struct MemoryViewCookie;
class ByteArrayInputStream; class ByteArrayInputStream;
class GdbMi; class GdbMi;
...@@ -57,8 +56,6 @@ class CdbEngine : public Debugger::DebuggerEngine ...@@ -57,8 +56,6 @@ class CdbEngine : public Debugger::DebuggerEngine
Q_OBJECT Q_OBJECT
public: public:
typedef QSharedPointer<CdbOptions> OptionsPtr;
enum CommandFlags { QuietCommand = 0x1 }; enum CommandFlags { QuietCommand = 0x1 };
// Flag bits for a sequence of commands // Flag bits for a sequence of commands
enum CommandSequenceFlags { enum CommandSequenceFlags {
...@@ -74,7 +71,7 @@ public: ...@@ -74,7 +71,7 @@ public:
typedef void (CdbEngine::*BuiltinCommandHandler)(const CdbBuiltinCommandPtr &); typedef void (CdbEngine::*BuiltinCommandHandler)(const CdbBuiltinCommandPtr &);
typedef void (CdbEngine::*ExtensionCommandHandler)(const CdbExtensionCommandPtr &); typedef void (CdbEngine::*ExtensionCommandHandler)(const CdbExtensionCommandPtr &);
CdbEngine(const DebuggerStartParameters &sp, const OptionsPtr &options); CdbEngine(const DebuggerStartParameters &sp);
~CdbEngine(); ~CdbEngine();
// 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.
...@@ -247,7 +244,6 @@ private: ...@@ -247,7 +244,6 @@ private:
const QByteArray m_creatorExtPrefix; const QByteArray m_creatorExtPrefix;
const QByteArray m_tokenPrefix; const QByteArray m_tokenPrefix;
const OptionsPtr m_options;
QProcess m_process; QProcess m_process;
QScopedPointer<Utils::ConsoleProcess> m_consoleStub; QScopedPointer<Utils::ConsoleProcess> m_consoleStub;
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "cdboptions.h"
#include <QSettings>
static const char settingsGroupC[] = "CDB2";
static const char symbolPathsKeyC[] = "SymbolPaths";
static const char sourcePathsKeyC[] = "SourcePaths";
static const char breakEventKeyC[] = "BreakEvent";
static const char breakFunctionsKeyC[] = "BreakFunctions";
static const char additionalArgumentsKeyC[] = "AdditionalArguments";
static const char cdbConsoleKeyC[] = "CDB_Console";
static const char breakpointCorrectionKeyC[] = "BreakpointCorrection";
static const char ignoreFirstChanceAccessViolationKeyC[] = "IgnoreFirstChanceAccessViolation";
namespace Debugger {
namespace Internal {
const char *CdbOptions::crtDbgReport = "CrtDbgReport";
CdbOptions::CdbOptions()
: cdbConsole(false)
, breakpointCorrection(true)
, ignoreFirstChanceAccessViolation(false)
{
}
QString CdbOptions::settingsGroup()
{
return QLatin1String(settingsGroupC);
}
void CdbOptions::clear()
{
symbolPaths.clear();
sourcePaths.clear();
breakpointCorrection = true;
cdbConsole = ignoreFirstChanceAccessViolation = false;
breakEvents.clear();
breakFunctions.clear();
}
QStringList CdbOptions::oldEngineSymbolPaths(const QSettings *s)
{
return s->value(QLatin1String("CDB/SymbolPaths")).toStringList();
}
void CdbOptions::fromSettings(QSettings *s)
{
clear();
const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/');
additionalArguments = s->value(keyRoot + QLatin1String(additionalArgumentsKeyC), QString()).toString();
symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList();
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList();
breakFunctions = s->value(keyRoot + QLatin1String(breakFunctionsKeyC), QStringList()).toStringList();
cdbConsole = s->value(keyRoot + QLatin1String(cdbConsoleKeyC), QVariant(false)).toBool();
breakpointCorrection = s->value(keyRoot + QLatin1String(breakpointCorrectionKeyC), QVariant(true)).toBool();
ignoreFirstChanceAccessViolation = s->value(keyRoot + QLatin1String(ignoreFirstChanceAccessViolationKeyC), false).toBool();
}
void CdbOptions::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths);
s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths);
s->setValue(QLatin1String(breakEventKeyC), breakEvents);
s->setValue(QLatin1String(breakFunctionsKeyC), breakFunctions);
s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments);
s->setValue(QLatin1String(cdbConsoleKeyC), QVariant(cdbConsole));
s->setValue(QLatin1String(breakpointCorrectionKeyC), QVariant(breakpointCorrection));
s->setValue(QLatin1String(ignoreFirstChanceAccessViolationKeyC), QVariant(ignoreFirstChanceAccessViolation));
s->endGroup();
}
bool CdbOptions::equals(const CdbOptions &rhs) const
{
return cdbConsole == rhs.cdbConsole
&& breakpointCorrection == rhs.breakpointCorrection
&& ignoreFirstChanceAccessViolation == rhs.ignoreFirstChanceAccessViolation
&& additionalArguments == rhs.additionalArguments
&& symbolPaths == rhs.symbolPaths
&& sourcePaths == rhs.sourcePaths
&& breakEvents == rhs.breakEvents
&& breakFunctions == rhs.breakFunctions;
}
} // namespace Internal
} // namespace Debugger
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CDBOPTIONS_H
#define CDBOPTIONS_H
#include <QStringList>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Debugger {
namespace Internal {
struct CdbOptions
{
public:
CdbOptions();
void clear();
void fromSettings(QSettings *s); // Writes parameters on first-time autodetect
void toSettings(QSettings *s) const;
bool equals(const CdbOptions &rhs) const;
static QString settingsGroup();
static QStringList oldEngineSymbolPaths(const QSettings *s);
QString additionalArguments;
QStringList symbolPaths;
QStringList sourcePaths;
// Events to break on (Command 'sxe' with abbreviation and optional parameter)
QStringList breakEvents;
QStringList breakFunctions;
// Launch CDB's own console instead of Qt Creator's
bool cdbConsole;
// Perform code-model based correction of breakpoint location.
bool breakpointCorrection;
// Add -x to command line.
bool ignoreFirstChanceAccessViolation;
static const char *crtDbgReport;
};
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 // CDBOPTIONS_H
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "cdboptionspage.h" #include "cdboptionspage.h"
#include "commonoptionspage.h" #include "commonoptionspage.h"
#include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerinternalconstants.h" #include "debuggerinternalconstants.h"
#include "cdbengine.h" #include "cdbengine.h"
#include "cdbsymbolpathlisteditor.h" #include "cdbsymbolpathlisteditor.h"
...@@ -41,6 +43,8 @@ ...@@ -41,6 +43,8 @@
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
const char *CdbOptionsPage::crtDbgReport = "CrtDbgReport";
struct EventsDescription { struct EventsDescription {
const char *abbreviation; const char *abbreviation;
bool hasParameter; bool hasParameter;
...@@ -157,8 +161,6 @@ QStringList CdbBreakEventWidget::breakEvents() const ...@@ -157,8 +161,6 @@ QStringList CdbBreakEventWidget::breakEvents() const
CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_breakEventWidget(new CdbBreakEventWidget) , m_breakEventWidget(new CdbBreakEventWidget)
, m_symbolPathListEditor(new CdbSymbolPathListEditor)
, m_sourcePathListEditor(new Utils::PathListEditor)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
// Squeeze the groupbox layouts vertically to // Squeeze the groupbox layouts vertically to
...@@ -175,40 +177,25 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) ...@@ -175,40 +177,25 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent)
eventLayout->addWidget(m_breakEventWidget); eventLayout->addWidget(m_breakEventWidget);
m_ui.eventGroupBox->setLayout(eventLayout); m_ui.eventGroupBox->setLayout(eventLayout);
m_ui.breakCrtDbgReportCheckBox m_ui.breakCrtDbgReportCheckBox
->setText(CommonOptionsPage::msgSetBreakpointAtFunction(CdbOptions::crtDbgReport)); ->setText(CommonOptionsPage::msgSetBreakpointAtFunction(CdbOptionsPage::crtDbgReport));
const QString hint = tr("This is useful to catch runtime error messages, for example caused by assert()."); const QString hint = tr("This is useful to catch runtime error messages, for example caused by assert().");
m_ui.breakCrtDbgReportCheckBox m_ui.breakCrtDbgReportCheckBox
->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptions::crtDbgReport, hint)); ->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint));
m_ui.symbolPathsGroupBox->layout()->addWidget(m_symbolPathListEditor); DebuggerCore *dc = debuggerCore();
m_ui.sourcePathsGroupBox->layout()->addWidget(m_sourcePathListEditor); group.insert(dc->action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit);
} group.insert(dc->action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox);
group.insert(dc->action(UseCdbConsole), m_ui.consoleCheckBox);
group.insert(dc->action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox);
group.insert(dc->action(IgnoreFirstChanceAccessViolation),
m_ui.ignoreFirstChanceAccessViolationCheckBox);
void CdbOptionsPageWidget::setOptions(CdbOptions &o) m_breakEventWidget->setBreakEvents(dc->stringListSetting(CdbBreakEvents));
{
m_ui.additionalArgumentsLineEdit->setText(o.additionalArguments);
m_symbolPathListEditor->setPathList(o.symbolPaths);
m_sourcePathListEditor->setPathList(o.sourcePaths);
m_ui.ignoreFirstChanceAccessViolationCheckBox->setChecked(o.ignoreFirstChanceAccessViolation);
m_breakEventWidget->setBreakEvents(o.breakEvents);
m_ui.consoleCheckBox->setChecked(o.cdbConsole);
m_ui.breakpointCorrectionCheckBox->setChecked(o.breakpointCorrection);
m_ui.breakCrtDbgReportCheckBox->setChecked(o.breakFunctions.contains(QLatin1String(CdbOptions::crtDbgReport)));
} }
CdbOptions CdbOptionsPageWidget::options() const QStringList CdbOptionsPageWidget::breakEvents() const
{ {
CdbOptions rc; return m_breakEventWidget->breakEvents();
rc.additionalArguments = m_ui.additionalArgumentsLineEdit->text().trimmed();
rc.symbolPaths = m_symbolPathListEditor->pathList();
rc.sourcePaths = m_sourcePathListEditor->pathList();
rc.ignoreFirstChanceAccessViolation = m_ui.ignoreFirstChanceAccessViolationCheckBox->isChecked();
rc.breakEvents = m_breakEventWidget->breakEvents();
rc.cdbConsole = m_ui.consoleCheckBox->isChecked();
rc.breakpointCorrection = m_ui.breakpointCorrectionCheckBox->isChecked();
if (m_ui.breakCrtDbgReportCheckBox->isChecked())
rc.breakFunctions.push_back(QLatin1String(CdbOptions::crtDbgReport));
return rc;
} }
static QString stripColon(QString s) static QString stripColon(QString s)
...@@ -222,24 +209,15 @@ static QString stripColon(QString s) ...@@ -222,24 +209,15 @@ static QString stripColon(QString s)
QString CdbOptionsPageWidget::searchKeywords() const QString CdbOptionsPageWidget::searchKeywords() const
{ {
QString rc; QString rc;
QTextStream(&rc) QTextStream(&rc) << stripColon(m_ui.additionalArgumentsLabel->text());
<< stripColon(m_ui.additionalArgumentsLabel->text()) << ' '
<< m_ui.symbolPathsGroupBox->title() << ' '