Debugger: Aspectify settings

Change-Id: I527be79965250b82a0928171b17aa93bac9fa2a0
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-03-01 08:59:44 +01:00
parent 2252b22b10
commit 93a5803956
38 changed files with 1019 additions and 1544 deletions

View File

@@ -17,7 +17,6 @@ add_qtc_plugin(Debugger
breakpoint.cpp breakpoint.h breakpoint.cpp breakpoint.h
cdb/cdbengine.cpp cdb/cdbengine.h cdb/cdbengine.cpp cdb/cdbengine.h
cdb/cdboptionspage.cpp cdb/cdboptionspage.h cdb/cdboptionspage.cpp cdb/cdboptionspage.h
cdb/cdboptionspagewidget.ui
cdb/cdbparsehelpers.cpp cdb/cdbparsehelpers.h cdb/cdbparsehelpers.cpp cdb/cdbparsehelpers.h
cdb/stringinputstream.cpp cdb/stringinputstream.h cdb/stringinputstream.cpp cdb/stringinputstream.h
commonoptionspage.cpp commonoptionspage.h commonoptionspage.cpp commonoptionspage.h

View File

@@ -51,7 +51,6 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#if USE_BREAK_MODEL_TEST #if USE_BREAK_MODEL_TEST
@@ -1121,7 +1120,7 @@ QVariant BreakpointItem::data(int column, int role) const
break; break;
} }
if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInBreakpointsView)) if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInBreakpointsView.value())
return toolTip(); return toolTip();
return QVariant(); return QVariant();
@@ -1698,8 +1697,8 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(UseToolTipsInBreakpointsView)->action()); menu->addAction(debuggerSettings()->useToolTipsInBreakpointsView.action());
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
@@ -2225,7 +2224,7 @@ QVariant GlobalBreakpointItem::data(int column, int role) const
break; break;
} }
if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInBreakpointsView)) if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInBreakpointsView.value())
return toolTip(); return toolTip();
return QVariant(); return QVariant();
@@ -2502,7 +2501,7 @@ void BreakpointManager::toggleBreakpoint(const ContextData &location, const QStr
BreakpointParameters data; BreakpointParameters data;
if (location.type == LocationByFile) { if (location.type == LocationByFile) {
data.type = BreakpointByFileAndLine; data.type = BreakpointByFileAndLine;
if (boolSetting(BreakpointsFullPathByDefault)) if (debuggerSettings()->breakpointsFullPathByDefault.value())
data.pathUsage = BreakpointUseFullPath; data.pathUsage = BreakpointUseFullPath;
data.tracepoint = !tracePointMessage.isEmpty(); data.tracepoint = !tracePointMessage.isEmpty();
data.message = tracePointMessage; data.message = tracePointMessage;
@@ -2684,8 +2683,8 @@ bool BreakpointManager::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(UseToolTipsInBreakpointsView)->action()); menu->addAction(debuggerSettings()->useToolTipsInBreakpointsView.action());
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());

View File

@@ -7,6 +7,3 @@ SOURCES += $$PWD/cdbengine.cpp \
cdb/cdbparsehelpers.cpp \ cdb/cdbparsehelpers.cpp \
cdb/cdboptionspage.cpp \ cdb/cdboptionspage.cpp \
cdb/stringinputstream.cpp cdb/stringinputstream.cpp
FORMS += cdb/cdboptionspagewidget.ui

View File

@@ -64,7 +64,6 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/savedaction.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/winutils.h> #include <utils/winutils.h>
@@ -204,7 +203,8 @@ CdbEngine::CdbEngine() :
wh->addTypeFormats("QImage", imageFormats); wh->addTypeFormats("QImage", imageFormats);
wh->addTypeFormats("QImage *", imageFormats); wh->addTypeFormats("QImage *", imageFormats);
connect(action(CreateFullBacktrace)->action(), &QAction::triggered, DebuggerSettings *s = debuggerSettings();
connect(s->createFullBacktrace.action(), &QAction::triggered,
this, &CdbEngine::createFullBacktrace); this, &CdbEngine::createFullBacktrace);
connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &CdbEngine::processFinished); this, &CdbEngine::processFinished);
@@ -213,10 +213,10 @@ CdbEngine::CdbEngine() :
this, &CdbEngine::readyReadStandardOut); this, &CdbEngine::readyReadStandardOut);
connect(&m_process, &QProcess::readyReadStandardError, connect(&m_process, &QProcess::readyReadStandardError,
this, &CdbEngine::readyReadStandardOut); this, &CdbEngine::readyReadStandardOut);
connect(action(UseDebuggingHelpers), &SavedAction::valueChanged, connect(&s->useDebuggingHelpers, &BaseAspect::changed,
this, &CdbEngine::updateLocals); this, &CdbEngine::updateLocals);
if (action(UseCodeModel)->action()->isChecked()) if (s->useCodeModel.value())
m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot(); m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot();
} }
@@ -389,16 +389,17 @@ void CdbEngine::setupEngine()
if (sp.useTerminal) // Separate console if (sp.useTerminal) // Separate console
debugger.addArg("-2"); debugger.addArg("-2");
if (boolSetting(IgnoreFirstChanceAccessViolation)) const DebuggerSettings &s = *debuggerSettings();
if (s.ignoreFirstChanceAccessViolation.value())
debugger.addArg("-x"); debugger.addArg("-x");
const QStringList &sourcePaths = stringListSetting(CdbSourcePaths); const QStringList &sourcePaths = s.cdbSourcePaths.value();
if (!sourcePaths.isEmpty()) if (!sourcePaths.isEmpty())
debugger.addArgs({"-srcpath", sourcePaths.join(';')}); debugger.addArgs({"-srcpath", sourcePaths.join(';')});
debugger.addArgs({"-y", QChar('"') + stringListSetting(CdbSymbolPaths).join(';') + '"'}); debugger.addArgs({"-y", QChar('"') + s.cdbSymbolPaths.value().join(';') + '"'});
debugger.addArgs(expand(stringSetting(CdbAdditionalArguments)), CommandLine::Raw); debugger.addArgs(expand(s.cdbAdditionalArguments.value()), CommandLine::Raw);
switch (sp.startMode) { switch (sp.startMode) {
case StartInternal: case StartInternal:
@@ -500,7 +501,8 @@ void CdbEngine::handleInitialSessionIdle()
// Take ownership of the breakpoint. Requests insertion. TODO: Cpp only? // Take ownership of the breakpoint. Requests insertion. TODO: Cpp only?
BreakpointManager::claimBreakpointsForEngine(this); BreakpointManager::claimBreakpointsForEngine(this);
QStringList symbolPaths = stringListSetting(CdbSymbolPaths); const DebuggerSettings &s = *debuggerSettings();
QStringList symbolPaths = s.cdbSymbolPaths.value();
QString symbolPath = rp.inferior.environment.expandedValueForKey("_NT_ALT_SYMBOL_PATH"); QString symbolPath = rp.inferior.environment.expandedValueForKey("_NT_ALT_SYMBOL_PATH");
if (!symbolPath.isEmpty()) if (!symbolPath.isEmpty())
symbolPaths += symbolPath; symbolPaths += symbolPath;
@@ -514,13 +516,13 @@ void CdbEngine::handleInitialSessionIdle()
runCommand({"sxn ibp", NoFlags}); // Do not break on initial breakpoints. runCommand({"sxn ibp", NoFlags}); // Do not break on initial breakpoints.
runCommand({".asm source_line", NoFlags}); // Source line in assembly runCommand({".asm source_line", NoFlags}); // Source line in assembly
runCommand({m_extensionCommandPrefix runCommand({m_extensionCommandPrefix
+ "setparameter maxStringLength=" + action(MaximalStringLength)->value().toString() + "setparameter maxStringLength=" + QString::number(s.maximalStringLength.value())
+ " maxStackDepth=" + action(MaximalStackDepth)->value().toString() + " maxStackDepth=" + QString::number(s.maximalStackDepth.value())
+ " firstChance=" + (action(FirstChanceExceptionTaskEntry)->value().toBool() ? "1" : "0") + " firstChance=" + (s.firstChanceExceptionTaskEntry.value() ? "1" : "0")
+ " secondChance=" + (action(SecondChanceExceptionTaskEntry)->value().toBool() ? "1" : "0") + " secondChance=" + (s.secondChanceExceptionTaskEntry.value() ? "1" : "0")
, NoFlags}); , NoFlags});
if (boolSetting(CdbUsePythonDumper)) if (s.cdbUsePythonDumper.value())
runCommand({"print(sys.version)", ScriptCommand, CB(setupScripting)}); runCommand({"print(sys.version)", ScriptCommand, CB(setupScripting)});
runCommand({"pid", ExtensionCommand, [this](const DebuggerResponse &response) { runCommand({"pid", ExtensionCommand, [this](const DebuggerResponse &response) {
@@ -578,30 +580,30 @@ void CdbEngine::runEngine()
if (debug) if (debug)
qDebug("runEngine"); qDebug("runEngine");
const QStringList breakEvents = stringListSetting(CdbBreakEvents); const QStringList breakEvents = debuggerSettings()->cdbBreakEvents.value();
for (const QString &breakEvent : breakEvents) for (const QString &breakEvent : breakEvents)
runCommand({"sxe " + breakEvent, NoFlags}); runCommand({"sxe " + breakEvent, NoFlags});
// 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.
const auto cb = [this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); }; const auto cb = [this](const DebuggerResponse &r) { handleBreakInsert(r, Breakpoint()); };
if (boolSetting(CdbBreakOnCrtDbgReport)) { if (debuggerSettings()->cdbBreakOnCrtDbgReport.value()) {
Abi::OSFlavor flavor = runParameters().toolChainAbi.osFlavor(); Abi::OSFlavor flavor = runParameters().toolChainAbi.osFlavor();
// CrtDebugReport cannot be safely resolved for vc 19 // CrtDebugReport cannot be safely resolved for vc 19
if ((flavor > Abi::WindowsMsvc2005Flavor && flavor <= Abi::WindowsMsvc2013Flavor) || if ((flavor > Abi::WindowsMsvc2005Flavor && flavor <= Abi::WindowsMsvc2013Flavor) ||
flavor > Abi::WindowsMSysFlavor || flavor <= Abi::WindowsCEFlavor) { flavor > Abi::WindowsMSysFlavor || flavor <= Abi::WindowsCEFlavor) {
const QString module = msvcRunTime(flavor); const QString module = msvcRunTime(flavor);
const QString debugModule = module + 'D'; const QString debugModule = module + 'D';
const QString wideFunc = QString::fromLatin1(CdbOptionsPage::crtDbgReport).append('W'); const QString wideFunc = QString(Constants::CRT_DEBUG_REPORT).append('W');
runCommand({breakAtFunctionCommand(QLatin1String(CdbOptionsPage::crtDbgReport), module), BuiltinCommand, cb}); runCommand({breakAtFunctionCommand(Constants::CRT_DEBUG_REPORT, module), BuiltinCommand, cb});
runCommand({breakAtFunctionCommand(wideFunc, module), BuiltinCommand, cb}); runCommand({breakAtFunctionCommand(wideFunc, module), BuiltinCommand, cb});
runCommand({breakAtFunctionCommand(QLatin1String(CdbOptionsPage::crtDbgReport), debugModule), BuiltinCommand, cb}); runCommand({breakAtFunctionCommand(Constants::CRT_DEBUG_REPORT, debugModule), BuiltinCommand, cb});
} }
} }
// if (boolSetting(BreakOnWarning)) { // if (debuggerSettings()->breakOnWarning.value())) {
// runCommand({"bm /( QtCored4!qWarning", BuiltinCommand}); // 'bm': All overloads. // runCommand({"bm /( QtCored4!qWarning", BuiltinCommand}); // 'bm': All overloads.
// runCommand({"bm /( Qt5Cored!QMessageLogger::warning", BuiltinCommand}); // runCommand({"bm /( Qt5Cored!QMessageLogger::warning", BuiltinCommand});
// } // }
// if (boolSetting(BreakOnFatal)) { // if (debuggerSettion()->breakOnFatal.value()) {
// runCommand({"bm /( QtCored4!qFatal", BuiltinCommand}); // 'bm': All overloads. // runCommand({"bm /( QtCored4!qFatal", BuiltinCommand}); // 'bm': All overloads.
// runCommand({"bm /( Qt5Cored!QMessageLogger::fatal", BuiltinCommand}); // runCommand({"bm /( Qt5Cored!QMessageLogger::fatal", BuiltinCommand});
// } // }
@@ -1089,6 +1091,7 @@ void CdbEngine::activateFrame(int index)
void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
{ {
const DebuggerSettings &s = *debuggerSettings();
if (m_pythonVersion > 0x030000) { if (m_pythonVersion > 0x030000) {
watchHandler()->notifyUpdateStarted(updateParameters); watchHandler()->notifyUpdateStarted(updateParameters);
@@ -1098,21 +1101,21 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); cmd.arg("fancy", s.useDebuggingHelpers.value());
cmd.arg("autoderef", boolSetting(AutoDerefPointers)); cmd.arg("autoderef", s.autoDerefPointers.value());
cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("dyntype", s.useDynamicType.value());
cmd.arg("partialvar", updateParameters.partialVariable); cmd.arg("partialvar", updateParameters.partialVariable);
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames)); cmd.arg("qobjectnames", s.showQObjectNames.value());
cmd.arg("timestamps", boolSetting(LogTimeStamps)); cmd.arg("timestamps", s.logTimeStamps.value());
StackFrame frame = stackHandler()->currentFrame(); StackFrame frame = stackHandler()->currentFrame();
cmd.arg("context", frame.context); cmd.arg("context", frame.context);
cmd.arg("nativemixed", isNativeMixedActive()); cmd.arg("nativemixed", isNativeMixedActive());
cmd.arg("stringcutoff", action(MaximalStringLength)->value().toString()); cmd.arg("stringcutoff", s.maximalStringLength.value());
cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toString()); cmd.arg("displaystringlimit", s.displayStringLimit.value());
if (boolSetting(UseCodeModel)) { if (s.useCodeModel.value()) {
QStringList variables = getUninitializedVariables(m_codeModelSnapshot, QStringList variables = getUninitializedVariables(m_codeModelSnapshot,
frame.function, frame.file, frame.line); frame.function, frame.file, frame.line);
cmd.arg("uninitialized", variables); cmd.arg("uninitialized", variables);
@@ -1171,9 +1174,9 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
} }
} }
str << blankSeparator << "-v"; str << blankSeparator << "-v";
if (boolSetting(UseDebuggingHelpers)) if (s.useDebuggingHelpers.value())
str << blankSeparator << "-c"; str << blankSeparator << "-c";
if (boolSetting(SortStructMembers)) if (s.sortStructMembers.value())
str << blankSeparator << "-a"; str << blankSeparator << "-a";
const QString typeFormats = watchHandler()->typeFormatRequests(); const QString typeFormats = watchHandler()->typeFormatRequests();
if (!typeFormats.isEmpty()) if (!typeFormats.isEmpty())
@@ -1183,7 +1186,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
str << blankSeparator << "-I " << individualFormats; str << blankSeparator << "-I " << individualFormats;
// Uninitialized variables if desired. Quote as safeguard against shadowed // Uninitialized variables if desired. Quote as safeguard against shadowed
// variables in case of errors in uninitializedVariables(). // variables in case of errors in uninitializedVariables().
if (boolSetting(UseCodeModel)) { if (s.useCodeModel.value()) {
const QStringList variables = getUninitializedVariables(m_codeModelSnapshot, const QStringList variables = getUninitializedVariables(m_codeModelSnapshot,
frame.function, frame.file, frame.line); frame.function, frame.file, frame.line);
if (!variables.isEmpty()) { if (!variables.isEmpty()) {
@@ -2487,7 +2490,7 @@ void CdbEngine::insertBreakpoint(const Breakpoint &bp)
new BreakpointCorrectionContext(m_codeModelSnapshot, CppTools::CppModelManager::instance()->workingCopy())); new BreakpointCorrectionContext(m_codeModelSnapshot, CppTools::CppModelManager::instance()->workingCopy()));
if (!m_autoBreakPointCorrection if (!m_autoBreakPointCorrection
&& parameters.type == BreakpointByFileAndLine && parameters.type == BreakpointByFileAndLine
&& boolSetting(CdbBreakPointCorrection)) { && debuggerSettings()->cdbBreakPointCorrection.value()) {
response.lineNumber = int(lineCorrection->fixLineNumber(parameters.fileName.toString(), response.lineNumber = int(lineCorrection->fixLineNumber(parameters.fileName.toString(),
unsigned(parameters.lineNumber))); unsigned(parameters.lineNumber)));
QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, responseId); QString cmd = cdbAddBreakpointCommand(response, m_sourcePathMappings, responseId);
@@ -2759,13 +2762,13 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
runCommand({"print(dir())", ScriptCommand}); runCommand({"print(dir())", ScriptCommand});
runCommand({"theDumper = Dumper()", ScriptCommand}); runCommand({"theDumper = Dumper()", ScriptCommand});
const QString path = stringSetting(ExtraDumperFile); const QString path = debuggerSettings()->extraDumperFile.value();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && QFileInfo(path).isReadable()) {
DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand); DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand);
cmd.arg("path", path); cmd.arg("path", path);
runCommand(cmd); runCommand(cmd);
} }
const QString commands = stringSetting(ExtraDumperCommands); const QString commands = debuggerSettings()->extraDumperCommands.value();
if (!commands.isEmpty()) { if (!commands.isEmpty()) {
for (const auto &command : commands.split('\n', Qt::SkipEmptyParts)) for (const auto &command : commands.split('\n', Qt::SkipEmptyParts))
runCommand({command, ScriptCommand}); runCommand({command, ScriptCommand});

View File

@@ -26,7 +26,7 @@
#include "cdboptionspage.h" #include "cdboptionspage.h"
#include "cdbengine.h" #include "cdbengine.h"
#include "ui_cdboptionspagewidget.h"
#include <debugger/commonoptionspage.h> #include <debugger/commonoptionspage.h>
#include <debugger/debuggeractions.h> #include <debugger/debuggeractions.h>
#include <debugger/debuggercore.h> #include <debugger/debuggercore.h>
@@ -35,16 +35,18 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/savedaction.h> #include <utils/aspects.h>
#include <utils/layoutbuilder.h>
#include <QDialogButtonBox> #include <QCheckBox>
#include <QFormLayout>
#include <QTextStream> #include <QTextStream>
using namespace Utils;
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;
@@ -192,56 +194,59 @@ private:
void apply() final; void apply() final;
void finish() final; void finish() final;
Utils::SavedActionSet m_group; Utils::AspectContainer &m_group = debuggerSettings()->page5;
Ui::CdbOptionsPageWidget m_ui;
CdbBreakEventWidget *m_breakEventWidget; CdbBreakEventWidget *m_breakEventWidget;
}; };
CdbOptionsPageWidget::CdbOptionsPageWidget() CdbOptionsPageWidget::CdbOptionsPageWidget()
: m_breakEventWidget(new CdbBreakEventWidget) : m_breakEventWidget(new CdbBreakEventWidget)
{ {
m_ui.setupUi(this); using namespace Layouting;
// Squeeze the groupbox layouts vertically to DebuggerSettings &s = *debuggerSettings();
// accommodate all options. This page only shows on
// Windows, which has large margins by default.
int left, top, right, bottom; m_breakEventWidget->setBreakEvents(debuggerSettings()->cdbBreakEvents.value());
layout()->getContentsMargins(&left, &top, &right, &bottom);
const QMargins margins(left, top / 3, right, bottom / 3);
m_ui.startupFormLayout->setContentsMargins(margins); Column {
Row {
Group {
Title(tr("Startup")),
s.cdbAdditionalArguments,
s.useCdbConsole,
Stretch()
},
auto eventLayout = new QVBoxLayout; Group {
eventLayout->setContentsMargins(margins); Title(tr("Various")),
eventLayout->addWidget(m_breakEventWidget); s.ignoreFirstChanceAccessViolation,
m_ui.eventGroupBox->setLayout(eventLayout); s.cdbBreakOnCrtDbgReport,
m_ui.breakCrtDbgReportCheckBox s.cdbBreakPointCorrection,
->setText(CommonOptionsPage::msgSetBreakpointAtFunction(CdbOptionsPage::crtDbgReport)); s.cdbUsePythonDumper
const QString hint = tr("This is useful to catch runtime error messages, for example caused by assert()."); }
m_ui.breakCrtDbgReportCheckBox },
->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint));
m_group.insert(action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit); Group {
m_group.insert(action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox); Title(tr("Break on")),
m_group.insert(action(UseCdbConsole), m_ui.consoleCheckBox); m_breakEventWidget
m_group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox); },
m_group.insert(action(CdbUsePythonDumper), m_ui.usePythonDumper);
m_group.insert(action(FirstChanceExceptionTaskEntry), m_ui.firstChance);
m_group.insert(action(SecondChanceExceptionTaskEntry), m_ui.secondChance);
m_group.insert(action(IgnoreFirstChanceAccessViolation),
m_ui.ignoreFirstChanceAccessViolationCheckBox);
m_breakEventWidget->setBreakEvents(stringListSetting(CdbBreakEvents)); Group {
Title(tr("Add Exceptions to Issues View")),
s.firstChanceExceptionTaskEntry,
s.secondChanceExceptionTaskEntry
}
}.attachTo(this);
} }
void CdbOptionsPageWidget::apply() void CdbOptionsPageWidget::apply()
{ {
m_group.apply(Core::ICore::settings()); m_group.apply(); m_group.writeSettings(Core::ICore::settings());
action(CdbBreakEvents)->setValue(m_breakEventWidget->breakEvents()); debuggerSettings()->cdbBreakEvents.setValue(m_breakEventWidget->breakEvents());
} }
void CdbOptionsPageWidget::finish() void CdbOptionsPageWidget::finish()
{ {
m_breakEventWidget->setBreakEvents(debuggerSettings()->cdbBreakEvents.value());
m_group.finish(); m_group.finish();
} }
@@ -263,33 +268,40 @@ class CdbPathsPageWidget : public Core::IOptionsPageWidget
public: public:
CdbPathsPageWidget(); CdbPathsPageWidget();
void apply() final { m_group.apply(Core::ICore::settings()); } void apply() final;
void finish() final { m_group.finish(); } void finish() final;
Utils::SavedActionSet m_group; AspectContainer &m_group = debuggerSettings()->page6;
private:
PathListEditor *m_symbolPaths = nullptr;
PathListEditor *m_sourcePaths = nullptr;
}; };
CdbPathsPageWidget::CdbPathsPageWidget() CdbPathsPageWidget::CdbPathsPageWidget()
: m_symbolPaths(new CdbSymbolPathListEditor)
, m_sourcePaths(new PathListEditor)
{ {
auto layout = new QVBoxLayout(this); using namespace Layouting;
auto gbSymbolPath = new QGroupBox(tr("Symbol Paths"), this); finish();
auto gbSymbolPathLayout = new QVBoxLayout(gbSymbolPath); Column {
Group { Title(tr("Symbol Paths")), m_symbolPaths },
Group { Title(tr("Source Paths")), m_sourcePaths }
}.attachTo(this, false);
}
auto symbolPathListEditor = new CdbSymbolPathListEditor(gbSymbolPath); void CdbPathsPageWidget::apply()
gbSymbolPathLayout->addWidget(symbolPathListEditor); {
debuggerSettings()->cdbSymbolPaths.setValue(m_symbolPaths->pathList());
debuggerSettings()->cdbSourcePaths.setValue(m_sourcePaths->pathList());
m_group.writeSettings(Core::ICore::settings());
}
auto gbSourcePath = new QGroupBox(tr("Source Paths"), this); void CdbPathsPageWidget::finish()
{
auto gbSourcePathLayout = new QVBoxLayout(gbSourcePath); m_symbolPaths->setPathList(debuggerSettings()->cdbSymbolPaths.value());
auto sourcePathListEditor = new Utils::PathListEditor(gbSourcePath); m_sourcePaths->setPathList(debuggerSettings()->cdbSourcePaths.value());
gbSourcePathLayout->addWidget(sourcePathListEditor);
layout->addWidget(gbSymbolPath);
layout->addWidget(gbSourcePath);
m_group.insert(action(CdbSymbolPaths), symbolPathListEditor);
m_group.insert(action(CdbSourcePaths), sourcePathListEditor);
} }
CdbPathsPage::CdbPathsPage() CdbPathsPage::CdbPathsPage()

View File

@@ -34,8 +34,6 @@ class CdbOptionsPage final : public Core::IOptionsPage
{ {
public: public:
CdbOptionsPage(); CdbOptionsPage();
static const char *crtDbgReport;
}; };
class CdbPathsPage final : public Core::IOptionsPage class CdbPathsPage final : public Core::IOptionsPage

View File

@@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Debugger::Internal::CdbOptionsPageWidget</class>
<widget class="QWidget" name="Debugger::Internal::CdbOptionsPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>807</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="cdbPathGroupBox">
<property name="title">
<string extracomment="Placeholder">Startup</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="startupFormLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="additionalArgumentsLabel">
<property name="text">
<string>Additional &amp;arguments:</string>
</property>
<property name="buddy">
<cstring>additionalArgumentsLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="additionalArgumentsLineEdit"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="consoleCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Uses CDB's native console for console applications. This overrides the setting in Environment &gt; System. The native console does not prompt on application exit. It is suitable for diagnosing cases in which the application does not start up properly in the configured console and the subsequent attach fails.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use CDB &amp;console</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="eventGroupBox">
<property name="title">
<string>Break on:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="variousGroupBox">
<property name="title">
<string>Various</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="ignoreFirstChanceAccessViolationCheckBox">
<property name="text">
<string>Ignore first chance access violations</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="breakCrtDbgReportCheckBox"/>
</item>
<item>
<widget class="QCheckBox" name="breakpointCorrectionCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Attempts to correct the location of a breakpoint based on file and line number should it be in a comment or in a line for which no code is generated. The correction is based on the code model.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Correct breakpoint location</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="usePythonDumper">
<property name="text">
<string>Use Python dumper</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="exceptions">
<property name="title">
<string>Add Exceptions to Issues View</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="firstChance">
<property name="text">
<string>First chance exceptions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="secondChance">
<property name="text">
<string>Second chance exceptions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -35,18 +35,13 @@
#include <app/app_version.h> #include <app/app_version.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/variablechooser.h> #include <utils/variablechooser.h>
#include <QCheckBox>
#include <QCoreApplication> #include <QCoreApplication>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QSpinBox>
#include <QTextEdit>
#include <QTextStream> #include <QTextStream>
using namespace Core; using namespace Core;
@@ -54,6 +49,9 @@ using namespace Debugger::Constants;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace Utils {
}
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -70,169 +68,57 @@ class CommonOptionsPageWidget : public Core::IOptionsPageWidget
public: public:
explicit CommonOptionsPageWidget() explicit CommonOptionsPageWidget()
{ {
auto behaviorBox = new QGroupBox(this);
behaviorBox->setTitle(tr("Behavior"));
auto checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox);
checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views"));
auto checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox);
checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes."));
checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor"));
auto checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox);
checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging"));
auto checkBoxUseAnnotationsInMainEditor = new QCheckBox(behaviorBox);
checkBoxUseAnnotationsInMainEditor->setText(tr("Use annotations in main editor while debugging"));
QString t = tr("Stopping and stepping in the debugger "
"will automatically open views associated with the current location.") + '\n';
auto checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Closes automatically opened source views when the debugger exits."));
auto checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox);
checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit"));
checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Closes automatically opened memory views when the debugger exits."));
auto checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox);
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
auto checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox);
checkBoxBringToForegroundOnInterrrupt->setText(
tr("Bring %1 to foreground when application interrupts")
.arg(Core::Constants::IDE_DISPLAY_NAME));
auto checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox);
checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping."));
checkBoxShowQmlObjectTree->setText(tr("Show QML object tree"));
auto checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox);
checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB."));
checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path"));
auto checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox);
checkBoxRegisterForPostMortem->setToolTip(
tr("Registers %1 for debugging crashed applications.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
checkBoxRegisterForPostMortem->setText(
tr("Use %1 for post-mortem debugging")
.arg(Core::Constants::IDE_DISPLAY_NAME));
auto checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox);
checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds"));
checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger "
"on a binary with insufficient debug information."));
auto checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox);
checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping"));
checkBoxKeepEditorStationaryWhileStepping->setToolTip(tr("Scrolls the editor only when it is necessary "
"to keep the current line in view, "
"instead of keeping the next statement centered at "
"all times."));
auto labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox);
auto spinBoxMaximalStackDepth = new QSpinBox(behaviorBox);
spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>"));
spinBoxMaximalStackDepth->setMaximum(999);
spinBoxMaximalStackDepth->setSingleStep(5);
spinBoxMaximalStackDepth->setValue(10);
m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(this); m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(this);
auto horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(labelMaximalStackDepth);
horizontalLayout->addWidget(spinBoxMaximalStackDepth);
horizontalLayout->addStretch();
auto gridLayout = new QGridLayout(behaviorBox);
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
gridLayout->addWidget(checkBoxUseAnnotationsInMainEditor, 1, 0, 1, 1);
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 2, 0, 1, 1);
gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 3, 0, 1, 1);
gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 4, 0, 1, 1);
gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 5, 0, 1, 1);
gridLayout->addWidget(checkBoxBreakpointsFullPath, 6, 0, 1, 1);
gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 7, 0, 1, 1);
gridLayout->addLayout(horizontalLayout, 8, 0, 1, 2);
gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1);
gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1);
gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1);
gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1);
gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1);
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addWidget(behaviorBox);
verticalLayout->addWidget(m_sourceMappingWidget);
verticalLayout->addStretch();
m_group.insert(action(UseAlternatingRowColors),
checkBoxUseAlternatingRowColors);
m_group.insert(action(UseAnnotationsInMainEditor),
checkBoxUseAnnotationsInMainEditor);
m_group.insert(action(UseToolTipsInMainEditor),
checkBoxUseToolTipsInMainEditor);
m_group.insert(action(CloseSourceBuffersOnExit),
checkBoxCloseSourceBuffersOnExit);
m_group.insert(action(CloseMemoryBuffersOnExit),
checkBoxCloseMemoryBuffersOnExit);
m_group.insert(action(SwitchModeOnExit),
checkBoxSwitchModeOnExit);
m_group.insert(action(BreakpointsFullPathByDefault),
checkBoxBreakpointsFullPath);
m_group.insert(action(RaiseOnInterrupt),
checkBoxBringToForegroundOnInterrrupt);
m_group.insert(action(ShowQmlObjectTree),
checkBoxShowQmlObjectTree);
m_group.insert(action(WarnOnReleaseBuilds),
checkBoxWarnOnReleaseBuilds);
m_group.insert(action(StationaryEditorWhileStepping),
checkBoxKeepEditorStationaryWhileStepping);
m_group.insert(action(FontSizeFollowsEditor),
checkBoxFontSizeFollowsEditor);
m_group.insert(action(AutoDerefPointers), nullptr);
m_group.insert(action(UseToolTipsInLocalsView), nullptr);
m_group.insert(action(AlwaysAdjustColumnWidths), nullptr);
m_group.insert(action(UseToolTipsInBreakpointsView), nullptr);
m_group.insert(action(UseToolTipsInStackView), nullptr);
m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
m_group.insert(action(ShowStdNamespace), nullptr);
m_group.insert(action(ShowQtNamespace), nullptr);
m_group.insert(action(ShowQObjectNames), nullptr);
m_group.insert(action(SortStructMembers), nullptr);
m_group.insert(action(LogTimeStamps), nullptr);
m_group.insert(action(BreakOnThrow), nullptr);
m_group.insert(action(BreakOnCatch), nullptr);
if (HostOsInfo::isWindowsHost()) {
SavedAction *registerAction = action(RegisterForPostMortem);
m_group.insert(registerAction, checkBoxRegisterForPostMortem);
connect(registerAction->action(), &QAction::toggled,
checkBoxRegisterForPostMortem, &QAbstractButton::setChecked);
} else {
checkBoxRegisterForPostMortem->setVisible(false);
}
GlobalDebuggerOptions *options = Internal::globalDebuggerOptions(); GlobalDebuggerOptions *options = Internal::globalDebuggerOptions();
SourcePathMap allPathMap = options->sourcePathMap; SourcePathMap allPathMap = options->sourcePathMap;
for (const auto &regExpMap : qAsConst(options->sourcePathRegExpMap)) for (const auto &regExpMap : qAsConst(options->sourcePathRegExpMap))
allPathMap.insert(regExpMap.first.pattern(), regExpMap.second); allPathMap.insert(regExpMap.first.pattern(), regExpMap.second);
m_sourceMappingWidget->setSourcePathMap(allPathMap); m_sourceMappingWidget->setSourcePathMap(allPathMap);
DebuggerSettings &s = *debuggerSettings();
using namespace Layouting;
Column col1 {
s.useAlternatingRowColors,
s.useAnnotationsInMainEditor,
s.useToolTipsInMainEditor,
s.closeSourceBuffersOnExit,
s.closeMemoryBuffersOnExit,
s.raiseOnInterrupt,
s.breakpointsFullPathByDefault,
s.warnOnReleaseBuilds,
Row { s.maximalStackDepth, Stretch() }
};
Column col2 {
s.fontSizeFollowsEditor,
s.switchModeOnExit,
s.showQmlObjectTree,
s.stationaryEditorWhileStepping,
s.registerForPostMortem,
Stretch()
};
Column {
Group { Title("Behavior"), Row { col1, col2, Stretch() } },
m_sourceMappingWidget,
Stretch()
}.attachTo(this);
} }
void apply() final; void apply() final;
void finish() final { m_group.finish(); } void finish() final { m_group.finish(); }
private: private:
SavedActionSet m_group; AspectContainer &m_group = debuggerSettings()->page1;
DebuggerSourcePathMappingWidget *m_sourceMappingWidget = nullptr; DebuggerSourcePathMappingWidget *m_sourceMappingWidget = nullptr;
}; };
void CommonOptionsPageWidget::apply() void CommonOptionsPageWidget::apply()
{ {
m_group.apply(ICore::settings()); m_group.apply();
m_group.writeSettings(ICore::settings());
GlobalDebuggerOptions *options = Internal::globalDebuggerOptions(); GlobalDebuggerOptions *options = Internal::globalDebuggerOptions();
options->sourcePathMap.clear(); options->sourcePathMap.clear();
@@ -292,11 +178,10 @@ class LocalsAndExpressionsOptionsPageWidget : public IOptionsPageWidget
public: public:
LocalsAndExpressionsOptionsPageWidget() LocalsAndExpressionsOptionsPageWidget()
{ {
auto debuggingHelperGroupBox = new QGroupBox(this); using namespace Layouting;
debuggingHelperGroupBox->setTitle(tr("Use Debugging Helper")); DebuggerSettings &s = *debuggerSettings();
debuggingHelperGroupBox->setCheckable(true);
auto label = new QLabel(debuggingHelperGroupBox); auto label = new QLabel; //(useHelperGroup);
label->setTextFormat(Qt::AutoText); label->setTextFormat(Qt::AutoText);
label->setWordWrap(true); label->setWordWrap(true);
label->setText("<html><head/><body>\n<p>" label->setText("<html><head/><body>\n<p>"
@@ -305,97 +190,44 @@ public:
"std::map in the &quot;Locals&quot; and &quot;Expressions&quot; views.") "std::map in the &quot;Locals&quot; and &quot;Expressions&quot; views.")
+ "</p></body></html>"); + "</p></body></html>");
auto groupBoxCustomDumperCommands = new QGroupBox(debuggingHelperGroupBox); Column left {
groupBoxCustomDumperCommands->setTitle(tr("Debugging Helper Customization")); label,
groupBoxCustomDumperCommands->setToolTip("<html><head/><body><p>" s.useCodeModel,
+ tr("Python commands entered here will be executed after built-in " s.showThreadNames,
"debugging helpers have been loaded and fully initialized. You can " Group { Title(tr("Extra Debugging Helper")), s.extraDumperFile }
"load additional debugging helpers or modify existing ones here.") };
+ "</p></body></html>");
auto textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands); Group useHelper {
textEditCustomDumperCommands->setAcceptRichText(false); Row {
textEditCustomDumperCommands->setToolTip(groupBoxCustomDumperCommands->toolTip()); left,
Group { Title(tr("Debugging Helper Customization")), s.extraDumperCommands }
}
};
auto groupBoxExtraDumperFile = new QGroupBox(debuggingHelperGroupBox); Grid limits {
groupBoxExtraDumperFile->setTitle(tr("Extra Debugging Helpers")); s.maximalStringLength,
groupBoxExtraDumperFile->setToolTip(tr( Break(),
"Path to a Python file containing additional data dumpers.")); s.displayStringLimit
};
auto pathChooserExtraDumperFile = new Utils::PathChooser(groupBoxExtraDumperFile); Column {
pathChooserExtraDumperFile->setExpectedKind(Utils::PathChooser::File); s.useDebuggingHelpers,
useHelper,
auto checkBoxUseCodeModel = new QCheckBox(debuggingHelperGroupBox); Space(10),
auto checkBoxShowThreadNames = new QCheckBox(debuggingHelperGroupBox); s.showStdNamespace,
auto checkBoxShowStdNamespace = new QCheckBox(this); s.showQtNamespace,
auto checkBoxShowQtNamespace = new QCheckBox(this); s.showQObjectNames,
auto checkBoxShowQObjectNames = new QCheckBox(this); Space(10),
Row { limits, Stretch() },
auto spinBoxMaximalStringLength = new QSpinBox(this); Stretch()
spinBoxMaximalStringLength->setSpecialValueText(tr("<unlimited>")); }.attachTo(this);
spinBoxMaximalStringLength->setMaximum(10000000);
spinBoxMaximalStringLength->setSingleStep(1000);
spinBoxMaximalStringLength->setValue(10000);
auto spinBoxDisplayStringLimit = new QSpinBox(this);
spinBoxDisplayStringLimit->setSpecialValueText(tr("<unlimited>"));
spinBoxDisplayStringLimit->setMaximum(10000);
spinBoxDisplayStringLimit->setSingleStep(10);
spinBoxDisplayStringLimit->setValue(100);
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(textEditCustomDumperCommands);
chooser->addSupportedWidget(pathChooserExtraDumperFile->lineEdit());
auto gridLayout = new QGridLayout(debuggingHelperGroupBox);
gridLayout->addWidget(label, 0, 0, 1, 1);
gridLayout->addWidget(checkBoxUseCodeModel, 1, 0, 1, 1);
gridLayout->addWidget(checkBoxShowThreadNames, 2, 0, 1, 1);
gridLayout->addWidget(groupBoxExtraDumperFile, 3, 0, 1, 1);
gridLayout->addWidget(groupBoxCustomDumperCommands, 0, 1, 4, 1);
auto layout1 = new QFormLayout;
layout1->addItem(new QSpacerItem(10, 10));
layout1->addRow(checkBoxShowStdNamespace);
layout1->addRow(checkBoxShowQtNamespace);
layout1->addRow(checkBoxShowQObjectNames);
layout1->addItem(new QSpacerItem(10, 10));
layout1->addRow(tr("Maximum string length:"), spinBoxMaximalStringLength);
layout1->addRow(tr("Display string length:"), spinBoxDisplayStringLimit);
auto lowerLayout = new QHBoxLayout;
lowerLayout->addLayout(layout1);
lowerLayout->addStretch();
auto layout = new QVBoxLayout(this);
layout->addWidget(debuggingHelperGroupBox);
layout->addLayout(lowerLayout);
layout->addStretch();
auto customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);
auto extraDumperLayout = new QGridLayout(groupBoxExtraDumperFile);
extraDumperLayout->addWidget(pathChooserExtraDumperFile, 0, 0, 1, 1);
m_group.clear();
m_group.insert(action(UseDebuggingHelpers), debuggingHelperGroupBox);
m_group.insert(action(ExtraDumperFile), pathChooserExtraDumperFile);
m_group.insert(action(ExtraDumperCommands), textEditCustomDumperCommands);
m_group.insert(action(UseCodeModel), checkBoxUseCodeModel);
m_group.insert(action(ShowThreadNames), checkBoxShowThreadNames);
m_group.insert(action(ShowStdNamespace), checkBoxShowStdNamespace);
m_group.insert(action(ShowQtNamespace), checkBoxShowQtNamespace);
m_group.insert(action(ShowQObjectNames), checkBoxShowQObjectNames);
m_group.insert(action(DisplayStringLimit), spinBoxDisplayStringLimit);
m_group.insert(action(MaximalStringLength), spinBoxMaximalStringLength);
} }
void apply() final { m_group.apply(ICore::settings()); } void apply() final { m_group.apply(); m_group.writeSettings(ICore::settings()); }
void finish() final { m_group.finish(); } void finish() final { m_group.finish(); }
private: private:
Utils::SavedActionSet m_group; AspectContainer &m_group = debuggerSettings()->page4;
}; };
LocalsAndExpressionsOptionsPage::LocalsAndExpressionsOptionsPage() LocalsAndExpressionsOptionsPage::LocalsAndExpressionsOptionsPage()

View File

@@ -31,11 +31,11 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/savedaction.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <aggregation/aggregate.h> #include <aggregation/aggregate.h>
#include <coreplugin/find/itemviewfind.h> #include <coreplugin/find/itemviewfind.h>
#include <QAction>
#include <QCoreApplication> #include <QCoreApplication>
#include <QToolButton> #include <QToolButton>
#include <QLabel> #include <QLabel>
@@ -101,42 +101,39 @@ Console::Console()
m_showDebugButton = new QToolButton(m_consoleWidget); m_showDebugButton = new QToolButton(m_consoleWidget);
m_showDebugButtonAction = new Utils::SavedAction(this); m_showDebug.setDefaultValue(true);
m_showDebugButtonAction->setDefaultValue(true); m_showDebug.setSettingsKey(CONSOLE, SHOW_LOG);
m_showDebugButtonAction->setSettingsKey(CONSOLE, SHOW_LOG); m_showDebug.setLabelText(tr("Show debug, log, and info messages."));
m_showDebugButtonAction->setToolTip(tr("Show debug, log, and info messages.")); m_showDebug.setToolTip(tr("Show debug, log, and info messages."));
m_showDebugButtonAction->setCheckable(true); m_showDebug.setValue(true);
m_showDebugButtonAction->setChecked(true); m_showDebug.action()->setIcon(Utils::Icons::INFO_TOOLBAR.icon());
m_showDebugButtonAction->setIcon(Utils::Icons::INFO_TOOLBAR.icon()); connect(&m_showDebug, &Utils::BoolAspect::valueChanged,
connect(m_showDebugButtonAction->action(), &QAction::toggled,
proxyModel, &ConsoleProxyModel::setShowLogs); proxyModel, &ConsoleProxyModel::setShowLogs);
m_showDebugButton->setDefaultAction(m_showDebugButtonAction->action()); m_showDebugButton->setDefaultAction(m_showDebug.action());
m_showWarningButton = new QToolButton(m_consoleWidget); m_showWarningButton = new QToolButton(m_consoleWidget);
m_showWarningButtonAction = new Utils::SavedAction(this); m_showWarning.setDefaultValue(true);
m_showWarningButtonAction->setDefaultValue(true); m_showWarning.setSettingsKey(CONSOLE, SHOW_WARNING);
m_showWarningButtonAction->setSettingsKey(CONSOLE, SHOW_WARNING); m_showWarning.setLabelText(tr("Show warning messages."));
m_showWarningButtonAction->setToolTip(tr("Show warning messages.")); m_showWarning.setToolTip(tr("Show warning messages."));
m_showWarningButtonAction->setCheckable(true); m_showWarning.setValue(true);
m_showWarningButtonAction->setChecked(true); m_showWarning.action()->setIcon(Utils::Icons::WARNING_TOOLBAR.icon());
m_showWarningButtonAction->setIcon(Utils::Icons::WARNING_TOOLBAR.icon()); connect(m_showWarning.action(), &QAction::toggled,
connect(m_showWarningButtonAction->action(), &QAction::toggled,
proxyModel, &ConsoleProxyModel::setShowWarnings); proxyModel, &ConsoleProxyModel::setShowWarnings);
m_showWarningButton->setDefaultAction(m_showWarningButtonAction->action()); m_showWarningButton->setDefaultAction(m_showWarning.action());
m_showErrorButton = new QToolButton(m_consoleWidget); m_showErrorButton = new QToolButton(m_consoleWidget);
m_showErrorButtonAction = new Utils::SavedAction(this); m_showError.setDefaultValue(true);
m_showErrorButtonAction->setDefaultValue(true); m_showError.setSettingsKey(CONSOLE, SHOW_ERROR);
m_showErrorButtonAction->setSettingsKey(CONSOLE, SHOW_ERROR); m_showError.setLabelText(tr("Show error messages."));
m_showErrorButtonAction->setToolTip(tr("Show error messages.")); m_showError.setToolTip(tr("Show error messages."));
m_showErrorButtonAction->setCheckable(true); m_showError.setValue(true);
m_showErrorButtonAction->setChecked(true); m_showError.action()->setIcon(Utils::Icons::CRITICAL_TOOLBAR.icon());
m_showErrorButtonAction->setIcon(Utils::Icons::CRITICAL_TOOLBAR.icon()); connect(m_showError.action(), &QAction::toggled,
connect(m_showErrorButtonAction->action(), &QAction::toggled,
proxyModel, &ConsoleProxyModel::setShowErrors); proxyModel, &ConsoleProxyModel::setShowErrors);
m_showErrorButton->setDefaultAction(m_showErrorButtonAction->action()); m_showErrorButton->setDefaultAction(m_showError.action());
m_spacer = new QWidget(m_consoleWidget); m_spacer = new QWidget(m_consoleWidget);
m_spacer->setMinimumWidth(30); m_spacer->setMinimumWidth(30);
@@ -221,9 +218,9 @@ bool Console::canNavigate() const
void Console::readSettings() void Console::readSettings()
{ {
QSettings *settings = Core::ICore::settings(); QSettings *settings = Core::ICore::settings();
m_showDebugButtonAction->readSettings(settings); m_showDebug.readSettings(settings);
m_showWarningButtonAction->readSettings(settings); m_showWarning.readSettings(settings);
m_showErrorButtonAction->readSettings(settings); m_showError.readSettings(settings);
} }
void Console::setContext(const QString &context) void Console::setContext(const QString &context)
@@ -234,9 +231,9 @@ void Console::setContext(const QString &context)
void Console::writeSettings() const void Console::writeSettings() const
{ {
QSettings *settings = Core::ICore::settings(); QSettings *settings = Core::ICore::settings();
m_showDebugButtonAction->writeSettings(settings); m_showDebug.writeSettings(settings);
m_showWarningButtonAction->writeSettings(settings); m_showWarning.writeSettings(settings);
m_showErrorButtonAction->writeSettings(settings); m_showError.writeSettings(settings);
} }
void Console::setScriptEvaluator(const ScriptEvaluator &evaluator) void Console::setScriptEvaluator(const ScriptEvaluator &evaluator)

View File

@@ -28,6 +28,7 @@
#include "consoleitem.h" #include "consoleitem.h"
#include <coreplugin/ioutputpane.h> #include <coreplugin/ioutputpane.h>
#include <utils/aspects.h>
#include <functional> #include <functional>
@@ -38,7 +39,7 @@ class QToolButton;
class QLabel; class QLabel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils { class SavedAction; } namespace Utils { class BoolAspect; }
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -87,9 +88,9 @@ private:
QToolButton *m_showDebugButton; QToolButton *m_showDebugButton;
QToolButton *m_showWarningButton; QToolButton *m_showWarningButton;
QToolButton *m_showErrorButton; QToolButton *m_showErrorButton;
Utils::SavedAction *m_showDebugButtonAction; Utils::BoolAspect m_showDebug;
Utils::SavedAction *m_showWarningButtonAction; Utils::BoolAspect m_showWarning;
Utils::SavedAction *m_showErrorButtonAction; Utils::BoolAspect m_showError;
QWidget *m_spacer; QWidget *m_spacer;
QLabel *m_statusLabel; QLabel *m_statusLabel;
ConsoleItemModel *m_consoleItemModel; ConsoleItemModel *m_consoleItemModel;

View File

@@ -95,7 +95,6 @@ Project {
files: [ files: [
"cdbengine.cpp", "cdbengine.h", "cdbengine.cpp", "cdbengine.h",
"cdboptionspage.cpp", "cdboptionspage.h", "cdboptionspage.cpp", "cdboptionspage.h",
"cdboptionspagewidget.ui",
"cdbparsehelpers.cpp", "cdbparsehelpers.h", "cdbparsehelpers.cpp", "cdbparsehelpers.h",
"stringinputstream.cpp", "stringinputstream.h", "stringinputstream.cpp", "stringinputstream.h",
] ]

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,7 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QVector> #include <QVector>
namespace Utils { class SavedAction; } #include <utils/aspects.h>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -50,6 +50,12 @@ public:
SourcePathRegExpMap sourcePathRegExpMap; SourcePathRegExpMap sourcePathRegExpMap;
}; };
class GeneralSettings
{
GeneralSettings();
~GeneralSettings();
};
class DebuggerSettings class DebuggerSettings
{ {
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::DebuggerSettings) Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::DebuggerSettings)
@@ -58,119 +64,125 @@ public:
explicit DebuggerSettings(); explicit DebuggerSettings();
~DebuggerSettings(); ~DebuggerSettings();
void insertItem(int code, Utils::SavedAction *item);
Utils::SavedAction *item(int code) const;
static QString dump(); static QString dump();
// Page 1: General
Utils::BoolAspect useAlternatingRowColors;
Utils::BoolAspect useAnnotationsInMainEditor;
Utils::BoolAspect useToolTipsInMainEditor;
Utils::BoolAspect closeSourceBuffersOnExit;
Utils::BoolAspect closeMemoryBuffersOnExit;
Utils::BoolAspect raiseOnInterrupt;
Utils::BoolAspect breakpointsFullPathByDefault;
Utils::BoolAspect warnOnReleaseBuilds;
Utils::IntegerAspect maximalStackDepth;
Utils::BoolAspect fontSizeFollowsEditor;
Utils::BoolAspect switchModeOnExit;
Utils::BoolAspect showQmlObjectTree;
Utils::BoolAspect stationaryEditorWhileStepping;
// Page 2: GDB
Utils::IntegerAspect gdbWatchdogTimeout;
Utils::BoolAspect skipKnownFrames;
Utils::BoolAspect useMessageBoxForSignals;
Utils::BoolAspect adjustBreakpointLocations;
Utils::BoolAspect useDynamicType;
Utils::BoolAspect loadGdbInit;
Utils::BoolAspect loadGdbDumpers;
Utils::BoolAspect intelFlavor;
Utils::BoolAspect usePseudoTracepoints;
Utils::StringAspect gdbStartupCommands;
Utils::StringAspect gdbPostAttachCommands;
// Page 3: GDB Extended
Utils::BoolAspect targetAsync;
Utils::BoolAspect autoEnrichParameters;
Utils::BoolAspect breakOnThrow;
Utils::BoolAspect breakOnCatch;
Utils::BoolAspect breakOnWarning;
Utils::BoolAspect breakOnFatal;
Utils::BoolAspect breakOnAbort;
Utils::BoolAspect enableReverseDebugging;
Utils::BoolAspect multiInferior;
// Page 4: Locals and expressions
Utils::BoolAspect useDebuggingHelpers;
Utils::BoolAspect useCodeModel;
Utils::BoolAspect showThreadNames;
Utils::StringAspect extraDumperFile; // For loading a file. Recommended.
Utils::StringAspect extraDumperCommands; // To modify an existing setup.
Utils::BoolAspect showStdNamespace;
Utils::BoolAspect showQtNamespace;
Utils::BoolAspect showQObjectNames;
// Page 5: CDB
Utils::StringAspect cdbAdditionalArguments;
Utils::StringListAspect cdbBreakEvents;
Utils::BoolAspect cdbBreakOnCrtDbgReport;
Utils::BoolAspect useCdbConsole;
Utils::BoolAspect cdbBreakPointCorrection;
Utils::BoolAspect cdbUsePythonDumper;
Utils::BoolAspect firstChanceExceptionTaskEntry;
Utils::BoolAspect secondChanceExceptionTaskEntry;
Utils::BoolAspect ignoreFirstChanceAccessViolation;
Utils::BoolAspect *registerForPostMortem = nullptr;
// Page 6: CDB Paths
Utils::StringListAspect cdbSymbolPaths;
Utils::StringListAspect cdbSourcePaths;
// Without pages
Utils::BoolAspect alwaysAdjustColumnWidths;
Utils::BaseAspect settingsDialog;
Utils::BoolAspect autoQuit;
Utils::BoolAspect lockView;
Utils::BoolAspect logTimeStamps;
// Stack
Utils::BaseAspect expandStack;
Utils::BaseAspect createFullBacktrace;
Utils::BoolAspect useToolTipsInStackView;
// Watchers & Locals
Utils::BoolAspect autoDerefPointers;
Utils::IntegerAspect maximalStringLength;
Utils::IntegerAspect displayStringLimit;
Utils::BoolAspect sortStructMembers;
Utils::BoolAspect useToolTipsInLocalsView;
// Breakpoints
Utils::BoolAspect synchronizeBreakpoints; // ?
Utils::BoolAspect allPluginBreakpoints;
Utils::BoolAspect selectedPluginBreakpoints;
Utils::BoolAspect noPluginBreakpoints;
Utils::StringAspect selectedPluginBreakpointsPattern;
Utils::BoolAspect useToolTipsInBreakpointsView;
// QML Tools
Utils::BoolAspect showAppOnTop;
Utils::AspectContainer all; // All
Utils::AspectContainer page1; // General
Utils::AspectContainer page2; // GDB
Utils::AspectContainer page3; // GDB Extended
Utils::AspectContainer page4; // Locals & Expressions
Utils::AspectContainer page5; // CDB
Utils::AspectContainer page6; // CDB Paths
void readSettings(); void readSettings();
void writeSettings() const; void writeSettings() const;
private: private:
DebuggerSettings(const DebuggerSettings &) = delete; DebuggerSettings(const DebuggerSettings &) = delete;
DebuggerSettings &operator=(const DebuggerSettings &) = delete; DebuggerSettings &operator=(const DebuggerSettings &) = delete;
QHash<int, Utils::SavedAction *> m_items;
}; };
DebuggerSettings *debuggerSettings();
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
enum DebuggerActionCode
{
// General
SettingsDialog,
UseAlternatingRowColors,
FontSizeFollowsEditor,
UseMessageBoxForSignals,
AutoQuit,
LockView,
LogTimeStamps,
CloseSourceBuffersOnExit,
CloseMemoryBuffersOnExit,
SwitchModeOnExit,
BreakpointsFullPathByDefault,
RaiseOnInterrupt,
StationaryEditorWhileStepping,
UseDebuggingHelpers,
UseCodeModel,
ShowThreadNames,
UseToolTipsInMainEditor,
UseAnnotationsInMainEditor,
UseToolTipsInLocalsView,
UseToolTipsInBreakpointsView,
UseToolTipsInStackView,
RegisterForPostMortem,
AlwaysAdjustColumnWidths,
ExtraDumperFile, // For loading a file. Recommended.
ExtraDumperCommands, // To modify an existing setup.
// Cdb
CdbAdditionalArguments,
CdbSymbolPaths,
CdbSourcePaths,
CdbBreakEvents,
CdbBreakOnCrtDbgReport,
UseCdbConsole,
CdbBreakPointCorrection,
CdbUsePythonDumper,
FirstChanceExceptionTaskEntry,
SecondChanceExceptionTaskEntry,
IgnoreFirstChanceAccessViolation,
// Gdb
LoadGdbInit,
LoadGdbDumpers,
GdbStartupCommands,
GdbPostAttachCommands,
GdbWatchdogTimeout,
AutoEnrichParameters,
UseDynamicType,
TargetAsync,
WarnOnReleaseBuilds,
MultiInferior,
IntelFlavor,
UsePseudoTracepoints,
// Stack
MaximalStackDepth,
ExpandStack,
CreateFullBacktrace,
// Watchers & Locals
ShowStdNamespace,
ShowQtNamespace,
ShowQObjectNames,
SortStructMembers,
AutoDerefPointers,
MaximalStringLength,
DisplayStringLimit,
// Running
SkipKnownFrames,
EnableReverseDebugging,
// Breakpoints
SynchronizeBreakpoints,
AllPluginBreakpoints,
SelectedPluginBreakpoints,
AdjustBreakpointLocations,
NoPluginBreakpoints,
SelectedPluginBreakpointsPattern,
BreakOnThrow,
BreakOnCatch,
BreakOnWarning,
BreakOnFatal,
BreakOnAbort,
// QML Tools
ShowQmlObjectTree,
ShowAppOnTop
};
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -37,10 +37,7 @@ class QMenu;
class QAction; class QAction;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils { namespace Utils { class BaseTreeView; }
class BaseTreeView;
class SavedAction;
}
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -60,12 +57,6 @@ GlobalDebuggerOptions *globalDebuggerOptions();
bool isTestRun(); bool isTestRun();
Utils::SavedAction *action(int code);
bool boolSetting(int code);
QString stringSetting(int code);
QStringList stringListSetting(int code);
QAction *addAction(QMenu *menu, const QString &display, bool on, QAction *addAction(QMenu *menu, const QString &display, bool on,
const std::function<void()> &onTriggered = {}); const std::function<void()> &onTriggered = {});
QAction *addAction(QMenu *menu, const QString &d1, const QString &d2, bool on, QAction *addAction(QMenu *menu, const QString &d1, const QString &d2, bool on,

View File

@@ -78,7 +78,6 @@
#include <utils/processhandle.h> #include <utils/processhandle.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/savedaction.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
@@ -286,7 +285,7 @@ public:
m_logWindow = new LogWindow(m_engine); // Needed before start() m_logWindow = new LogWindow(m_engine); // Needed before start()
m_logWindow->setObjectName("Debugger.Dock.Output"); m_logWindow->setObjectName("Debugger.Dock.Output");
connect(action(EnableReverseDebugging), &SavedAction::valueChanged, this, [this] { connect(&debuggerSettings()->enableReverseDebugging, &BaseAspect::changed, this, [this] {
updateState(); updateState();
if (m_companionEngine) if (m_companionEngine)
m_companionEngine->d->updateState(); m_companionEngine->d->updateState();
@@ -427,7 +426,7 @@ public:
m_watchHandler.cleanup(); m_watchHandler.cleanup();
m_engine->showMessage(tr("Debugger finished."), StatusBar); m_engine->showMessage(tr("Debugger finished."), StatusBar);
m_engine->setState(DebuggerFinished); // Also destroys views. m_engine->setState(DebuggerFinished); // Also destroys views.
if (boolSetting(SwitchModeOnExit)) if (debuggerSettings()->switchModeOnExit.value())
EngineManager::deactivateDebugMode(); EngineManager::deactivateDebugMode();
} }
@@ -831,7 +830,7 @@ void DebuggerEnginePrivate::setupViews()
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged, connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
this, [this](const FontSettings &settings) { this, [this](const FontSettings &settings) {
if (!boolSetting(FontSizeFollowsEditor)) if (!debuggerSettings()->fontSizeFollowsEditor.value())
return; return;
const qreal size = settings.fontZoom() * settings.fontSize() / 100.; const qreal size = settings.fontZoom() * settings.fontSize() / 100.;
QFont font = m_breakWindow->font(); QFont font = m_breakWindow->font();
@@ -1102,7 +1101,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
&newEditor); &newEditor);
QTC_ASSERT(editor, return); // Unreadable file? QTC_ASSERT(editor, return); // Unreadable file?
editor->gotoLine(line, 0, !boolSetting(StationaryEditorWhileStepping)); editor->gotoLine(line, 0, !debuggerSettings()->stationaryEditorWhileStepping.value());
if (newEditor) if (newEditor)
editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true); editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
@@ -1364,7 +1363,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
d->m_perspective->select(); d->m_perspective->select();
showMessage(tr("Stopped."), StatusBar); showMessage(tr("Stopped."), StatusBar);
setState(InferiorStopOk); setState(InferiorStopOk);
if (boolSetting(RaiseOnInterrupt)) if (debuggerSettings()->raiseOnInterrupt.value())
ICore::raiseWindow(DebuggerMainWindow::instance()); ICore::raiseWindow(DebuggerMainWindow::instance());
} }
@@ -1422,8 +1421,8 @@ void DebuggerEnginePrivate::setInitialActionStates()
m_jumpToLineAction.setVisible(false); m_jumpToLineAction.setVisible(false);
m_stepOverAction.setEnabled(true); m_stepOverAction.setEnabled(true);
action(AutoDerefPointers)->setEnabled(true); debuggerSettings()->autoDerefPointers.setEnabled(true);
action(ExpandStack)->setEnabled(false); debuggerSettings()->expandStack.setEnabled(false);
m_threadLabel->setEnabled(false); m_threadLabel->setEnabled(false);
} }
@@ -1561,9 +1560,9 @@ void DebuggerEnginePrivate::updateState()
const bool actionsEnabled = m_engine->debuggerActionsEnabled(); const bool actionsEnabled = m_engine->debuggerActionsEnabled();
const bool canDeref = actionsEnabled && m_engine->hasCapability(AutoDerefPointersCapability); const bool canDeref = actionsEnabled && m_engine->hasCapability(AutoDerefPointersCapability);
action(AutoDerefPointers)->setEnabled(canDeref); debuggerSettings()->autoDerefPointers.setEnabled(canDeref);
action(AutoDerefPointers)->setEnabled(true); debuggerSettings()->autoDerefPointers.setEnabled(true);
action(ExpandStack)->setEnabled(actionsEnabled); debuggerSettings()->expandStack.setEnabled(actionsEnabled);
const bool notbusy = state == InferiorStopOk const bool notbusy = state == InferiorStopOk
|| state == DebuggerNotReady || state == DebuggerNotReady
@@ -1575,7 +1574,7 @@ void DebuggerEnginePrivate::updateState()
void DebuggerEnginePrivate::updateReverseActions() void DebuggerEnginePrivate::updateReverseActions()
{ {
const bool stopped = m_state == InferiorStopOk; const bool stopped = m_state == InferiorStopOk;
const bool reverseEnabled = boolSetting(EnableReverseDebugging); const bool reverseEnabled = debuggerSettings()->enableReverseDebugging.value();
const bool canReverse = reverseEnabled && m_engine->hasCapability(ReverseSteppingCapability); const bool canReverse = reverseEnabled && m_engine->hasCapability(ReverseSteppingCapability);
const bool doesRecord = m_recordForReverseOperationAction.isChecked(); const bool doesRecord = m_recordForReverseOperationAction.isChecked();
@@ -1593,8 +1592,8 @@ void DebuggerEnginePrivate::updateReverseActions()
void DebuggerEnginePrivate::cleanupViews() void DebuggerEnginePrivate::cleanupViews()
{ {
const bool closeSource = boolSetting(CloseSourceBuffersOnExit); const bool closeSource = debuggerSettings()->closeSourceBuffersOnExit.value();
const bool closeMemory = boolSetting(CloseMemoryBuffersOnExit); const bool closeMemory = debuggerSettings()->closeMemoryBuffersOnExit.value();
QList<IDocument *> toClose; QList<IDocument *> toClose;
foreach (IDocument *document, DocumentModel::openedDocuments()) { foreach (IDocument *document, DocumentModel::openedDocuments()) {
@@ -1880,7 +1879,7 @@ QString DebuggerEngine::expand(const QString &string) const
QString DebuggerEngine::nativeStartupCommands() const QString DebuggerEngine::nativeStartupCommands() const
{ {
return expand(QStringList({stringSetting(GdbStartupCommands), return expand(QStringList({debuggerSettings()->gdbStartupCommands.value(),
runParameters().additionalStartupCommands}).join('\n')); runParameters().additionalStartupCommands}).join('\n'));
} }
@@ -2718,7 +2717,8 @@ Context CppDebuggerEngine::languageContext() const
void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp) void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
{ {
const bool warnOnRelease = boolSetting(WarnOnReleaseBuilds) && rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor; const bool warnOnRelease = debuggerSettings()->warnOnReleaseBuilds.value()
&& rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor;
bool warnOnInappropriateDebugger = false; bool warnOnInappropriateDebugger = false;
QString detailedWarning; QString detailedWarning;
switch (rp.toolChainAbi.binaryFormat()) { switch (rp.toolChainAbi.binaryFormat()) {

View File

@@ -74,6 +74,8 @@ const char OPENED_BY_DEBUGGER[] = "OpenedByDebugger";
const char OPENED_WITH_DISASSEMBLY[] = "DisassemblerView"; const char OPENED_WITH_DISASSEMBLY[] = "DisassemblerView";
const char DISASSEMBLER_SOURCE_FILE[] = "DisassemblerSourceFile"; const char DISASSEMBLER_SOURCE_FILE[] = "DisassemblerSourceFile";
const char CRT_DEBUG_REPORT[] = "CrtDbgReport";
} // namespace Constants } // namespace Constants
enum ModelRoles enum ModelRoles

View File

@@ -116,7 +116,6 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/proxyaction.h> #include <utils/proxyaction.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/statuslabel.h> #include <utils/statuslabel.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <utils/temporarydirectory.h> #include <utils/temporarydirectory.h>
@@ -657,7 +656,6 @@ public:
void parseCommandLineArguments(); void parseCommandLineArguments();
void updatePresetState(); void updatePresetState();
SavedAction *action(int code);
QWidget *addSearch(BaseTreeView *treeView); QWidget *addSearch(BaseTreeView *treeView);
public: public:
@@ -796,7 +794,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
const auto addFontSizeAdaptation = [this](QWidget *widget) { const auto addFontSizeAdaptation = [this](QWidget *widget) {
QObject::connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged, QObject::connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
[widget](const FontSettings &settings) { [widget](const FontSettings &settings) {
if (!boolSetting(FontSizeFollowsEditor)) if (!debuggerSettings()->fontSizeFollowsEditor.value())
return; return;
qreal size = settings.fontZoom() * settings.fontSize() / 100.; qreal size = settings.fontZoom() * settings.fontSize() / 100.;
QFont font = widget->font(); QFont font = widget->font();
@@ -1173,7 +1171,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
this, &DebuggerPluginPrivate::updateBreakMenuItem); this, &DebuggerPluginPrivate::updateBreakMenuItem);
// Application interaction // Application interaction
connect(action(SettingsDialog)->action(), &QAction::triggered, connect(debuggerSettings()->settingsDialog.action(), &QAction::triggered,
[] { ICore::showOptionsDialog(DEBUGGER_COMMON_SETTINGS_ID); }); [] { ICore::showOptionsDialog(DEBUGGER_COMMON_SETTINGS_ID); });
m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser()); m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser());
@@ -1478,9 +1476,10 @@ void DebuggerPluginPrivate::updatePresetState()
// FIXME: Decentralize the actions below // FIXME: Decentralize the actions below
const bool actionsEnabled = currentEngine->debuggerActionsEnabled(); const bool actionsEnabled = currentEngine->debuggerActionsEnabled();
const bool canDeref = actionsEnabled && currentEngine->hasCapability(AutoDerefPointersCapability); const bool canDeref = actionsEnabled && currentEngine->hasCapability(AutoDerefPointersCapability);
action(AutoDerefPointers)->setEnabled(canDeref); DebuggerSettings *s = debuggerSettings();
action(AutoDerefPointers)->setEnabled(true); s->autoDerefPointers.setEnabled(canDeref);
action(ExpandStack)->setEnabled(actionsEnabled); s->autoDerefPointers.setEnabled(true);
s->expandStack.setEnabled(actionsEnabled);
m_startAndDebugApplicationAction.setEnabled(true); m_startAndDebugApplicationAction.setEnabled(true);
m_attachToQmlPortAction.setEnabled(true); m_attachToQmlPortAction.setEnabled(true);
@@ -1924,8 +1923,8 @@ void DebuggerPluginPrivate::setInitialState()
m_breakAction.setEnabled(false); m_breakAction.setEnabled(false);
//m_snapshotAction.setEnabled(false); //m_snapshotAction.setEnabled(false);
action(AutoDerefPointers)->setEnabled(true); debuggerSettings()->autoDerefPointers.setEnabled(true);
action(ExpandStack)->setEnabled(false); debuggerSettings()->expandStack.setEnabled(false);
} }
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu() void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
@@ -2016,17 +2015,14 @@ void DebuggerPluginPrivate::extensionsInitialized()
DebuggerMainWindow::ensureMainWindowExists(); DebuggerMainWindow::ensureMainWindowExists();
} }
SavedAction *DebuggerPluginPrivate::action(int code)
{
return m_debuggerSettings.item(code);
}
QWidget *DebuggerPluginPrivate::addSearch(BaseTreeView *treeView) QWidget *DebuggerPluginPrivate::addSearch(BaseTreeView *treeView)
{ {
QAction *act = action(UseAlternatingRowColors)->action(); BoolAspect &act = debuggerSettings()->useAlternatingRowColors;
treeView->setAlternatingRowColors(act->isChecked()); treeView->setAlternatingRowColors(act.value());
treeView->setProperty(PerspectiveState::savesHeaderKey(), true); treeView->setProperty(PerspectiveState::savesHeaderKey(), true);
connect(act, &QAction::toggled, treeView, &BaseTreeView::setAlternatingRowColors); connect(&act, &BaseAspect::changed, treeView, [treeView] {
treeView->setAlternatingRowColors(debuggerSettings()->useAlternatingRowColors.value());
});
return ItemViewFind::createSearchableWrapper(treeView); return ItemViewFind::createSearchableWrapper(treeView);
} }
@@ -2036,31 +2032,11 @@ Console *debuggerConsole()
return &dd->m_console; return &dd->m_console;
} }
SavedAction *action(int code)
{
return dd->action(code);
}
QWidget *addSearch(BaseTreeView *treeView) QWidget *addSearch(BaseTreeView *treeView)
{ {
return dd->addSearch(treeView); return dd->addSearch(treeView);
} }
bool boolSetting(int code)
{
return action(code)->value().toBool();
}
QString stringSetting(int code)
{
return action(code)->value().toString();
}
QStringList stringListSetting(int code)
{
return action(code)->value().toStringList();
}
void openTextEditor(const QString &titlePattern0, const QString &contents) void openTextEditor(const QString &titlePattern0, const QString &contents)
{ {
if (dd->m_shuttingDown) if (dd->m_shuttingDown)

View File

@@ -391,7 +391,7 @@ void DebuggerRunTool::setUseTerminal(bool on)
bool useCdbConsole = m_runParameters.cppEngineType == CdbEngineType bool useCdbConsole = m_runParameters.cppEngineType == CdbEngineType
&& (m_runParameters.startMode == StartInternal && (m_runParameters.startMode == StartInternal
|| m_runParameters.startMode == StartExternal) || m_runParameters.startMode == StartExternal)
&& boolSetting(UseCdbConsole); && debuggerSettings()->useCdbConsole.value();
if (on && !d->terminalRunner && !useCdbConsole) { if (on && !d->terminalRunner && !useCdbConsole) {
d->terminalRunner = new TerminalRunner(runControl(), m_runParameters.inferior); d->terminalRunner = new TerminalRunner(runControl(), m_runParameters.inferior);
@@ -856,7 +856,7 @@ bool DebuggerRunTool::fixupParameters()
} }
} }
if (!boolSetting(AutoEnrichParameters)) { if (!debuggerSettings()->autoEnrichParameters.value()) {
const QString sysroot = rp.sysRoot.toString(); const QString sysroot = rp.sysRoot.toString();
if (rp.debugInfoLocation.isEmpty()) if (rp.debugInfoLocation.isEmpty())
rp.debugInfoLocation = sysroot + "/usr/lib/debug"; rp.debugInfoLocation = sysroot + "/usr/lib/debug";

View File

@@ -1188,7 +1188,7 @@ void DebuggerToolTipManagerPrivate::slotTooltipOverrideRequested
QTC_ASSERT(handled, return); QTC_ASSERT(handled, return);
QTC_ASSERT(editorWidget, return); QTC_ASSERT(editorWidget, return);
if (!boolSetting(UseToolTipsInMainEditor)) if (!debuggerSettings()->useToolTipsInMainEditor.value())
return; return;
const TextDocument *document = editorWidget->textDocument(); const TextDocument *document = editorWidget->textDocument();

View File

@@ -42,9 +42,9 @@
#include <texteditor/textdocument.h> #include <texteditor/textdocument.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <utils/aspects.h>
#include <utils/mimetypes/mimedatabase.h> #include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QTextBlock> #include <QTextBlock>
#include <QDir> #include <QDir>
@@ -181,7 +181,7 @@ int DisassemblerAgentPrivate::lineForAddress(quint64 address) const
DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine) DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine)
: d(new DisassemblerAgentPrivate(engine)) : d(new DisassemblerAgentPrivate(engine))
{ {
connect(action(IntelFlavor), &Utils::SavedAction::valueChanged, connect(&debuggerSettings()->intelFlavor, &Utils::BaseAspect::changed,
this, &DisassemblerAgent::reload); this, &DisassemblerAgent::reload);
} }

View File

@@ -63,7 +63,6 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/savedaction.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/temporaryfile.h> #include <utils/temporaryfile.h>
@@ -158,13 +157,14 @@ GdbEngine::GdbEngine()
connect(&m_commandTimer, &QTimer::timeout, connect(&m_commandTimer, &QTimer::timeout,
this, &GdbEngine::commandTimeout); this, &GdbEngine::commandTimeout);
connect(action(AutoDerefPointers), &SavedAction::valueChanged, DebuggerSettings &s = *debuggerSettings();
connect(&s.autoDerefPointers, &BaseAspect::changed,
this, &GdbEngine::reloadLocals); this, &GdbEngine::reloadLocals);
connect(action(CreateFullBacktrace)->action(), &QAction::triggered, connect(s.createFullBacktrace.action(), &QAction::triggered,
this, &GdbEngine::createFullBacktrace); this, &GdbEngine::createFullBacktrace);
connect(action(UseDebuggingHelpers), &SavedAction::valueChanged, connect(&s.useDebuggingHelpers, &BaseAspect::changed,
this, &GdbEngine::reloadLocals); this, &GdbEngine::reloadLocals);
connect(action(UseDynamicType), &SavedAction::valueChanged, connect(&s.useDynamicType, &BaseAspect::changed,
this, &GdbEngine::reloadLocals); this, &GdbEngine::reloadLocals);
connect(&m_gdbProc, &QProcess::errorOccurred, connect(&m_gdbProc, &QProcess::errorOccurred,
@@ -804,7 +804,7 @@ void GdbEngine::runCommand(const DebuggerCommand &command)
int GdbEngine::commandTimeoutTime() const int GdbEngine::commandTimeoutTime() const
{ {
int time = action(GdbWatchdogTimeout)->value().toInt(); const int time = debuggerSettings()->gdbWatchdogTimeout.value();
return 1000 * qMax(20, time); return 1000 * qMax(20, time);
} }
@@ -946,7 +946,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
DebuggerCommand cmd = m_commandForToken.take(token); DebuggerCommand cmd = m_commandForToken.take(token);
const int flags = m_flagsForToken.take(token); const int flags = m_flagsForToken.take(token);
if (boolSetting(LogTimeStamps)) { if (debuggerSettings()->logTimeStamps.value()) {
showMessage(QString("Response time: %1: %2 s") showMessage(QString("Response time: %1: %2 s")
.arg(cmd.function) .arg(cmd.function)
.arg(QTime::fromMSecsSinceStartOfDay(cmd.postTime).msecsTo(QTime::currentTime()) / 1000.), .arg(QTime::fromMSecsSinceStartOfDay(cmd.postTime).msecsTo(QTime::currentTime()) / 1000.),
@@ -1020,7 +1020,7 @@ void GdbEngine::updateAll()
{ {
//PENDING_DEBUG("UPDATING ALL\n"); //PENDING_DEBUG("UPDATING ALL\n");
QTC_CHECK(state() == InferiorUnrunnable || state() == InferiorStopOk); QTC_CHECK(state() == InferiorUnrunnable || state() == InferiorStopOk);
DebuggerCommand cmd(stackCommand(action(MaximalStackDepth)->value().toInt())); DebuggerCommand cmd(stackCommand(debuggerSettings()->maximalStackDepth.value()));
cmd.callback = [this](const DebuggerResponse &r) { handleStackListFrames(r, false); }; cmd.callback = [this](const DebuggerResponse &r) { handleStackListFrames(r, false); };
runCommand(cmd); runCommand(cmd);
stackHandler()->setCurrentIndex(0); stackHandler()->setCurrentIndex(0);
@@ -1293,7 +1293,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
// Jump over well-known frames. // Jump over well-known frames.
static int stepCounter = 0; static int stepCounter = 0;
if (boolSetting(SkipKnownFrames)) { if (debuggerSettings()->skipKnownFrames.value()) {
if (reason == "end-stepping-range" || reason == "function-finished") { if (reason == "end-stepping-range" || reason == "function-finished") {
//showMessage(frame.toString()); //showMessage(frame.toString());
QString funcName = frame["function"].data(); QString funcName = frame["function"].data();
@@ -1330,7 +1330,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (!m_systemDumpersLoaded) { if (!m_systemDumpersLoaded) {
m_systemDumpersLoaded = true; m_systemDumpersLoaded = true;
if (m_gdbVersion >= 70400 && boolSetting(LoadGdbDumpers)) if (m_gdbVersion >= 70400 && debuggerSettings()->loadGdbDumpers.value())
runCommand({"importPlainDumpers on"}); runCommand({"importPlainDumpers on"});
else else
runCommand({"importPlainDumpers off"}); runCommand({"importPlainDumpers off"});
@@ -1443,7 +1443,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
showMessage("SIGNAL 0 CONSIDERED BOGUS."); showMessage("SIGNAL 0 CONSIDERED BOGUS.");
} else { } else {
showMessage("HANDLING SIGNAL " + name); showMessage("HANDLING SIGNAL " + name);
if (boolSetting(UseMessageBoxForSignals) && !isStopperThread) if (debuggerSettings()->useMessageBoxForSignals.value() && !isStopperThread)
if (!showStoppedBySignalMessageBox(meaning, name)) { if (!showStoppedBySignalMessageBox(meaning, name)) {
showMessage("SIGNAL RECEIVED WHILE SHOWING SIGNAL MESSAGE"); showMessage("SIGNAL RECEIVED WHILE SHOWING SIGNAL MESSAGE");
return; return;
@@ -1602,7 +1602,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
cleanFilePath = QDir::cleanPath(fi.absoluteFilePath()); cleanFilePath = QDir::cleanPath(fi.absoluteFilePath());
} }
if (!boolSetting(AutoEnrichParameters)) if (!debuggerSettings()->autoEnrichParameters.value())
return cleanFilePath; return cleanFilePath;
const QString sysroot = runParameters().sysRoot.toString(); const QString sysroot = runParameters().sysRoot.toString();
@@ -2057,7 +2057,7 @@ void GdbEngine::setTokenBarrier()
QTC_ASSERT(good, return); QTC_ASSERT(good, return);
PENDING_DEBUG("\n--- token barrier ---\n"); PENDING_DEBUG("\n--- token barrier ---\n");
showMessage("--- token barrier ---", LogMiscInput); showMessage("--- token barrier ---", LogMiscInput);
if (boolSetting(LogTimeStamps)) if (debuggerSettings()->logTimeStamps.value())
showMessage(LogWindow::logTimeStamp(), LogMiscInput); showMessage(LogWindow::logTimeStamp(), LogMiscInput);
m_oldestAcceptableToken = currentToken(); m_oldestAcceptableToken = currentToken();
m_stackNeeded = false; m_stackNeeded = false;
@@ -2179,7 +2179,7 @@ void GdbEngine::handleCatchInsert(const DebuggerResponse &response, const Breakp
void GdbEngine::handleBkpt(const GdbMi &bkpt, const Breakpoint &bp) void GdbEngine::handleBkpt(const GdbMi &bkpt, const Breakpoint &bp)
{ {
QTC_ASSERT(bp, return); QTC_ASSERT(bp, return);
bool usePseudoTracepoints = boolSetting(UsePseudoTracepoints); const bool usePseudoTracepoints = debuggerSettings()->usePseudoTracepoints.value();
const QString nr = bkpt["number"].data(); const QString nr = bkpt["number"].data();
if (nr.contains('.')) { if (nr.contains('.')) {
// A sub-breakpoint. // A sub-breakpoint.
@@ -2594,7 +2594,7 @@ void GdbEngine::insertBreakpoint(const Breakpoint &bp)
int spec = requested.threadSpec; int spec = requested.threadSpec;
if (requested.isTracepoint()) { if (requested.isTracepoint()) {
if (boolSetting(UsePseudoTracepoints)) { if (debuggerSettings()->usePseudoTracepoints.value()) {
cmd.function = "createTracepoint"; cmd.function = "createTracepoint";
if (requested.oneShot) if (requested.oneShot)
@@ -2629,14 +2629,15 @@ void GdbEngine::insertBreakpoint(const Breakpoint &bp)
// for dumping of expressions // for dumping of expressions
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); cmd.arg("fancy", s.useDebuggingHelpers.value());
cmd.arg("autoderef", boolSetting(AutoDerefPointers)); cmd.arg("autoderef", s.autoDerefPointers.value());
cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("dyntype", s.useDynamicType.value());
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames)); cmd.arg("qobjectnames", s.showQObjectNames.value());
cmd.arg("nativemixed", isNativeMixedActive()); cmd.arg("nativemixed", isNativeMixedActive());
cmd.arg("stringcutoff", action(MaximalStringLength)->value().toString()); cmd.arg("stringcutoff", s.maximalStringLength.value());
cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toString()); cmd.arg("displaystringlimit", s.displayStringLimit.value());
cmd.arg("spec", breakpointLocation2(requested)); cmd.arg("spec", breakpointLocation2(requested));
cmd.callback = [this, bp](const DebuggerResponse &r) { handleTracepointInsert(r, bp); }; cmd.callback = [this, bp](const DebuggerResponse &r) { handleTracepointInsert(r, bp); };
@@ -3132,7 +3133,7 @@ DebuggerCommand GdbEngine::stackCommand(int depth)
void GdbEngine::reloadStack() void GdbEngine::reloadStack()
{ {
PENDING_DEBUG("RELOAD STACK"); PENDING_DEBUG("RELOAD STACK");
DebuggerCommand cmd = stackCommand(action(MaximalStackDepth)->value().toInt()); DebuggerCommand cmd = stackCommand(debuggerSettings()->maximalStackDepth.value());
cmd.callback = [this](const DebuggerResponse &r) { handleStackListFrames(r, false); }; cmd.callback = [this](const DebuggerResponse &r) { handleStackListFrames(r, false); };
cmd.flags = Discardable; cmd.flags = Discardable;
runCommand(cmd); runCommand(cmd);
@@ -3196,8 +3197,8 @@ void GdbEngine::handleThreadInfo(const DebuggerResponse &response)
ThreadsHandler *handler = threadsHandler(); ThreadsHandler *handler = threadsHandler();
handler->setThreads(response.data); handler->setThreads(response.data);
updateState(); // Adjust Threads combobox. updateState(); // Adjust Threads combobox.
if (boolSetting(ShowThreadNames)) { if (debuggerSettings()->showThreadNames.value()) {
runCommand({"threadnames " + action(MaximalStackDepth)->value().toString(), runCommand({QString("threadnames %1").arg(debuggerSettings()->maximalStackDepth.value()),
Discardable, CB(handleThreadNames)}); Discardable, CB(handleThreadNames)});
} }
reloadStack(); // Will trigger register reload. reloadStack(); // Will trigger register reload.
@@ -3665,7 +3666,7 @@ public:
void GdbEngine::fetchDisassembler(DisassemblerAgent *agent) void GdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{ {
if (boolSetting(IntelFlavor)) if (debuggerSettings()->intelFlavor.value())
runCommand({"set disassembly-flavor intel"}); runCommand({"set disassembly-flavor intel"});
else else
runCommand({"set disassembly-flavor att"}); runCommand({"set disassembly-flavor att"});
@@ -3850,7 +3851,7 @@ void GdbEngine::setupEngine()
} }
gdbCommand.addArgs({"-i", "mi"}); gdbCommand.addArgs({"-i", "mi"});
if (!boolSetting(LoadGdbInit)) if (!debuggerSettings()->loadGdbInit.value())
gdbCommand.addArg("-n"); gdbCommand.addArg("-n");
Environment gdbEnv = rp.debugger.environment; Environment gdbEnv = rp.debugger.environment;
@@ -3977,7 +3978,7 @@ void GdbEngine::setupEngine()
//if (!ba.isEmpty()) //if (!ba.isEmpty())
// runCommand("set solib-search-path " + ba); // runCommand("set solib-search-path " + ba);
if (boolSetting(MultiInferior) || runParameters().multiProcess) { if (debuggerSettings()->multiInferior.value() || runParameters().multiProcess) {
//runCommand("set follow-exec-mode new"); //runCommand("set follow-exec-mode new");
runCommand({"set detach-on-fork off"}); runCommand({"set detach-on-fork off"});
} }
@@ -3998,14 +3999,14 @@ void GdbEngine::setupEngine()
runCommand({"python sys.path.append('" + uninstalledData + "')"}); runCommand({"python sys.path.append('" + uninstalledData + "')"});
runCommand({"python from gdbbridge import *"}); runCommand({"python from gdbbridge import *"});
const QString path = stringSetting(ExtraDumperFile); const QString path = debuggerSettings()->extraDumperFile.value();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && QFileInfo(path).isReadable()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path); cmd.arg("path", path);
runCommand(cmd); runCommand(cmd);
} }
const QString commands = stringSetting(ExtraDumperCommands); const QString commands = debuggerSettings()->extraDumperCommands.value();
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands}); runCommand({commands});
@@ -4213,7 +4214,7 @@ bool GdbEngine::usesExecInterrupt() const
bool GdbEngine::usesTargetAsync() const bool GdbEngine::usesTargetAsync() const
{ {
return runParameters().useTargetAsync || boolSetting(TargetAsync); return runParameters().useTargetAsync || debuggerSettings()->targetAsync.value();
} }
void GdbEngine::scheduleTestResponse(int testCase, const QString &response) void GdbEngine::scheduleTestResponse(int testCase, const QString &response)
@@ -4322,9 +4323,10 @@ void GdbEngine::claimInitialBreakpoints()
showMessage(tr("Setting breakpoints...")); showMessage(tr("Setting breakpoints..."));
BreakpointManager::claimBreakpointsForEngine(this); BreakpointManager::claimBreakpointsForEngine(this);
const bool onAbort = boolSetting(BreakOnAbort); const DebuggerSettings &s = *debuggerSettings();
const bool onWarning = boolSetting(BreakOnWarning); const bool onAbort = s.breakOnAbort.value();
const bool onFatal = boolSetting(BreakOnFatal); const bool onWarning = s.breakOnWarning.value();
const bool onFatal = s.breakOnFatal.value();
if (onAbort || onWarning || onFatal) { if (onAbort || onWarning || onFatal) {
DebuggerCommand cmd("createSpecialBreakpoints"); DebuggerCommand cmd("createSpecialBreakpoints");
cmd.arg("breakonabort", onAbort); cmd.arg("breakonabort", onAbort);
@@ -4782,7 +4784,7 @@ void GdbEngine::handleTargetRemote(const DebuggerResponse &response)
// gdb server will stop the remote application itself. // gdb server will stop the remote application itself.
showMessage("INFERIOR STARTED"); showMessage("INFERIOR STARTED");
showMessage(msgAttachedToStoppedInferior(), StatusBar); showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString commands = expand(stringSetting(GdbPostAttachCommands)); QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands, NativeCommand}); runCommand({commands, NativeCommand});
handleInferiorPrepared(); handleInferiorPrepared();
@@ -4798,7 +4800,7 @@ void GdbEngine::handleTargetExtendedRemote(const DebuggerResponse &response)
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage("ATTACHED TO GDB SERVER STARTED"); showMessage("ATTACHED TO GDB SERVER STARTED");
showMessage(msgAttachedToStoppedInferior(), StatusBar); showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString commands = expand(stringSetting(GdbPostAttachCommands)); QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands, NativeCommand}); runCommand({commands, NativeCommand});
if (runParameters().attachPID.isValid()) { // attach to pid if valid if (runParameters().attachPID.isValid()) { // attach to pid if valid
@@ -5051,19 +5053,20 @@ void GdbEngine::doUpdateLocals(const UpdateParameters &params)
watchHandler()->appendWatchersAndTooltipRequests(&cmd); watchHandler()->appendWatchersAndTooltipRequests(&cmd);
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); cmd.arg("fancy", s.useDebuggingHelpers.value());
cmd.arg("autoderef", boolSetting(AutoDerefPointers)); cmd.arg("autoderef", s.autoDerefPointers.value());
cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("dyntype", s.useDynamicType.value());
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames)); cmd.arg("qobjectnames", s.showQObjectNames.value());
cmd.arg("timestamps", boolSetting(LogTimeStamps)); cmd.arg("timestamps", s.logTimeStamps.value());
StackFrame frame = stackHandler()->currentFrame(); StackFrame frame = stackHandler()->currentFrame();
cmd.arg("context", frame.context); cmd.arg("context", frame.context);
cmd.arg("nativemixed", isNativeMixedActive()); cmd.arg("nativemixed", isNativeMixedActive());
cmd.arg("stringcutoff", action(MaximalStringLength)->value().toString()); cmd.arg("stringcutoff", s.maximalStringLength.value());
cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toString()); cmd.arg("displaystringlimit", s.displayStringLimit.value());
cmd.arg("resultvarname", m_resultVarName); cmd.arg("resultvarname", m_resultVarName);
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);

View File

@@ -23,7 +23,6 @@
** **
****************************************************************************/ ****************************************************************************/
#include <debugger/commonoptionspage.h>
#include <debugger/debuggeractions.h> #include <debugger/debuggeractions.h>
#include <debugger/debuggercore.h> #include <debugger/debuggercore.h>
#include <debugger/debuggerinternalconstants.h> #include <debugger/debuggerinternalconstants.h>
@@ -32,21 +31,7 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/fancylineedit.h> #include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <utils/savedaction.h>
#include <utils/variablechooser.h>
#include <QCheckBox>
#include <QCoreApplication>
#include <QDebug>
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QPointer>
#include <QSpinBox>
#include <QTextEdit>
using namespace Core; using namespace Core;
using namespace Utils; using namespace Utils;
@@ -70,196 +55,42 @@ public:
class GdbOptionsPageWidget : public IOptionsPageWidget class GdbOptionsPageWidget : public IOptionsPageWidget
{ {
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::GdbOptionsPage)
public: public:
GdbOptionsPageWidget(); GdbOptionsPageWidget();
void apply() final { group.apply(ICore::settings()); } void apply() final { group.apply(); group.writeSettings(ICore::settings()); }
void finish() final { group.finish(); } void finish() final { group.finish(); }
SavedActionSet group; AspectContainer &group = debuggerSettings()->page2;
}; };
GdbOptionsPageWidget::GdbOptionsPageWidget() GdbOptionsPageWidget::GdbOptionsPageWidget()
{ {
auto groupBoxGeneral = new QGroupBox(this); using namespace Layouting;
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General")); DebuggerSettings &s = *debuggerSettings();
auto labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral); Group general {
labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:")); Title { tr("General") },
labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr( Row { s.gdbWatchdogTimeout, Stretch() },
"The number of seconds before a non-responsive GDB process is terminated.\n" s.skipKnownFrames,
"The default value of 20 seconds should be sufficient for most\n" s.useMessageBoxForSignals,
"applications, but there are situations when loading big libraries or\n" s.adjustBreakpointLocations,
"listing source files takes much longer than that on slow machines.\n" s.useDynamicType,
"In this case, the value should be increased.")); s.loadGdbInit,
s.loadGdbDumpers,
s.intelFlavor,
s.usePseudoTracepoints,
Stretch()
};
auto spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral); Column commands {
spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip()); Group { Title { tr("Additional Startup Commands") }, s.gdbStartupCommands },
spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec")); Group { Title { tr("Additional Attach Commands") }, s.gdbPostAttachCommands }
spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight); };
spinBoxGdbWatchdogTimeout->setMinimum(20);
spinBoxGdbWatchdogTimeout->setMaximum(1000000);
spinBoxGdbWatchdogTimeout->setSingleStep(20);
spinBoxGdbWatchdogTimeout->setValue(20);
auto checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral); Row { general, commands }.attachTo(this);
checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>"
"Allows <i>Step Into</i> to compress several steps into one step\n"
"for less noisy debugging. For example, the atomic reference\n"
"counting code is skipped, and a single <i>Step Into</i> for a signal\n"
"emission ends up directly in the slot connected to it."));
auto checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
"Show a message box when receiving a signal"));
checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
"Displays a message box as soon as your application\n"
"receives a signal like SIGSEGV during debugging."));
auto checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
"Adjust breakpoint locations"));
checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
"GDB allows setting breakpoints on source lines for which no code \n"
"was generated. In such situations the breakpoint is shifted to the\n"
"next source code line for which code was actually generated.\n"
"This option reflects such temporary change by moving the breakpoint\n"
"markers in the source code editor."));
auto checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
"Use dynamic object type for display"));
checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
"Specifies whether the dynamic or the static type of objects will be "
"displayed. Choosing the dynamic type might be slower."));
auto checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral);
checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup"));
checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr(
"Allows or inhibits reading the user's default\n"
".gdbinit file on debugger startup."));
auto checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers"));
checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr(
"Uses the default GDB pretty printers installed in your "
"system or linked to the libraries your application uses."));
auto checkBoxIntelFlavor = new QCheckBox(groupBoxGeneral);
checkBoxIntelFlavor->setText(GdbOptionsPage::tr("Use Intel style disassembly"));
checkBoxIntelFlavor->setToolTip(GdbOptionsPage::tr(
"<html><head/><body>GDB shows by default AT&&T style disassembly."
"</body></html>"));
auto checkBoxUsePseudoTracepoints = new QCheckBox(groupBoxGeneral);
checkBoxUsePseudoTracepoints->setText(GdbOptionsPage::tr("Use pseudo message tracepoints"));
checkBoxUsePseudoTracepoints->setToolTip(GdbOptionsPage::tr(
"Uses python to extend the ordinary GDB breakpoint class."));
QString howToUsePython = GdbOptionsPage::tr(
"<p>To execute simple Python commands, prefix them with \"python\".</p>"
"<p>To execute sequences of Python commands spanning multiple lines "
"prepend the block with \"python\" on a separate line, and append "
"\"end\" on a separate line.</p>"
"<p>To execute arbitrary Python scripts, "
"use <i>python execfile('/path/to/script.py')</i>.</p>");
auto groupBoxStartupCommands = new QGroupBox(this);
groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>GDB commands entered here will be executed after "
"GDB has been started, but before the debugged program is started or "
"attached, and before the debugging helpers are initialized.</p>%1"
"</body></html>").arg(howToUsePython));
auto textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
textEditStartupCommands->setAcceptRichText(false);
textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());
auto groupBoxPostAttachCommands = new QGroupBox(this);
groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands"));
groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>GDB commands entered here will be executed after "
"GDB has successfully attached to remote targets.</p>"
"<p>You can add commands to further set up the target here, "
"such as \"monitor reset\" or \"load\"."
"</body></html>"));
auto textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
textEditPostAttachCommands->setAcceptRichText(false);
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
/*
groupBoxPluginDebugging = new QGroupBox(q);
groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
"Behavior of Breakpoint Setting in Plugins"));
radioButtonAllPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
radioButtonAllPluginBreakpoints->setText(GdbOptionsPage::tr(
"Always try to set breakpoints in plugins automatically"));
radioButtonAllPluginBreakpoints->setToolTip(GdbOptionsPage::tr(
"This is the slowest but safest option."));
radioButtonSelectedPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
radioButtonSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
"Try to set breakpoints in selected plugins"));
radioButtonNoPluginBreakpoints = new QRadioButton(groupBoxPluginDebugging);
radioButtonNoPluginBreakpoints->setText(GdbOptionsPage::tr(
"Never set breakpoints in plugins automatically"));
lineEditSelectedPluginBreakpointsPattern = new QLineEdit(groupBoxPluginDebugging);
labelSelectedPluginBreakpoints = new QLabel(groupBoxPluginDebugging);
labelSelectedPluginBreakpoints->setText(GdbOptionsPage::tr(
"Matching regular expression: "));
*/
auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(textEditPostAttachCommands);
chooser->addSupportedWidget(textEditStartupCommands);
auto formLayout = new QFormLayout(groupBoxGeneral);
formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
formLayout->addRow(checkBoxSkipKnownFrames);
formLayout->addRow(checkBoxUseMessageBoxForSignals);
formLayout->addRow(checkBoxAdjustBreakpointLocations);
formLayout->addRow(checkBoxUseDynamicType);
formLayout->addRow(checkBoxLoadGdbInit);
formLayout->addRow(checkBoxLoadGdbDumpers);
formLayout->addRow(checkBoxIntelFlavor);
formLayout->addRow(checkBoxUsePseudoTracepoints);
auto startLayout = new QGridLayout(groupBoxStartupCommands);
startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);
auto postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
auto gridLayout = new QGridLayout(this);
gridLayout->addWidget(groupBoxGeneral, 0, 0, 5, 1);
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 2, 1);
gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1);
group.insert(action(GdbStartupCommands), textEditStartupCommands);
group.insert(action(GdbPostAttachCommands), textEditPostAttachCommands);
group.insert(action(LoadGdbInit), checkBoxLoadGdbInit);
group.insert(action(LoadGdbDumpers), checkBoxLoadGdbDumpers);
group.insert(action(UseDynamicType), checkBoxUseDynamicType);
group.insert(action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations);
group.insert(action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout);
group.insert(action(IntelFlavor), checkBoxIntelFlavor);
group.insert(action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals);
group.insert(action(SkipKnownFrames), checkBoxSkipKnownFrames);
group.insert(action(UsePseudoTracepoints), checkBoxUsePseudoTracepoints);
//lineEditSelectedPluginBreakpointsPattern->
// setEnabled(action(SelectedPluginBreakpoints)->value().toBool());
//connect(radioButtonSelectedPluginBreakpoints, &QRadioButton::toggled,
// lineEditSelectedPluginBreakpointsPattern, &QLineEdit::setEnabled);
} }
GdbOptionsPage::GdbOptionsPage() GdbOptionsPage::GdbOptionsPage()
@@ -281,87 +112,33 @@ class GdbOptionsPageWidget2 : public IOptionsPageWidget
public: public:
GdbOptionsPageWidget2(); GdbOptionsPageWidget2();
void apply() final { group.apply(ICore::settings()); } void apply() final { group.apply(); group.writeSettings(ICore::settings()); }
void finish() final { group.finish(); } void finish() final { group.finish(); }
Utils::SavedActionSet group; AspectContainer &group = debuggerSettings()->page3;
}; };
GdbOptionsPageWidget2::GdbOptionsPageWidget2() GdbOptionsPageWidget2::GdbOptionsPageWidget2()
{ {
auto groupBoxDangerous = new QGroupBox(this); auto labelDangerous = new QLabel("<html><head/><body><i>" +
groupBoxDangerous->setTitle(GdbOptionsPage::tr("Extended")); GdbOptionsPage::tr("The options below give access to advanced "
"or experimental functions of GDB.<br>Enabling them may negatively "
"impact your debugging experience.") + "</i></body></html>");
auto labelDangerous = new QLabel(GdbOptionsPage::tr( using namespace Layouting;
"<html><head/><body>The options below give access to advanced " DebuggerSettings &s = *debuggerSettings();
"or experimental functions of GDB. Enabling them may negatively "
"impact your debugging experience.</body></html>"));
QFont f = labelDangerous->font();
f.setItalic(true);
labelDangerous->setFont(f);
auto checkBoxTargetAsync = new QCheckBox(groupBoxDangerous); Group {
checkBoxTargetAsync->setText(GdbOptionsPage::tr( Title(GdbOptionsPage::tr("Extended")),
"Use asynchronous mode to control the inferior")); labelDangerous,
s.targetAsync,
auto checkBoxAutoEnrichParameters = new QCheckBox(groupBoxDangerous); s.autoEnrichParameters,
checkBoxAutoEnrichParameters->setText(GdbOptionsPage::tr( s.breakOnWarning,
"Use common locations for debug information")); s.breakOnFatal,
checkBoxAutoEnrichParameters->setToolTip(GdbOptionsPage::tr( s.breakOnAbort,
"<html><head/><body>Adds common paths to locations " s.enableReverseDebugging,
"of debug information such as <i>/usr/src/debug</i> " s.multiInferior,
"when starting GDB.</body></html>")); }.attachTo(this);
// FIXME: Move to common settings page.
auto checkBoxBreakOnWarning = new QCheckBox(groupBoxDangerous);
checkBoxBreakOnWarning->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qWarning"));
checkBoxBreakOnWarning->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qWarning"));
auto checkBoxBreakOnFatal = new QCheckBox(groupBoxDangerous);
checkBoxBreakOnFatal->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal"));
checkBoxBreakOnFatal->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal"));
auto checkBoxBreakOnAbort = new QCheckBox(groupBoxDangerous);
checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort"));
checkBoxBreakOnAbort->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort"));
auto checkBoxEnableReverseDebugging = new QCheckBox(groupBoxDangerous);
checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging"));
checkBoxEnableReverseDebugging->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>Enables stepping backwards.</p><p>"
"<b>Note:</b> This feature is very slow and unstable on the GDB side. "
"It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>"));
auto checkBoxMultiInferior = new QCheckBox(groupBoxDangerous);
checkBoxMultiInferior->setText(GdbOptionsPage::tr("Debug all child processes"));
checkBoxMultiInferior->setToolTip(GdbOptionsPage::tr(
"<html><head/><body>Keeps debugging all children after a fork."
"</body></html>"));
auto formLayout = new QFormLayout(groupBoxDangerous);
formLayout->addRow(labelDangerous);
formLayout->addRow(checkBoxTargetAsync);
formLayout->addRow(checkBoxAutoEnrichParameters);
formLayout->addRow(checkBoxBreakOnWarning);
formLayout->addRow(checkBoxBreakOnFatal);
formLayout->addRow(checkBoxBreakOnAbort);
if (checkBoxEnableReverseDebugging)
formLayout->addRow(checkBoxEnableReverseDebugging);
formLayout->addRow(checkBoxMultiInferior);
auto gridLayout = new QGridLayout(this);
gridLayout->addWidget(groupBoxDangerous, 0, 0, 2, 1);
group.insert(action(AutoEnrichParameters), checkBoxAutoEnrichParameters);
group.insert(action(TargetAsync), checkBoxTargetAsync);
group.insert(action(BreakOnWarning), checkBoxBreakOnWarning);
group.insert(action(BreakOnFatal), checkBoxBreakOnFatal);
group.insert(action(BreakOnAbort), checkBoxBreakOnAbort);
group.insert(action(MultiInferior), checkBoxMultiInferior);
if (checkBoxEnableReverseDebugging)
group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging);
} }
// The "Dangerous" options. // The "Dangerous" options.

View File

@@ -50,7 +50,6 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QApplication> #include <QApplication>
@@ -87,15 +86,16 @@ LldbEngine::LldbEngine()
setObjectName("LldbEngine"); setObjectName("LldbEngine");
setDebuggerName("LLDB"); setDebuggerName("LLDB");
connect(action(AutoDerefPointers), &SavedAction::valueChanged, DebuggerSettings &ds = *debuggerSettings();
connect(&ds.autoDerefPointers, &BaseAspect::changed,
this, &LldbEngine::updateLocals); this, &LldbEngine::updateLocals);
connect(action(CreateFullBacktrace)->action(), &QAction::triggered, connect(ds.createFullBacktrace.action(), &QAction::triggered,
this, &LldbEngine::fetchFullBacktrace); this, &LldbEngine::fetchFullBacktrace);
connect(action(UseDebuggingHelpers), &SavedAction::valueChanged, connect(&ds.useDebuggingHelpers, &BaseAspect::changed,
this, &LldbEngine::updateLocals); this, &LldbEngine::updateLocals);
connect(action(UseDynamicType), &SavedAction::valueChanged, connect(&ds.useDynamicType, &BaseAspect::changed,
this, &LldbEngine::updateLocals); this, &LldbEngine::updateLocals);
connect(action(IntelFlavor), &SavedAction::valueChanged, connect(&ds.intelFlavor, &BaseAspect::changed,
this, &LldbEngine::updateAll); this, &LldbEngine::updateAll);
connect(&m_lldbProc, &QProcess::errorOccurred, connect(&m_lldbProc, &QProcess::errorOccurred,
@@ -244,14 +244,14 @@ void LldbEngine::setupEngine()
executeCommand(commands.toLocal8Bit()); executeCommand(commands.toLocal8Bit());
const QString path = stringSetting(ExtraDumperFile); const QString path = debuggerSettings()->extraDumperFile.value();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && QFileInfo(path).isReadable()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path); cmd.arg("path", path);
runCommand(cmd); runCommand(cmd);
} }
commands = stringSetting(ExtraDumperCommands); commands = debuggerSettings()->extraDumperCommands.value();
if (!commands.isEmpty()) { if (!commands.isEmpty()) {
DebuggerCommand cmd("executeDebuggerCommand"); DebuggerCommand cmd("executeDebuggerCommand");
cmd.arg("command", commands); cmd.arg("command", commands);
@@ -480,7 +480,7 @@ void LldbEngine::selectThread(const Thread &thread)
DebuggerCommand cmd("selectThread"); DebuggerCommand cmd("selectThread");
cmd.arg("id", thread->id()); cmd.arg("id", thread->id());
cmd.callback = [this](const DebuggerResponse &) { cmd.callback = [this](const DebuggerResponse &) {
fetchStack(action(MaximalStackDepth)->value().toInt()); fetchStack(debuggerSettings()->maximalStackDepth.value());
}; };
runCommand(cmd); runCommand(cmd);
} }
@@ -711,7 +711,7 @@ void LldbEngine::updateAll()
DebuggerCommand cmd("fetchThreads"); DebuggerCommand cmd("fetchThreads");
cmd.callback = [this](const DebuggerResponse &response) { cmd.callback = [this](const DebuggerResponse &response) {
threadsHandler()->setThreads(response.data); threadsHandler()->setThreads(response.data);
fetchStack(action(MaximalStackDepth)->value().toInt()); fetchStack(debuggerSettings()->maximalStackDepth.value());
reloadRegisters(); reloadRegisters();
}; };
runCommand(cmd); runCommand(cmd);
@@ -765,20 +765,21 @@ void LldbEngine::doUpdateLocals(const UpdateParameters &params)
watchHandler()->appendWatchersAndTooltipRequests(&cmd); watchHandler()->appendWatchersAndTooltipRequests(&cmd);
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); cmd.arg("fancy", s.useDebuggingHelpers.value());
cmd.arg("autoderef", boolSetting(AutoDerefPointers)); cmd.arg("autoderef", s.autoDerefPointers.value());
cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("dyntype", s.useDynamicType.value());
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames)); cmd.arg("qobjectnames", s.showQObjectNames.value());
cmd.arg("timestamps", boolSetting(LogTimeStamps)); cmd.arg("timestamps", s.logTimeStamps.value());
StackFrame frame = stackHandler()->currentFrame(); StackFrame frame = stackHandler()->currentFrame();
cmd.arg("context", frame.context); cmd.arg("context", frame.context);
cmd.arg("nativemixed", isNativeMixedActive()); cmd.arg("nativemixed", isNativeMixedActive());
cmd.arg("stringcutoff", action(MaximalStringLength)->value().toString()); cmd.arg("stringcutoff", s.maximalStringLength.value());
cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toString()); cmd.arg("displaystringlimit", s.displayStringLimit.value());
//cmd.arg("resultvarname", m_resultVarName); //cmd.arg("resultvarname", m_resultVarName);
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);
@@ -993,7 +994,7 @@ void LldbEngine::fetchDisassembler(DisassemblerAgent *agent)
DebuggerCommand cmd("fetchDisassembler"); DebuggerCommand cmd("fetchDisassembler");
cmd.arg("address", loc.address()); cmd.arg("address", loc.address());
cmd.arg("function", loc.functionName()); cmd.arg("function", loc.functionName());
cmd.arg("flavor", boolSetting(IntelFlavor) ? "intel" : "att"); cmd.arg("flavor", debuggerSettings()->intelFlavor.value() ? "intel" : "att");
cmd.callback = [this, id](const DebuggerResponse &response) { cmd.callback = [this, id](const DebuggerResponse &response) {
DisassemblerLines result; DisassemblerLines result;
QPointer<DisassemblerAgent> agent = m_disassemblerAgents.key(id); QPointer<DisassemblerAgent> agent = m_disassemblerAgents.key(id);

View File

@@ -50,7 +50,6 @@
#include <coreplugin/minisplitter.h> #include <coreplugin/minisplitter.h>
#include <coreplugin/find/basetextfind.h> #include <coreplugin/find/basetextfind.h>
#include <utils/savedaction.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
@@ -220,10 +219,10 @@ public:
QMenu *menu = createStandardContextMenu(); QMenu *menu = createStandardContextMenu();
menu->addAction(m_clearContentsAction); menu->addAction(m_clearContentsAction);
menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts
menu->addAction(action(LogTimeStamps)->action()); menu->addAction(debuggerSettings()->logTimeStamps.action());
menu->addAction(m_reloadDebuggingHelpersAction); menu->addAction(m_reloadDebuggingHelpersAction);
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->exec(ev->globalPos()); menu->exec(ev->globalPos());
delete menu; delete menu;
} }
@@ -526,7 +525,7 @@ void LogWindow::showOutput(int channel, const QString &output)
QString out; QString out;
out.reserve(output.size() + 1000); out.reserve(output.size() + 1000);
if (output.at(0) != '~' && boolSetting(LogTimeStamps)) { if (output.at(0) != '~' && debuggerSettings()->logTimeStamps.value()) {
out.append(charForChannel(LogTime)); out.append(charForChannel(LogTime));
out.append(logTimeStamp()); out.append(logTimeStamp());
out.append(nchar); out.append(nchar);
@@ -594,7 +593,7 @@ void LogWindow::showInput(int channel, const QString &input)
m_inputText->setTextCursor(cursor); m_inputText->setTextCursor(cursor);
return; return;
} }
if (boolSetting(LogTimeStamps)) if (debuggerSettings()->logTimeStamps.value())
m_inputText->append(logTimeStamp()); m_inputText->append(logTimeStamp());
m_inputText->append(input); m_inputText->append(input);
QTextCursor cursor = m_inputText->textCursor(); QTextCursor cursor = m_inputText->textCursor();
@@ -726,7 +725,7 @@ void GlobalLogWindow::doOutput(const QString &output)
void GlobalLogWindow::doInput(const QString &input) void GlobalLogWindow::doInput(const QString &input)
{ {
if (boolSetting(LogTimeStamps)) if (debuggerSettings()->logTimeStamps.value())
m_leftPane->append(LogWindow::logTimeStamp()); m_leftPane->append(LogWindow::logTimeStamp());
m_leftPane->append(input); m_leftPane->append(input);
QTextCursor cursor = m_leftPane->textCursor(); QTextCursor cursor = m_leftPane->textCursor();

View File

@@ -33,7 +33,6 @@
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/treemodel.h> #include <utils/treemodel.h>
#include <QCoreApplication> #include <QCoreApplication>
@@ -223,7 +222,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
canShowSymbols && moduleNameValid, canShowSymbols && moduleNameValid,
[this, modulePath] { engine->requestModuleSections(modulePath); }); [this, modulePath] { engine->requestModuleSections(modulePath); });
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;

View File

@@ -572,7 +572,7 @@ void PdbEngine::updateLocals()
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); cmd.arg("fancy", debuggerSettings()->useDebuggingHelpers.value());
//cmd.arg("resultvarname", m_resultVarName); //cmd.arg("resultvarname", m_resultVarName);
//m_lastDebuggableCommand = cmd; //m_lastDebuggableCommand = cmd;

View File

@@ -30,7 +30,6 @@
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/savedaction.h>
#include <QActionGroup> #include <QActionGroup>
#include <QFile> #include <QFile>
@@ -799,7 +798,7 @@ bool PeripheralRegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
menu->addMenu(fmtMenu); menu->addMenu(fmtMenu);
} }
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -862,7 +862,7 @@ bool compareConsoleItems(const ConsoleItem *a, const ConsoleItem *b)
static ConsoleItem *constructLogItemTree(const QVariant &result, static ConsoleItem *constructLogItemTree(const QVariant &result,
const QString &key = QString()) const QString &key = QString())
{ {
bool sorted = boolSetting(SortStructMembers); bool sorted = debuggerSettings()->sortStructMembers.value();
if (!result.isValid()) if (!result.isValid())
return nullptr; return nullptr;
@@ -2226,7 +2226,7 @@ void QmlEnginePrivate::constructChildLogItems(ConsoleItem *item, const QmlV8Obje
for (const QVariant &property : objectData.properties) for (const QVariant &property : objectData.properties)
*(it++) = constructLogItemTree(extractData(property), seenHandles); *(it++) = constructLogItemTree(extractData(property), seenHandles);
if (boolSetting(SortStructMembers)) if (debuggerSettings()->sortStructMembers.value())
std::sort(children.begin(), children.end(), compareConsoleItems); std::sort(children.begin(), children.end(), compareConsoleItems);
foreach (ConsoleItem *child, children) foreach (ConsoleItem *child, children)
@@ -2339,7 +2339,7 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
parent->appendChild(item.release()); parent->appendChild(item.release());
} }
if (boolSetting(SortStructMembers)) { if (debuggerSettings()->sortStructMembers.value()) {
parent->sortChildren([](const WatchItem *item1, const WatchItem *item2) { parent->sortChildren([](const WatchItem *item1, const WatchItem *item2) {
return item1->name < item2->name; return item1->name < item2->name;
}); });

View File

@@ -45,8 +45,8 @@
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QAction>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QFileInfo> #include <QFileInfo>
#include <QLoggingCategory> #include <QLoggingCategory>
@@ -68,12 +68,12 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn
: m_qmlEngine(engine) : m_qmlEngine(engine)
, m_inspectorToolsContext("Debugger.QmlInspector") , m_inspectorToolsContext("Debugger.QmlInspector")
, m_selectAction(new QAction(this)) , m_selectAction(new QAction(this))
, m_showAppOnTopAction(action(ShowAppOnTop)->action()) , m_showAppOnTopAction(debuggerSettings()->showAppOnTop.action())
{ {
m_debugIdToIname.insert(WatchItem::InvalidId, "inspect"); m_debugIdToIname.insert(WatchItem::InvalidId, "inspect");
connect(action(ShowQmlObjectTree), connect(&debuggerSettings()->showQmlObjectTree, &Utils::BaseAspect::changed,
&Utils::SavedAction::valueChanged, this, &QmlInspectorAgent::updateState); this, &QmlInspectorAgent::updateState);
connect(action(SortStructMembers), &Utils::SavedAction::valueChanged, connect(&debuggerSettings()->sortStructMembers, &Utils::BaseAspect::changed,
this, &QmlInspectorAgent::updateState); this, &QmlInspectorAgent::updateState);
m_delayQueryTimer.setSingleShot(true); m_delayQueryTimer.setSingleShot(true);
m_delayQueryTimer.setInterval(100); m_delayQueryTimer.setInterval(100);
@@ -193,7 +193,7 @@ void QmlInspectorAgent::addObjectWatch(int objectDebugId)
if (objectDebugId == WatchItem::InvalidId) if (objectDebugId == WatchItem::InvalidId)
return; return;
if (!isConnected() || !boolSetting(ShowQmlObjectTree)) if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value())
return; return;
// already set // already set
@@ -212,7 +212,8 @@ void QmlInspectorAgent::updateState()
m_qmlEngine->logServiceStateChange(m_engineClient->name(), m_engineClient->serviceVersion(), m_qmlEngine->logServiceStateChange(m_engineClient->name(), m_engineClient->serviceVersion(),
m_engineClient->state()); m_engineClient->state());
if (m_engineClient->state() == QmlDebugClient::Enabled && boolSetting(ShowQmlObjectTree)) if (m_engineClient->state() == QmlDebugClient::Enabled
&& debuggerSettings()->showQmlObjectTree.value())
reloadEngines(); reloadEngines();
else else
clearObjectTree(); clearObjectTree();
@@ -301,7 +302,7 @@ void QmlInspectorAgent::newObject(int engineId, int /*objectId*/, int /*parentId
static void sortChildrenIfNecessary(WatchItem *propertiesWatch) static void sortChildrenIfNecessary(WatchItem *propertiesWatch)
{ {
if (boolSetting(SortStructMembers)) { if (debuggerSettings()->sortStructMembers.value()) {
propertiesWatch->sortChildren([](const WatchItem *item1, const WatchItem *item2) { propertiesWatch->sortChildren([](const WatchItem *item1, const WatchItem *item2) {
return item1->name < item2->name; return item1->name < item2->name;
}); });
@@ -375,7 +376,7 @@ void QmlInspectorAgent::queryEngineContext()
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << "pending queries:" << m_rootContextQueryIds; qCDebug(qmlInspectorLog) << __FUNCTION__ << "pending queries:" << m_rootContextQueryIds;
if (!isConnected() || !boolSetting(ShowQmlObjectTree)) if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value())
return; return;
log(LogSend, "LIST_OBJECTS"); log(LogSend, "LIST_OBJECTS");
@@ -390,7 +391,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')'; qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')';
if (!isConnected() || !boolSetting(ShowQmlObjectTree)) if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value())
return; return;
log(LogSend, "FETCH_OBJECT " + QString::number(debugId)); log(LogSend, "FETCH_OBJECT " + QString::number(debugId));
@@ -404,7 +405,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context, int en
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')'; qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')';
if (!isConnected() || !boolSetting(ShowQmlObjectTree)) if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value())
return; return;
for (const ObjectReference &obj : context.objects()) for (const ObjectReference &obj : context.objects())

View File

@@ -36,7 +36,6 @@
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QDebug> #include <QDebug>
#include <QItemDelegate> #include <QItemDelegate>
@@ -834,7 +833,7 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
addFormatAction(tr("Octal"), OctalFormat); addFormatAction(tr("Octal"), OctalFormat);
addFormatAction(tr("Binary"), BinaryFormat); addFormatAction(tr("Binary"), BinaryFormat);
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -40,9 +40,8 @@ using namespace RegistryAccess;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
void RegisterPostMortemAction::registerNow(const QVariant &value) void RegisterPostMortemAction::registerNow(bool value)
{ {
const bool boolValue = value.toBool();
const QString debuggerExe = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + '/' const QString debuggerExe = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + '/'
+ QLatin1String(debuggerApplicationFileC) + ".exe"); + QLatin1String(debuggerApplicationFileC) + ".exe");
const ushort *debuggerWString = debuggerExe.utf16(); const ushort *debuggerWString = debuggerExe.utf16();
@@ -54,7 +53,7 @@ void RegisterPostMortemAction::registerNow(const QVariant &value)
shExecInfo.hwnd = NULL; shExecInfo.hwnd = NULL;
shExecInfo.lpVerb = L"runas"; shExecInfo.lpVerb = L"runas";
shExecInfo.lpFile = reinterpret_cast<LPCWSTR>(debuggerWString); shExecInfo.lpFile = reinterpret_cast<LPCWSTR>(debuggerWString);
shExecInfo.lpParameters = boolValue ? L"-register" : L"-unregister"; shExecInfo.lpParameters = value ? L"-register" : L"-unregister";
shExecInfo.lpDirectory = NULL; shExecInfo.lpDirectory = NULL;
shExecInfo.nShow = SW_SHOWNORMAL; shExecInfo.nShow = SW_SHOWNORMAL;
shExecInfo.hProcess = NULL; shExecInfo.hProcess = NULL;
@@ -64,9 +63,9 @@ void RegisterPostMortemAction::registerNow(const QVariant &value)
readSettings(); readSettings();
} }
RegisterPostMortemAction::RegisterPostMortemAction(QObject *parent) : Utils::SavedAction(parent) RegisterPostMortemAction::RegisterPostMortemAction()
{ {
connect(this, &SavedAction::valueChanged, this, &RegisterPostMortemAction::registerNow); connect(this, &BoolAspect::valueChanged, this, &RegisterPostMortemAction::registerNow);
} }
void RegisterPostMortemAction::readSettings(const QSettings *) void RegisterPostMortemAction::readSettings(const QSettings *)
@@ -80,7 +79,7 @@ void RegisterPostMortemAction::readSettings(const QSettings *)
registered = isRegistered(handle, debuggerCall(), &errorMessage); registered = isRegistered(handle, debuggerCall(), &errorMessage);
if (handle) if (handle)
RegCloseKey(handle); RegCloseKey(handle);
setValue(registered, false); setValueQuietly(registered);
} }
} // namespace Internal } // namespace Internal

View File

@@ -25,20 +25,20 @@
#pragma once #pragma once
#include <utils/savedaction.h> #include <utils/aspects.h>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class RegisterPostMortemAction : public Utils::SavedAction class RegisterPostMortemAction : public Utils::BoolAspect
{ {
public: public:
RegisterPostMortemAction(QObject *parent = nullptr); RegisterPostMortemAction();
void readSettings(const QSettings *settings = nullptr) override; void readSettings(const QSettings *settings = nullptr) override;
void writeSettings(QSettings *) override {} void writeSettings(QSettings *) const override {}
private: private:
void registerNow(const QVariant &value); void registerNow(bool value);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -30,7 +30,6 @@
#include "debuggerengine.h" #include "debuggerengine.h"
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/savedaction.h>
#include <QDebug> #include <QDebug>
#include <QFileInfo> #include <QFileInfo>
@@ -137,7 +136,7 @@ bool SourceFilesHandler::setData(const QModelIndex &idx, const QVariant &data, i
addAction(tr("Open File \"%1\"").arg(name), true, addAction(tr("Open File \"%1\"").arg(name), true,
[this, name] { m_engine->gotoLocation(FilePath::fromString(name)); }); [this, name] { m_engine->gotoLocation(FilePath::fromString(name)); });
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -40,7 +40,6 @@
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
@@ -52,6 +51,7 @@
#include <QInputDialog> #include <QInputDialog>
#include <QMenu> #include <QMenu>
#include <QTextStream> #include <QTextStream>
#include <QTimer>
using namespace Utils; using namespace Utils;
@@ -70,9 +70,9 @@ StackHandler::StackHandler(DebuggerEngine *engine)
setObjectName("StackModel"); setObjectName("StackModel");
setHeader({tr("Level"), tr("Function"), tr("File"), tr("Line"), tr("Address") }); setHeader({tr("Level"), tr("Function"), tr("File"), tr("Line"), tr("Address") });
connect(action(ExpandStack)->action(), &QAction::triggered, connect(debuggerSettings()->expandStack.action(), &QAction::triggered,
this, &StackHandler::reloadFullStack); this, &StackHandler::reloadFullStack);
connect(action(MaximalStackDepth)->action(), &QAction::triggered, connect(debuggerSettings()->maximalStackDepth.action(), &QAction::triggered,
this, &StackHandler::reloadFullStack); this, &StackHandler::reloadFullStack);
// For now there's always only "the" current thread. // For now there's always only "the" current thread.
@@ -115,7 +115,7 @@ QVariant StackFrameItem::data(int column, int role) const
if (role == Qt::DecorationRole && column == StackLevelColumn) if (role == Qt::DecorationRole && column == StackLevelColumn)
return handler->iconForRow(row); return handler->iconForRow(row);
if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInStackView)) if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInStackView.value())
return frame.toToolTip(); return frame.toToolTip();
return QVariant(); return QVariant();
@@ -257,8 +257,8 @@ void StackHandler::setFramesAndCurrentIndex(const GdbMi &frames, bool isFull)
targetFrame = i; targetFrame = i;
} }
bool canExpand = !isFull && (n >= action(MaximalStackDepth)->value().toInt()); bool canExpand = !isFull && (n >= debuggerSettings()->maximalStackDepth.value());
action(ExpandStack)->setEnabled(canExpand); debuggerSettings()->expandStack.setEnabled(canExpand);
setFrames(stackFrames, canExpand); setFrames(stackFrames, canExpand);
// We can't jump to any file if we don't have any frames. // We can't jump to any file if we don't have any frames.
@@ -455,7 +455,7 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
frame = frameAt(row); frame = frameAt(row);
const quint64 address = frame.address; const quint64 address = frame.address;
menu->addAction(action(ExpandStack)->action()); menu->addAction(debuggerSettings()->expandStack.action());
addAction(menu, tr("Copy Contents to Clipboard"), true, [ev] { addAction(menu, tr("Copy Contents to Clipboard"), true, [ev] {
copyTextToClipboard(selectedText(ev.view(), true)); copyTextToClipboard(selectedText(ev.view(), true));
@@ -468,7 +468,7 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Save as Task File..."), true, [this] { saveTaskFile(); }); addAction(menu, tr("Save as Task File..."), true, [this] { saveTaskFile(); });
if (m_engine->hasCapability(CreateFullBacktraceCapability)) if (m_engine->hasCapability(CreateFullBacktraceCapability))
menu->addAction(action(CreateFullBacktrace)->action()); menu->addAction(debuggerSettings()->createFullBacktrace.action());
if (m_engine->hasCapability(AdditionalQmlStackCapability)) if (m_engine->hasCapability(AdditionalQmlStackCapability))
addAction(menu, tr("Load QML Stack"), true, [this] { m_engine->loadAdditionalQmlStack(); }); addAction(menu, tr("Load QML Stack"), true, [this] { m_engine->loadAdditionalQmlStack(); });
@@ -516,8 +516,8 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
} }
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(UseToolTipsInStackView)->action()); menu->addAction(debuggerSettings()->useToolTipsInStackView.action());
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -29,8 +29,6 @@
#include "debuggercore.h" #include "debuggercore.h"
#include "stackhandler.h" #include "stackhandler.h"
#include <utils/savedaction.h>
#include <QAction> #include <QAction>
#include <QHeaderView> #include <QHeaderView>

View File

@@ -35,7 +35,6 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
@@ -258,7 +257,7 @@ bool ThreadsHandler::setData(const QModelIndex &idx, const QVariant &data, int r
if (ev.as<QContextMenuEvent>()) { if (ev.as<QContextMenuEvent>()) {
auto menu = new QMenu; auto menu = new QMenu;
menu->addAction(action(SettingsDialog)->action()); menu->addAction(debuggerSettings()->settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -56,7 +56,6 @@
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
@@ -514,15 +513,16 @@ WatchModel::WatchModel(WatchHandler *handler, DebuggerEngine *engine)
connect(&m_requestUpdateTimer, &QTimer::timeout, connect(&m_requestUpdateTimer, &QTimer::timeout,
this, &WatchModel::updateStarted); this, &WatchModel::updateStarted);
connect(action(SortStructMembers), &SavedAction::valueChanged, DebuggerSettings &s = *debuggerSettings();
connect(&s.sortStructMembers, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateLocals); m_engine, &DebuggerEngine::updateLocals);
connect(action(ShowStdNamespace), &SavedAction::valueChanged, connect(&s.showStdNamespace, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateAll); m_engine, &DebuggerEngine::updateAll);
connect(action(ShowQtNamespace), &SavedAction::valueChanged, connect(&s.showQtNamespace, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateAll); m_engine, &DebuggerEngine::updateAll);
connect(action(ShowQObjectNames), &SavedAction::valueChanged, connect(&s.showQObjectNames, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateAll); m_engine, &DebuggerEngine::updateAll);
connect(action(UseAnnotationsInMainEditor), &SavedAction::valueChanged, connect(&s.useAnnotationsInMainEditor, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateAll); m_engine, &DebuggerEngine::updateAll);
connect(SessionManager::instance(), &SessionManager::sessionLoaded, connect(SessionManager::instance(), &SessionManager::sessionLoaded,
@@ -566,9 +566,9 @@ static QString niceTypeHelper(const QString &typeIn)
QString WatchModel::removeNamespaces(QString str) const QString WatchModel::removeNamespaces(QString str) const
{ {
if (!boolSetting(ShowStdNamespace)) if (!debuggerSettings()->showStdNamespace.value())
str.remove("std::"); str.remove("std::");
if (!boolSetting(ShowQtNamespace)) { if (!debuggerSettings()->showQtNamespace.value()) {
const QString qtNamespace = m_engine->qtNamespace(); const QString qtNamespace = m_engine->qtNamespace();
if (!qtNamespace.isEmpty()) if (!qtNamespace.isEmpty())
str.remove(qtNamespace); str.remove(qtNamespace);
@@ -1055,7 +1055,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
} }
case Qt::ToolTipRole: case Qt::ToolTipRole:
return boolSetting(UseToolTipsInLocalsView) return debuggerSettings()->useToolTipsInLocalsView.value()
? item->toToolTip() : QVariant(); ? item->toToolTip() : QVariant();
case Qt::ForegroundRole: case Qt::ForegroundRole:
@@ -1757,12 +1757,13 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(UseDebuggingHelpers)->action()); DebuggerSettings &s = *debuggerSettings();
menu->addAction(action(UseToolTipsInLocalsView)->action()); menu->addAction(s.useDebuggingHelpers.action());
menu->addAction(action(AutoDerefPointers)->action()); menu->addAction(s.useToolTipsInLocalsView.action());
menu->addAction(action(SortStructMembers)->action()); menu->addAction(s.autoDerefPointers.action());
menu->addAction(action(UseDynamicType)->action()); menu->addAction(s.sortStructMembers.action());
menu->addAction(action(SettingsDialog)->action()); menu->addAction(s.useDynamicType.action());
menu->addAction(s.settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
@@ -2114,7 +2115,7 @@ void WatchHandler::insertItems(const GdbMi &data)
{ {
QSet<WatchItem *> itemsToSort; QSet<WatchItem *> itemsToSort;
const bool sortStructMembers = boolSetting(SortStructMembers); const bool sortStructMembers = debuggerSettings()->sortStructMembers.value();
for (const GdbMi &child : data) { for (const GdbMi &child : data) {
auto item = new WatchItem; auto item = new WatchItem;
item->parse(child, sortStructMembers); item->parse(child, sortStructMembers);
@@ -2255,7 +2256,7 @@ void WatchHandler::notifyUpdateFinished()
}); });
QMap<QString, QString> values; QMap<QString, QString> values;
if (boolSetting(UseAnnotationsInMainEditor)) { if (debuggerSettings()->useAnnotationsInMainEditor.value()) {
m_model->forAllItems([&values](WatchItem *item) { m_model->forAllItems([&values](WatchItem *item) {
const QString expr = item->sourceExpression(); const QString expr = item->sourceExpression();
if (!expr.isEmpty()) if (!expr.isEmpty())

View File

@@ -30,8 +30,8 @@
#include "debuggercore.h" #include "debuggercore.h"
#include "watchhandler.h" #include "watchhandler.h"
#include <utils/aspects.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QHeaderView> #include <QHeaderView>
#include <QScrollBar> #include <QScrollBar>
@@ -54,7 +54,7 @@ WatchTreeView::WatchTreeView(WatchType type)
connect(this, &QTreeView::expanded, this, &WatchTreeView::expandNode); connect(this, &QTreeView::expanded, this, &WatchTreeView::expandNode);
connect(this, &QTreeView::collapsed, this, &WatchTreeView::collapseNode); connect(this, &QTreeView::collapsed, this, &WatchTreeView::collapseNode);
connect(action(LogTimeStamps)->action(), &QAction::triggered, connect(&debuggerSettings()->logTimeStamps, &Utils::BaseAspect::changed,
this, &WatchTreeView::updateTimeColumn); this, &WatchTreeView::updateTimeColumn);
} }
@@ -106,7 +106,8 @@ void WatchTreeView::setModel(QAbstractItemModel *model)
void WatchTreeView::updateTimeColumn() void WatchTreeView::updateTimeColumn()
{ {
if (header()) if (header())
header()->setSectionHidden(WatchModelBase::TimeColumn, !boolSetting(LogTimeStamps)); header()->setSectionHidden(WatchModelBase::TimeColumn,
debuggerSettings()->logTimeStamps.value());
} }
void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx) void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx)