Debugger: Adapt to latest settings access style

Change-Id: I14f737612b4fe6a37e650190b587ef0b04e559ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-07-13 15:23:29 +02:00
parent 9b2075e7ea
commit a5e773aeee
25 changed files with 202 additions and 214 deletions

View File

@@ -1101,10 +1101,10 @@ QVariant BreakpointItem::data(int column, int role) const
break; break;
} }
if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInBreakpointsView.value()) if (role == Qt::ToolTipRole && settings().useToolTipsInBreakpointsView())
return toolTip(); return toolTip();
return QVariant(); return {};
} }
void BreakpointItem::addToCommand(DebuggerCommand *cmd, BreakpointPathUsage defaultPathUsage) const void BreakpointItem::addToCommand(DebuggerCommand *cmd, BreakpointPathUsage defaultPathUsage) const
@@ -1689,8 +1689,8 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
menu->addAction(debuggerSettings()->useToolTipsInBreakpointsView.action()); menu->addAction(settings().useToolTipsInBreakpointsView.action());
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
@@ -2219,10 +2219,10 @@ QVariant GlobalBreakpointItem::data(int column, int role) const
break; break;
} }
if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInBreakpointsView.value()) if (role == Qt::ToolTipRole && settings().useToolTipsInBreakpointsView())
return toolTip(); return toolTip();
return QVariant(); return {};
} }
QIcon GlobalBreakpointItem::icon() const QIcon GlobalBreakpointItem::icon() const
@@ -2495,7 +2495,7 @@ void BreakpointManager::setOrRemoveBreakpoint(const ContextData &location, const
BreakpointParameters data; BreakpointParameters data;
if (location.type == LocationByFile) { if (location.type == LocationByFile) {
data.type = BreakpointByFileAndLine; data.type = BreakpointByFileAndLine;
if (debuggerSettings()->breakpointsFullPathByDefault.value()) if (settings().breakpointsFullPathByDefault())
data.pathUsage = BreakpointUseFullPath; data.pathUsage = BreakpointUseFullPath;
data.tracepoint = !tracePointMessage.isEmpty(); data.tracepoint = !tracePointMessage.isEmpty();
data.message = tracePointMessage; data.message = tracePointMessage;
@@ -2686,8 +2686,8 @@ bool BreakpointManager::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
menu->addAction(debuggerSettings()->useToolTipsInBreakpointsView.action()); menu->addAction(settings().useToolTipsInBreakpointsView.action());
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());

View File

@@ -178,17 +178,17 @@ CdbEngine::CdbEngine() :
wh->addTypeFormats("QImage", imageFormats); wh->addTypeFormats("QImage", imageFormats);
wh->addTypeFormats("QImage *", imageFormats); wh->addTypeFormats("QImage *", imageFormats);
DebuggerSettings *s = debuggerSettings(); DebuggerSettings &s = settings();
connect(s->createFullBacktrace.action(), &QAction::triggered, connect(s.createFullBacktrace.action(), &QAction::triggered,
this, &CdbEngine::createFullBacktrace); this, &CdbEngine::createFullBacktrace);
connect(&m_process, &Process::started, this, &CdbEngine::processStarted); connect(&m_process, &Process::started, this, &CdbEngine::processStarted);
connect(&m_process, &Process::done, this, &CdbEngine::processDone); connect(&m_process, &Process::done, this, &CdbEngine::processDone);
m_process.setStdOutLineCallback([this](const QString &line) { parseOutputLine(line); }); m_process.setStdOutLineCallback([this](const QString &line) { parseOutputLine(line); });
m_process.setStdErrLineCallback([this](const QString &line) { parseOutputLine(line); }); m_process.setStdErrLineCallback([this](const QString &line) { parseOutputLine(line); });
connect(&s->useDebuggingHelpers, &BaseAspect::changed, connect(&s.useDebuggingHelpers, &BaseAspect::changed,
this, &CdbEngine::updateLocals); this, &CdbEngine::updateLocals);
if (s->useCodeModel.value()) if (s.useCodeModel())
m_codeModelSnapshot = CppEditor::CppModelManager::snapshot(); m_codeModelSnapshot = CppEditor::CppModelManager::snapshot();
} }
@@ -225,7 +225,7 @@ void CdbEngine::init()
} }
const SourcePathMap &sourcePathMap const SourcePathMap &sourcePathMap
= mergePlatformQtPath(runParameters(), debuggerSettings()->sourcePathMap.value()); = mergePlatformQtPath(runParameters(), settings().sourcePathMap());
if (!sourcePathMap.isEmpty()) { if (!sourcePathMap.isEmpty()) {
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) { for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); it != cend; ++it) {
m_sourcePathMappings.push_back({QDir::toNativeSeparators(it.key()), m_sourcePathMappings.push_back({QDir::toNativeSeparators(it.key()),
@@ -364,8 +364,8 @@ void CdbEngine::setupEngine()
if (sp.useTerminal) // Separate console if (sp.useTerminal) // Separate console
debugger.addArg("-2"); debugger.addArg("-2");
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
if (s.ignoreFirstChanceAccessViolation.value()) if (s.ignoreFirstChanceAccessViolation())
debugger.addArg("-x"); debugger.addArg("-x");
const QStringList &sourcePaths = s.cdbSourcePaths.value(); const QStringList &sourcePaths = s.cdbSourcePaths.value();
@@ -472,8 +472,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);
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
QStringList symbolPaths = s.cdbSymbolPaths.value(); QStringList symbolPaths = s.cdbSymbolPaths();
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;
@@ -493,7 +493,7 @@ void CdbEngine::handleInitialSessionIdle()
+ " secondChance=" + (s.secondChanceExceptionTaskEntry() ? "1" : "0") + " secondChance=" + (s.secondChanceExceptionTaskEntry() ? "1" : "0")
, NoFlags}); , NoFlags});
if (s.cdbUsePythonDumper.value()) if (s.cdbUsePythonDumper())
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) {
@@ -551,13 +551,13 @@ void CdbEngine::runEngine()
if (debug) if (debug)
qDebug("runEngine"); qDebug("runEngine");
const QStringList breakEvents = debuggerSettings()->cdbBreakEvents.value(); const QStringList breakEvents = settings().cdbBreakEvents();
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 (debuggerSettings()->cdbBreakOnCrtDbgReport.value()) { if (settings().cdbBreakOnCrtDbgReport()) {
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) ||
@@ -570,11 +570,11 @@ void CdbEngine::runEngine()
runCommand({breakAtFunctionCommand(Constants::CRT_DEBUG_REPORT, debugModule), BuiltinCommand, cb}); runCommand({breakAtFunctionCommand(Constants::CRT_DEBUG_REPORT, debugModule), BuiltinCommand, cb});
} }
} }
// if (debuggerSettings()->breakOnWarning.value())) { // if (settings().breakOnWarning())) {
// 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 (debuggerSettion()->breakOnFatal.value()) { // if (settings().breakOnFatal()) {
// 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});
// } // }
@@ -1058,7 +1058,7 @@ void CdbEngine::activateFrame(int index)
void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
{ {
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
if (m_pythonVersion > 0x030000) { if (m_pythonVersion > 0x030000) {
watchHandler()->notifyUpdateStarted(updateParameters); watchHandler()->notifyUpdateStarted(updateParameters);
@@ -1068,21 +1068,21 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", s.useDebuggingHelpers.value()); cmd.arg("fancy", s.useDebuggingHelpers());
cmd.arg("autoderef", s.autoDerefPointers.value()); cmd.arg("autoderef", s.autoDerefPointers());
cmd.arg("dyntype", s.useDynamicType.value()); cmd.arg("dyntype", s.useDynamicType());
cmd.arg("partialvar", updateParameters.partialVariable); cmd.arg("partialvar", updateParameters.partialVariable);
cmd.arg("qobjectnames", s.showQObjectNames.value()); cmd.arg("qobjectnames", s.showQObjectNames());
cmd.arg("timestamps", s.logTimeStamps.value()); cmd.arg("timestamps", s.logTimeStamps());
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", s.maximalStringLength.value()); cmd.arg("stringcutoff", s.maximalStringLength());
cmd.arg("displaystringlimit", s.displayStringLimit.value()); cmd.arg("displaystringlimit", s.displayStringLimit());
if (s.useCodeModel.value()) { if (s.useCodeModel()) {
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);
@@ -1141,9 +1141,9 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
} }
} }
str << blankSeparator << "-v"; str << blankSeparator << "-v";
if (s.useDebuggingHelpers.value()) if (s.useDebuggingHelpers())
str << blankSeparator << "-c"; str << blankSeparator << "-c";
if (s.sortStructMembers.value()) if (s.sortStructMembers())
str << blankSeparator << "-a"; str << blankSeparator << "-a";
const QString typeFormats = watchHandler()->typeFormatRequests(); const QString typeFormats = watchHandler()->typeFormatRequests();
if (!typeFormats.isEmpty()) if (!typeFormats.isEmpty())
@@ -1153,7 +1153,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 (s.useCodeModel.value()) { if (s.useCodeModel()) {
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()) {
@@ -2503,7 +2503,7 @@ void CdbEngine::insertBreakpoint(const Breakpoint &bp)
new BreakpointCorrectionContext(m_codeModelSnapshot, CppEditor::CppModelManager::workingCopy())); new BreakpointCorrectionContext(m_codeModelSnapshot, CppEditor::CppModelManager::workingCopy()));
if (!m_autoBreakPointCorrection if (!m_autoBreakPointCorrection
&& parameters.type == BreakpointByFileAndLine && parameters.type == BreakpointByFileAndLine
&& debuggerSettings()->cdbBreakPointCorrection.value()) { && settings().cdbBreakPointCorrection()) {
response.textPosition.line = response.textPosition.line =
int(lineCorrection->fixLineNumber(parameters.fileName, int(lineCorrection->fixLineNumber(parameters.fileName,
unsigned(parameters.textPosition.line))); unsigned(parameters.textPosition.line)));
@@ -2825,13 +2825,13 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
runCommand({"theDumper = Dumper()", ScriptCommand}); runCommand({"theDumper = Dumper()", ScriptCommand});
} }
const FilePath path = debuggerSettings()->extraDumperFile(); const FilePath path = settings().extraDumperFile();
if (!path.isEmpty() && path.isReadableFile()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand); DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand);
cmd.arg("path", path.path()); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }
const QString commands = debuggerSettings()->extraDumperCommands.value(); const QString commands = settings().extraDumperCommands();
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

@@ -159,7 +159,7 @@ private:
void apply() final; void apply() final;
void finish() final; void finish() final;
Utils::AspectContainer &m_group = debuggerSettings()->page5; Utils::AspectContainer &m_group = settings().page5;
CdbBreakEventWidget *m_breakEventWidget; CdbBreakEventWidget *m_breakEventWidget;
}; };
@@ -167,9 +167,9 @@ CdbOptionsPageWidget::CdbOptionsPageWidget()
: m_breakEventWidget(new CdbBreakEventWidget) : m_breakEventWidget(new CdbBreakEventWidget)
{ {
using namespace Layouting; using namespace Layouting;
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
m_breakEventWidget->setBreakEvents(debuggerSettings()->cdbBreakEvents.value()); m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents.value());
Column { Column {
Row { Row {
@@ -215,12 +215,12 @@ void CdbOptionsPageWidget::apply()
{ {
m_group.apply(); m_group.apply();
m_group.writeSettings(); m_group.writeSettings();
debuggerSettings()->cdbBreakEvents.setValue(m_breakEventWidget->breakEvents()); settings().cdbBreakEvents.setValue(m_breakEventWidget->breakEvents());
} }
void CdbOptionsPageWidget::finish() void CdbOptionsPageWidget::finish()
{ {
m_breakEventWidget->setBreakEvents(debuggerSettings()->cdbBreakEvents.value()); m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents.value());
m_group.finish(); m_group.finish();
} }
@@ -243,7 +243,7 @@ public:
void apply() final; void apply() final;
void finish() final; void finish() final;
AspectContainer &m_group = debuggerSettings()->page6; AspectContainer &m_group = settings().page6;
private: private:
PathListEditor *m_symbolPaths = nullptr; PathListEditor *m_symbolPaths = nullptr;
@@ -266,15 +266,15 @@ CdbPathsPageWidget::CdbPathsPageWidget()
void CdbPathsPageWidget::apply() void CdbPathsPageWidget::apply()
{ {
debuggerSettings()->cdbSymbolPaths.setValue(m_symbolPaths->pathList()); settings().cdbSymbolPaths.setValue(m_symbolPaths->pathList());
debuggerSettings()->cdbSourcePaths.setValue(m_sourcePaths->pathList()); settings().cdbSourcePaths.setValue(m_sourcePaths->pathList());
m_group.writeSettings(); m_group.writeSettings();
} }
void CdbPathsPageWidget::finish() void CdbPathsPageWidget::finish()
{ {
m_symbolPaths->setPathList(debuggerSettings()->cdbSymbolPaths.value()); m_symbolPaths->setPathList(settings().cdbSymbolPaths());
m_sourcePaths->setPathList(debuggerSettings()->cdbSourcePaths.value()); m_sourcePaths->setPathList(settings().cdbSourcePaths());
} }
CdbPathsPage::CdbPathsPage() CdbPathsPage::CdbPathsPage()

View File

@@ -26,7 +26,7 @@ class CommonOptionsPageWidget : public Core::IOptionsPageWidget
public: public:
explicit CommonOptionsPageWidget() explicit CommonOptionsPageWidget()
{ {
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
setOnApply([&s] { setOnApply([&s] {
const bool originalPostMortem = s.registerForPostMortem->value(); const bool originalPostMortem = s.registerForPostMortem->value();
@@ -113,7 +113,7 @@ class LocalsAndExpressionsOptionsPageWidget : public IOptionsPageWidget
public: public:
LocalsAndExpressionsOptionsPageWidget() LocalsAndExpressionsOptionsPageWidget()
{ {
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
setOnApply([&s] { s.page4.apply(); s.page4.writeSettings(); }); setOnApply([&s] { s.page4.apply(); s.page4.writeSettings(); });
setOnFinish([&s] { s.page4.finish(); }); setOnFinish([&s] { s.page4.finish(); });

View File

@@ -33,18 +33,14 @@ const char cdbSettingsGroupC[] = "CDB2";
// //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static DebuggerSettings *theDebuggerSettings_ = nullptr; DebuggerSettings &settings()
DebuggerSettings *debuggerSettings()
{ {
QTC_CHECK(theDebuggerSettings_); static DebuggerSettings settings;
return theDebuggerSettings_; return settings;
} }
DebuggerSettings::DebuggerSettings() DebuggerSettings::DebuggerSettings()
{ {
theDebuggerSettings_ = this;
const QString debugModeGroup(debugModeSettingsGroupC); const QString debugModeGroup(debugModeSettingsGroupC);
const QString cdbSettingsGroup(cdbSettingsGroupC); const QString cdbSettingsGroup(cdbSettingsGroupC);
@@ -482,8 +478,8 @@ void DebuggerSettings::writeSettings() const
QString DebuggerSettings::dump() QString DebuggerSettings::dump()
{ {
QStringList settings; QStringList msg;
debuggerSettings()->all.forEachAspect([&settings](BaseAspect *aspect) { settings().all.forEachAspect([&msg](BaseAspect *aspect) {
QString key = aspect->settingsKey(); QString key = aspect->settingsKey();
if (!key.isEmpty()) { if (!key.isEmpty()) {
const int pos = key.indexOf('/'); const int pos = key.indexOf('/');
@@ -494,11 +490,11 @@ QString DebuggerSettings::dump()
QString setting = key + ": " + current + " (default: " + default_ + ')'; QString setting = key + ": " + current + " (default: " + default_ + ')';
if (current != default_) if (current != default_)
setting += " ***"; setting += " ***";
settings << setting; msg << setting;
} }
}); });
settings.sort(); msg.sort();
return "Debugger settings:\n" + settings.join('\n'); return "Debugger settings:\n" + msg.join('\n');
} }
} // Debugger::Internal } // Debugger::Internal

View File

@@ -148,7 +148,7 @@ private:
DebuggerSettings &operator=(const DebuggerSettings &) = delete; DebuggerSettings &operator=(const DebuggerSettings &) = delete;
}; };
DebuggerSettings *debuggerSettings(); DebuggerSettings &settings();
} // Debugger::Internal } // Debugger::Internal

View File

@@ -265,7 +265,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(&debuggerSettings()->enableReverseDebugging, &BaseAspect::changed, this, [this] { connect(&settings().enableReverseDebugging, &BaseAspect::changed, this, [this] {
updateState(); updateState();
if (m_companionEngine) if (m_companionEngine)
m_companionEngine->d->updateState(); m_companionEngine->d->updateState();
@@ -406,7 +406,7 @@ public:
m_watchHandler.cleanup(); m_watchHandler.cleanup();
m_engine->showMessage(Tr::tr("Debugger finished."), StatusBar); m_engine->showMessage(Tr::tr("Debugger finished."), StatusBar);
m_engine->setState(DebuggerFinished); // Also destroys views. m_engine->setState(DebuggerFinished); // Also destroys views.
if (debuggerSettings()->switchModeOnExit.value()) if (settings().switchModeOnExit())
EngineManager::deactivateDebugMode(); EngineManager::deactivateDebugMode();
} }
@@ -805,10 +805,10 @@ void DebuggerEnginePrivate::setupViews()
m_perspective->addToolBarWidget(m_threadsHandler.threadSwitcher()); m_perspective->addToolBarWidget(m_threadsHandler.threadSwitcher());
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged, connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
this, [this](const FontSettings &settings) { this, [this](const FontSettings &fs) {
if (!debuggerSettings()->fontSizeFollowsEditor.value()) if (!Internal::settings().fontSizeFollowsEditor())
return; return;
const qreal size = settings.fontZoom() * settings.fontSize() / 100.; const qreal size = fs.fontZoom() * fs.fontSize() / 100.;
QFont font = m_breakWindow->font(); QFont font = m_breakWindow->font();
font.setPointSizeF(size); font.setPointSizeF(size);
m_breakWindow->setFont(font); m_breakWindow->setFont(font);
@@ -1085,7 +1085,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, !debuggerSettings()->stationaryEditorWhileStepping.value()); editor->gotoLine(line, 0, !settings().stationaryEditorWhileStepping());
if (newEditor) if (newEditor)
editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true); editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
@@ -1348,7 +1348,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
d->m_perspective->select(); d->m_perspective->select();
showMessage(Tr::tr("Stopped."), StatusBar); showMessage(Tr::tr("Stopped."), StatusBar);
setState(InferiorStopOk); setState(InferiorStopOk);
if (debuggerSettings()->raiseOnInterrupt.value()) if (settings().raiseOnInterrupt())
ICore::raiseWindow(DebuggerMainWindow::instance()); ICore::raiseWindow(DebuggerMainWindow::instance());
} }
@@ -1408,8 +1408,8 @@ void DebuggerEnginePrivate::setInitialActionStates()
m_jumpToLineAction.setVisible(false); m_jumpToLineAction.setVisible(false);
m_stepOverAction.setEnabled(true); m_stepOverAction.setEnabled(true);
debuggerSettings()->autoDerefPointers.setEnabled(true); settings().autoDerefPointers.setEnabled(true);
debuggerSettings()->expandStack.setEnabled(false); settings().expandStack.setEnabled(false);
if (m_threadLabel) if (m_threadLabel)
m_threadLabel->setEnabled(false); m_threadLabel->setEnabled(false);
@@ -1549,9 +1549,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);
debuggerSettings()->autoDerefPointers.setEnabled(canDeref); settings().autoDerefPointers.setEnabled(canDeref);
debuggerSettings()->autoDerefPointers.setEnabled(true); settings().autoDerefPointers.setEnabled(true);
debuggerSettings()->expandStack.setEnabled(actionsEnabled); settings().expandStack.setEnabled(actionsEnabled);
const bool notbusy = state == InferiorStopOk const bool notbusy = state == InferiorStopOk
|| state == DebuggerNotReady || state == DebuggerNotReady
@@ -1563,7 +1563,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 = debuggerSettings()->enableReverseDebugging.value(); const bool reverseEnabled = settings().enableReverseDebugging();
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();
@@ -1581,8 +1581,8 @@ void DebuggerEnginePrivate::updateReverseActions()
void DebuggerEnginePrivate::cleanupViews() void DebuggerEnginePrivate::cleanupViews()
{ {
const bool closeSource = debuggerSettings()->closeSourceBuffersOnExit.value(); const bool closeSource = settings().closeSourceBuffersOnExit();
const bool closeMemory = debuggerSettings()->closeMemoryBuffersOnExit.value(); const bool closeMemory = settings().closeMemoryBuffersOnExit();
QList<IDocument *> toClose; QList<IDocument *> toClose;
const QList<IDocument *> documents = DocumentModel::openedDocuments(); const QList<IDocument *> documents = DocumentModel::openedDocuments();
@@ -1869,7 +1869,7 @@ QString DebuggerEngine::expand(const QString &string) const
QString DebuggerEngine::nativeStartupCommands() const QString DebuggerEngine::nativeStartupCommands() const
{ {
QStringList lines = debuggerSettings()->gdbStartupCommands.value().split('\n'); QStringList lines = settings().gdbStartupCommands().split('\n');
lines += runParameters().additionalStartupCommands.split('\n'); lines += runParameters().additionalStartupCommands.split('\n');
lines = Utils::filtered(lines, [](const QString line) { lines = Utils::filtered(lines, [](const QString line) {
@@ -2717,7 +2717,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
{ {
static const QString warnOnInappropriateDebuggerKey = "DebuggerWarnOnInappropriateDebugger"; static const QString warnOnInappropriateDebuggerKey = "DebuggerWarnOnInappropriateDebugger";
const bool warnOnRelease = debuggerSettings()->warnOnReleaseBuilds.value() const bool warnOnRelease = settings().warnOnReleaseBuilds()
&& rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor; && rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor;
bool warnOnInappropriateDebugger = false; bool warnOnInappropriateDebugger = false;
QString detailedWarning; QString detailedWarning;
@@ -2818,7 +2818,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0; bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0;
bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0; bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0;
if (hasEmbeddedInfo) { if (hasEmbeddedInfo) {
const SourcePathMap sourcePathMap = debuggerSettings()->sourcePathMap.value(); const SourcePathMap sourcePathMap = settings().sourcePathMap();
QList<QPair<QRegularExpression, QString>> globalRegExpSourceMap; QList<QPair<QRegularExpression, QString>> globalRegExpSourceMap;
globalRegExpSourceMap.reserve(sourcePathMap.size()); globalRegExpSourceMap.reserve(sourcePathMap.size());
for (auto it = sourcePathMap.begin(), end = sourcePathMap.end(); it != end; ++it) { for (auto it = sourcePathMap.begin(), end = sourcePathMap.end(); it != end; ++it) {

View File

@@ -585,7 +585,7 @@ public:
void writeSettings() void writeSettings()
{ {
m_debuggerSettings.writeSettings(); settings().writeSettings();
// writeWindowSettings(); // writeWindowSettings();
} }
@@ -684,7 +684,6 @@ public:
QTimer m_shutdownTimer; QTimer m_shutdownTimer;
Console m_console; // ensure Debugger Console is created before settings are taken into account Console m_console; // ensure Debugger Console is created before settings are taken into account
DebuggerSettings m_debuggerSettings;
QStringList m_arguments; QStringList m_arguments;
DebuggerItemManager m_debuggerItemManager; DebuggerItemManager m_debuggerItemManager;
@@ -771,7 +770,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
Tr::tr("Debugger Runtime"), Tr::tr("Debugger Runtime"),
Tr::tr("Issues with starting the debugger.")}); Tr::tr("Issues with starting the debugger.")});
m_debuggerSettings.readSettings(); settings().readSettings();
const auto addLabel = [](QWidget *widget, const QString &text) { const auto addLabel = [](QWidget *widget, const QString &text) {
auto vbox = qobject_cast<QVBoxLayout *>(widget->layout()); auto vbox = qobject_cast<QVBoxLayout *>(widget->layout());
@@ -784,10 +783,10 @@ 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,
this, [widget](const FontSettings &settings) { this, [widget](const FontSettings &fs) {
if (!debuggerSettings()->fontSizeFollowsEditor.value()) if (!settings().fontSizeFollowsEditor())
return; return;
qreal size = settings.fontZoom() * settings.fontSize() / 100.; qreal size = fs.fontZoom() * fs.fontSize() / 100.;
QFont font = widget->font(); QFont font = widget->font();
font.setPointSizeF(size); font.setPointSizeF(size);
widget->setFont(font); widget->setFont(font);
@@ -1173,7 +1172,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
// Application interaction // Application interaction
// Use a queued connection so the dialog isn't triggered in the same event. // Use a queued connection so the dialog isn't triggered in the same event.
connect(debuggerSettings()->settingsDialog.action(), &QAction::triggered, this, connect(settings().settingsDialog.action(), &QAction::triggered, this,
[] { ICore::showOptionsDialog(DEBUGGER_COMMON_SETTINGS_ID); }, Qt::QueuedConnection); [] { ICore::showOptionsDialog(DEBUGGER_COMMON_SETTINGS_ID); }, Qt::QueuedConnection);
m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser()); m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser());
@@ -1475,10 +1474,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);
DebuggerSettings *s = debuggerSettings(); DebuggerSettings &s = settings();
s->autoDerefPointers.setEnabled(canDeref); s.autoDerefPointers.setEnabled(canDeref);
s->autoDerefPointers.setEnabled(true); s.autoDerefPointers.setEnabled(true);
s->expandStack.setEnabled(actionsEnabled); s.expandStack.setEnabled(actionsEnabled);
m_startAndDebugApplicationAction.setEnabled(true); m_startAndDebugApplicationAction.setEnabled(true);
m_attachToQmlPortAction.setEnabled(true); m_attachToQmlPortAction.setEnabled(true);
@@ -1973,8 +1972,8 @@ void DebuggerPluginPrivate::setInitialState()
m_enableOrDisableBreakpointAction.setEnabled(false); m_enableOrDisableBreakpointAction.setEnabled(false);
//m_snapshotAction.setEnabled(false); //m_snapshotAction.setEnabled(false);
debuggerSettings()->autoDerefPointers.setEnabled(true); settings().autoDerefPointers.setEnabled(true);
debuggerSettings()->expandStack.setEnabled(false); settings().expandStack.setEnabled(false);
} }
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu() void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
@@ -2069,11 +2068,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
QWidget *DebuggerPluginPrivate::addSearch(BaseTreeView *treeView) QWidget *DebuggerPluginPrivate::addSearch(BaseTreeView *treeView)
{ {
BoolAspect &act = debuggerSettings()->useAlternatingRowColors; BoolAspect &act = settings().useAlternatingRowColors;
treeView->setAlternatingRowColors(act.value()); treeView->setAlternatingRowColors(act());
treeView->setProperty(PerspectiveState::savesHeaderKey(), true); treeView->setProperty(PerspectiveState::savesHeaderKey(), true);
connect(&act, &BaseAspect::changed, treeView, [treeView] { connect(&act, &BaseAspect::changed, treeView, [treeView] {
treeView->setAlternatingRowColors(debuggerSettings()->useAlternatingRowColors.value()); treeView->setAlternatingRowColors(settings().useAlternatingRowColors());
}); });
return ItemViewFind::createSearchableWrapper(treeView); return ItemViewFind::createSearchableWrapper(treeView);

View File

@@ -293,7 +293,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)
&& debuggerSettings()->useCdbConsole.value(); && settings().useCdbConsole();
if (on && !d->terminalRunner && !useCdbConsole) { if (on && !d->terminalRunner && !useCdbConsole) {
d->terminalRunner = d->terminalRunner =
@@ -759,7 +759,7 @@ bool DebuggerRunTool::fixupParameters()
} }
} }
if (!debuggerSettings()->autoEnrichParameters.value()) { if (settings().autoEnrichParameters()) {
const FilePath sysroot = rp.sysRoot; const FilePath sysroot = rp.sysRoot;
if (rp.debugInfoLocation.isEmpty()) if (rp.debugInfoLocation.isEmpty())
rp.debugInfoLocation = sysroot / "/usr/lib/debug"; rp.debugInfoLocation = sysroot / "/usr/lib/debug";
@@ -816,7 +816,7 @@ bool DebuggerRunTool::fixupParameters()
if (rp.isNativeMixedDebugging()) if (rp.isNativeMixedDebugging())
rp.inferior.environment.set("QV4_FORCE_INTERPRETER", "1"); rp.inferior.environment.set("QV4_FORCE_INTERPRETER", "1");
if (debuggerSettings()->forceLoggingToConsole.value()) if (settings().forceLoggingToConsole())
rp.inferior.environment.set("QT_LOGGING_TO_CONSOLE", "1"); rp.inferior.environment.set("QT_LOGGING_TO_CONSOLE", "1");
return true; return true;

View File

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

View File

@@ -29,6 +29,7 @@
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
using namespace Utils;
namespace Debugger::Internal { namespace Debugger::Internal {
@@ -43,9 +44,7 @@ class DisassemblerBreakpointMarker : public TextMark
{ {
public: public:
DisassemblerBreakpointMarker(const Breakpoint &bp, int lineNumber) DisassemblerBreakpointMarker(const Breakpoint &bp, int lineNumber)
: TextMark(Utils::FilePath(), : TextMark({}, lineNumber, {Tr::tr("Breakpoint"), Constants::TEXT_MARK_CATEGORY_BREAKPOINT})
lineNumber,
{Tr::tr("Breakpoint"), Constants::TEXT_MARK_CATEGORY_BREAKPOINT})
, m_bp(bp) , m_bp(bp)
{ {
setIcon(bp->icon()); setIcon(bp->icon());
@@ -161,7 +160,7 @@ int DisassemblerAgentPrivate::lineForAddress(quint64 address) const
DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine) DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine)
: d(new DisassemblerAgentPrivate(engine)) : d(new DisassemblerAgentPrivate(engine))
{ {
connect(&debuggerSettings()->intelFlavor, &Utils::BaseAspect::changed, connect(&settings().intelFlavor, &Utils::BaseAspect::changed,
this, &DisassemblerAgent::reload); this, &DisassemblerAgent::reload);
} }

View File

@@ -136,7 +136,7 @@ GdbEngine::GdbEngine()
connect(&m_commandTimer, &QTimer::timeout, connect(&m_commandTimer, &QTimer::timeout,
this, &GdbEngine::commandTimeout); this, &GdbEngine::commandTimeout);
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
connect(&s.autoDerefPointers, &BaseAspect::changed, connect(&s.autoDerefPointers, &BaseAspect::changed,
this, &GdbEngine::reloadLocals); this, &GdbEngine::reloadLocals);
connect(s.createFullBacktrace.action(), &QAction::triggered, connect(s.createFullBacktrace.action(), &QAction::triggered,
@@ -417,7 +417,7 @@ void GdbEngine::handleResponse(const QString &buff)
} }
} }
if (debuggerSettings()->logTimeStamps.value()) if (settings().logTimeStamps())
showMessage(QString("Output handled")); showMessage(QString("Output handled"));
} }
@@ -801,7 +801,7 @@ void GdbEngine::runCommand(const DebuggerCommand &command)
int GdbEngine::commandTimeoutTime() const int GdbEngine::commandTimeoutTime() const
{ {
const int time = debuggerSettings()->gdbWatchdogTimeout(); const int time = settings().gdbWatchdogTimeout();
return 1000 * qMax(20, time); return 1000 * qMax(20, time);
} }
@@ -942,7 +942,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 (debuggerSettings()->logTimeStamps.value()) { if (settings().logTimeStamps()) {
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.),
@@ -1016,7 +1016,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(debuggerSettings()->maximalStackDepth())); DebuggerCommand cmd(stackCommand(settings().maximalStackDepth()));
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);
@@ -1124,7 +1124,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
// Jump over well-known frames. // Jump over well-known frames.
//static int stepCounter = 0; //static int stepCounter = 0;
if (debuggerSettings()->skipKnownFrames.value()) { if (settings().skipKnownFrames()) {
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();
@@ -1310,7 +1310,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (!m_systemDumpersLoaded) { if (!m_systemDumpersLoaded) {
m_systemDumpersLoaded = true; m_systemDumpersLoaded = true;
if (m_gdbVersion >= 70400 && debuggerSettings()->loadGdbDumpers.value()) if (m_gdbVersion >= 70400 && settings().loadGdbDumpers())
runCommand({"importPlainDumpers on"}); runCommand({"importPlainDumpers on"});
else else
runCommand({"importPlainDumpers off"}); runCommand({"importPlainDumpers off"});
@@ -1427,7 +1427,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
m_expectTerminalTrap = false; m_expectTerminalTrap = false;
} else { } else {
showMessage("HANDLING SIGNAL " + name); showMessage("HANDLING SIGNAL " + name);
if (debuggerSettings()->useMessageBoxForSignals.value() && !isStopperThread) if (settings().useMessageBoxForSignals() && !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;
@@ -1586,7 +1586,7 @@ FilePath GdbEngine::cleanupFullName(const QString &fileName)
return {}; return {};
} }
if (!debuggerSettings()->autoEnrichParameters.value()) if (!settings().autoEnrichParameters())
return cleanFilePath; return cleanFilePath;
if (cleanFilePath.isReadableFile()) if (cleanFilePath.isReadableFile())
@@ -2042,7 +2042,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 (debuggerSettings()->logTimeStamps.value()) if (settings().logTimeStamps())
showMessage(LogWindow::logTimeStamp(), LogMiscInput); showMessage(LogWindow::logTimeStamp(), LogMiscInput);
m_oldestAcceptableToken = currentToken(); m_oldestAcceptableToken = currentToken();
m_stackNeeded = false; m_stackNeeded = false;
@@ -2164,7 +2164,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);
const bool usePseudoTracepoints = debuggerSettings()->usePseudoTracepoints.value(); const bool usePseudoTracepoints = settings().usePseudoTracepoints();
const QString nr = bkpt["number"].data(); const QString nr = bkpt["number"].data();
if (nr.contains('.')) { if (nr.contains('.')) {
// A sub-breakpoint. // A sub-breakpoint.
@@ -2579,7 +2579,7 @@ void GdbEngine::insertBreakpoint(const Breakpoint &bp)
int spec = requested.threadSpec; int spec = requested.threadSpec;
if (requested.isTracepoint()) { if (requested.isTracepoint()) {
if (debuggerSettings()->usePseudoTracepoints.value()) { if (settings().usePseudoTracepoints()) {
cmd.function = "createTracepoint"; cmd.function = "createTracepoint";
if (requested.oneShot) if (requested.oneShot)
@@ -2615,7 +2615,7 @@ void GdbEngine::insertBreakpoint(const Breakpoint &bp)
// for dumping of expressions // for dumping of expressions
const bool alwaysVerbose = qtcEnvironmentVariableIsSet( const bool alwaysVerbose = qtcEnvironmentVariableIsSet(
"QTC_DEBUGGER_PYTHON_VERBOSE"); "QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", s.useDebuggingHelpers()); cmd.arg("fancy", s.useDebuggingHelpers());
cmd.arg("autoderef", s.autoDerefPointers()); cmd.arg("autoderef", s.autoDerefPointers());
@@ -3116,7 +3116,7 @@ DebuggerCommand GdbEngine::stackCommand(int depth)
void GdbEngine::reloadStack() void GdbEngine::reloadStack()
{ {
PENDING_DEBUG("RELOAD STACK"); PENDING_DEBUG("RELOAD STACK");
DebuggerCommand cmd = stackCommand(debuggerSettings()->maximalStackDepth.value()); DebuggerCommand cmd = stackCommand(settings().maximalStackDepth());
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);
@@ -3180,8 +3180,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 (debuggerSettings()->showThreadNames.value()) { if (settings().showThreadNames()) {
runCommand({QString("threadnames %1").arg(debuggerSettings()->maximalStackDepth.value()), runCommand({QString("threadnames %1").arg(settings().maximalStackDepth()),
Discardable, CB(handleThreadNames)}); Discardable, CB(handleThreadNames)});
} }
reloadStack(); // Will trigger register reload. reloadStack(); // Will trigger register reload.
@@ -3649,7 +3649,7 @@ public:
void GdbEngine::fetchDisassembler(DisassemblerAgent *agent) void GdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{ {
if (debuggerSettings()->intelFlavor.value()) if (settings().intelFlavor())
runCommand({"set disassembly-flavor intel"}); runCommand({"set disassembly-flavor intel"});
else else
runCommand({"set disassembly-flavor att"}); runCommand({"set disassembly-flavor att"});
@@ -3838,7 +3838,7 @@ void GdbEngine::setupEngine()
} }
gdbCommand.addArgs({"-i", "mi"}); gdbCommand.addArgs({"-i", "mi"});
if (!debuggerSettings()->loadGdbInit.value()) if (!settings().loadGdbInit())
gdbCommand.addArg("-n"); gdbCommand.addArg("-n");
// This is filled in DebuggerKitAspect::runnable // This is filled in DebuggerKitAspect::runnable
@@ -3884,7 +3884,7 @@ void GdbEngine::handleGdbStarted()
runCommand({"set breakpoint pending on"}); runCommand({"set breakpoint pending on"});
runCommand({"set print elements 10000"}); runCommand({"set print elements 10000"});
if (debuggerSettings()->useIndexCache.value()) if (settings().useIndexCache())
runCommand({"set index-cache on"}); runCommand({"set index-cache on"});
// Produces a few messages during symtab loading // Produces a few messages during symtab loading
@@ -3929,8 +3929,7 @@ void GdbEngine::handleGdbStarted()
// Apply source path mappings from global options. // Apply source path mappings from global options.
//showMessage(_("Assuming Qt is installed at %1").arg(qtInstallPath)); //showMessage(_("Assuming Qt is installed at %1").arg(qtInstallPath));
const SourcePathMap sourcePathMap = const SourcePathMap sourcePathMap = mergePlatformQtPath(rp, settings().sourcePathMap());
mergePlatformQtPath(rp, debuggerSettings()->sourcePathMap.value());
const SourcePathMap completeSourcePathMap = const SourcePathMap completeSourcePathMap =
mergeStartParametersSourcePathMap(rp, sourcePathMap); mergeStartParametersSourcePathMap(rp, sourcePathMap);
for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd(); for (auto it = completeSourcePathMap.constBegin(), cend = completeSourcePathMap.constEnd();
@@ -3958,7 +3957,7 @@ void GdbEngine::handleGdbStarted()
//if (!ba.isEmpty()) //if (!ba.isEmpty())
// runCommand("set solib-search-path " + ba); // runCommand("set solib-search-path " + ba);
if (debuggerSettings()->multiInferior.value() || runParameters().multiProcess) { if (settings().multiInferior() || 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"});
} }
@@ -4028,14 +4027,14 @@ void GdbEngine::handleGdbStarted()
runCommand({"python from gdbbridge import *"}); runCommand({"python from gdbbridge import *"});
} }
const FilePath path = debuggerSettings()->extraDumperFile(); const FilePath path = settings().extraDumperFile();
if (!path.isEmpty() && path.isReadableFile()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path.path()); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }
const QString commands = expand(debuggerSettings()->extraDumperCommands.value()); const QString commands = expand(settings().extraDumperCommands());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands}); runCommand({commands});
@@ -4252,7 +4251,7 @@ bool GdbEngine::usesExecInterrupt() const
bool GdbEngine::usesTargetAsync() const bool GdbEngine::usesTargetAsync() const
{ {
return runParameters().useTargetAsync || debuggerSettings()->targetAsync.value(); return runParameters().useTargetAsync || settings().targetAsync();
} }
void GdbEngine::scheduleTestResponse(int testCase, const QString &response) void GdbEngine::scheduleTestResponse(int testCase, const QString &response)
@@ -4371,10 +4370,10 @@ void GdbEngine::claimInitialBreakpoints()
showMessage(Tr::tr("Setting breakpoints...")); showMessage(Tr::tr("Setting breakpoints..."));
BreakpointManager::claimBreakpointsForEngine(this); BreakpointManager::claimBreakpointsForEngine(this);
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
const bool onAbort = s.breakOnAbort.value(); const bool onAbort = s.breakOnAbort();
const bool onWarning = s.breakOnWarning.value(); const bool onWarning = s.breakOnWarning();
const bool onFatal = s.breakOnFatal.value(); const bool onFatal = s.breakOnFatal();
if (onAbort || onWarning || onFatal) { if (onAbort || onWarning || onFatal) {
DebuggerCommand cmd("createSpecialBreakpoints"); DebuggerCommand cmd("createSpecialBreakpoints");
cmd.arg("breakonabort", onAbort); cmd.arg("breakonabort", onAbort);
@@ -4612,7 +4611,7 @@ void GdbEngine::handleLocalAttach(const DebuggerResponse &response)
{ {
showMessage("INFERIOR ATTACHED"); showMessage("INFERIOR ATTACHED");
QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value()); QString commands = expand(settings().gdbPostAttachCommands());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands, NativeCommand}); runCommand({commands, NativeCommand});
@@ -4792,7 +4791,7 @@ void GdbEngine::handleExecRun(const DebuggerResponse &response)
if (response.resultClass == ResultRunning) { if (response.resultClass == ResultRunning) {
if (isLocalRunEngine()) { if (isLocalRunEngine()) {
QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value()); QString commands = expand(settings().gdbPostAttachCommands());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands, NativeCommand}); runCommand({commands, NativeCommand});
} }
@@ -4846,7 +4845,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(debuggerSettings()->gdbPostAttachCommands.value()); QString commands = expand(settings().gdbPostAttachCommands());
if (!commands.isEmpty()) if (!commands.isEmpty())
runCommand({commands, NativeCommand}); runCommand({commands, NativeCommand});
handleInferiorPrepared(); handleInferiorPrepared();
@@ -4862,7 +4861,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(debuggerSettings()->gdbPostAttachCommands.value()); QString commands = expand(settings().gdbPostAttachCommands());
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
@@ -5112,20 +5111,20 @@ void GdbEngine::doUpdateLocals(const UpdateParameters &params)
watchHandler()->appendWatchersAndTooltipRequests(&cmd); watchHandler()->appendWatchersAndTooltipRequests(&cmd);
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", s.useDebuggingHelpers.value()); cmd.arg("fancy", s.useDebuggingHelpers());
cmd.arg("autoderef", s.autoDerefPointers.value()); cmd.arg("autoderef", s.autoDerefPointers());
cmd.arg("dyntype", s.useDynamicType.value()); cmd.arg("dyntype", s.useDynamicType());
cmd.arg("qobjectnames", s.showQObjectNames.value()); cmd.arg("qobjectnames", s.showQObjectNames());
cmd.arg("timestamps", s.logTimeStamps.value()); cmd.arg("timestamps", s.logTimeStamps());
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", s.maximalStringLength.value()); cmd.arg("stringcutoff", s.maximalStringLength());
cmd.arg("displaystringlimit", s.displayStringLimit.value()); cmd.arg("displaystringlimit", s.displayStringLimit());
cmd.arg("resultvarname", m_resultVarName); cmd.arg("resultvarname", m_resultVarName);
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);

View File

@@ -69,7 +69,7 @@ LldbEngine::LldbEngine()
setObjectName("LldbEngine"); setObjectName("LldbEngine");
setDebuggerName("LLDB"); setDebuggerName("LLDB");
DebuggerSettings &ds = *debuggerSettings(); DebuggerSettings &ds = settings();
connect(&ds.autoDerefPointers, &BaseAspect::changed, this, &LldbEngine::updateLocals); connect(&ds.autoDerefPointers, &BaseAspect::changed, this, &LldbEngine::updateLocals);
connect(ds.createFullBacktrace.action(), &QAction::triggered, connect(ds.createFullBacktrace.action(), &QAction::triggered,
this, &LldbEngine::fetchFullBacktrace); this, &LldbEngine::fetchFullBacktrace);
@@ -228,14 +228,14 @@ void LldbEngine::handleLldbStarted()
if (!commands.isEmpty()) if (!commands.isEmpty())
executeCommand(commands); executeCommand(commands);
const FilePath path = debuggerSettings()->extraDumperFile(); const FilePath path = settings().extraDumperFile();
if (!path.isEmpty() && path.isReadableFile()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path.path()); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }
commands = debuggerSettings()->extraDumperCommands.value(); commands = settings().extraDumperCommands();
if (!commands.isEmpty()) { if (!commands.isEmpty()) {
DebuggerCommand cmd("executeDebuggerCommand"); DebuggerCommand cmd("executeDebuggerCommand");
cmd.arg("command", commands); cmd.arg("command", commands);
@@ -248,8 +248,7 @@ void LldbEngine::handleLldbStarted()
}; };
runCommand(cmd1); runCommand(cmd1);
const SourcePathMap sourcePathMap = const SourcePathMap sourcePathMap = mergePlatformQtPath(rp, settings().sourcePathMap());
mergePlatformQtPath(rp, debuggerSettings()->sourcePathMap.value());
for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd(); for (auto it = sourcePathMap.constBegin(), cend = sourcePathMap.constEnd();
it != cend; it != cend;
++it) { ++it) {
@@ -468,7 +467,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(debuggerSettings()->maximalStackDepth()); fetchStack(settings().maximalStackDepth());
}; };
runCommand(cmd); runCommand(cmd);
} }
@@ -700,7 +699,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(debuggerSettings()->maximalStackDepth()); fetchStack(settings().maximalStackDepth());
reloadRegisters(); reloadRegisters();
}; };
runCommand(cmd); runCommand(cmd);
@@ -733,21 +732,21 @@ void LldbEngine::doUpdateLocals(const UpdateParameters &params)
watchHandler()->appendWatchersAndTooltipRequests(&cmd); watchHandler()->appendWatchersAndTooltipRequests(&cmd);
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
const DebuggerSettings &s = *debuggerSettings(); const DebuggerSettings &s = settings();
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", s.useDebuggingHelpers.value()); cmd.arg("fancy", s.useDebuggingHelpers());
cmd.arg("autoderef", s.autoDerefPointers.value()); cmd.arg("autoderef", s.autoDerefPointers());
cmd.arg("dyntype", s.useDynamicType.value()); cmd.arg("dyntype", s.useDynamicType());
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);
cmd.arg("qobjectnames", s.showQObjectNames.value()); cmd.arg("qobjectnames", s.showQObjectNames());
cmd.arg("timestamps", s.logTimeStamps.value()); cmd.arg("timestamps", s.logTimeStamps());
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", s.maximalStringLength.value()); cmd.arg("stringcutoff", s.maximalStringLength());
cmd.arg("displaystringlimit", s.displayStringLimit.value()); cmd.arg("displaystringlimit", s.displayStringLimit());
//cmd.arg("resultvarname", m_resultVarName); //cmd.arg("resultvarname", m_resultVarName);
cmd.arg("partialvar", params.partialVariable); cmd.arg("partialvar", params.partialVariable);
@@ -997,7 +996,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", debuggerSettings()->intelFlavor.value() ? "intel" : "att"); cmd.arg("flavor", settings().intelFlavor() ? "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

@@ -193,10 +193,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(debuggerSettings()->logTimeStamps.action()); menu->addAction(settings().logTimeStamps.action());
menu->addAction(Core::ActionManager::command(Constants::RELOAD_DEBUGGING_HELPERS)->action()); menu->addAction(Core::ActionManager::command(Constants::RELOAD_DEBUGGING_HELPERS)->action());
menu->addSeparator(); menu->addSeparator();
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
menu->exec(ev->globalPos()); menu->exec(ev->globalPos());
delete menu; delete menu;
} }
@@ -494,7 +494,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) != '~' && debuggerSettings()->logTimeStamps.value()) { if (output.at(0) != '~' && settings().logTimeStamps()) {
out.append(charForChannel(LogTime)); out.append(charForChannel(LogTime));
out.append(logTimeStamp()); out.append(logTimeStamp());
out.append(nchar); out.append(nchar);
@@ -562,7 +562,7 @@ void LogWindow::showInput(int channel, const QString &input)
m_inputText->setTextCursor(cursor); m_inputText->setTextCursor(cursor);
return; return;
} }
if (debuggerSettings()->logTimeStamps.value()) if (settings().logTimeStamps())
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();
@@ -695,7 +695,7 @@ void GlobalLogWindow::doOutput(const QString &output)
void GlobalLogWindow::doInput(const QString &input) void GlobalLogWindow::doInput(const QString &input)
{ {
if (debuggerSettings()->logTimeStamps.value()) if (settings().logTimeStamps())
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

@@ -205,7 +205,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
canShowSymbols && moduleNameValid, canShowSymbols && moduleNameValid,
[this, modulePath] { engine->requestModuleSections(modulePath); }); [this, modulePath] { engine->requestModuleSections(modulePath); });
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());

View File

@@ -543,7 +543,7 @@ void PdbEngine::updateLocals()
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE"); const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
cmd.arg("passexceptions", alwaysVerbose); cmd.arg("passexceptions", alwaysVerbose);
cmd.arg("fancy", debuggerSettings()->useDebuggingHelpers.value()); cmd.arg("fancy", settings().useDebuggingHelpers());
//cmd.arg("resultvarname", m_resultVarName); //cmd.arg("resultvarname", m_resultVarName);
//m_lastDebuggableCommand = cmd; //m_lastDebuggableCommand = cmd;

View File

@@ -771,7 +771,7 @@ bool PeripheralRegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
menu->addMenu(fmtMenu); menu->addMenu(fmtMenu);
} }
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;

View File

@@ -845,10 +845,9 @@ bool compareConsoleItems(const ConsoleItem *a, const ConsoleItem *b)
return a->text() < b->text(); return a->text() < b->text();
} }
static ConsoleItem *constructLogItemTree(const QVariant &result, static ConsoleItem *constructLogItemTree(const QVariant &result, const QString &key = {})
const QString &key = QString())
{ {
bool sorted = debuggerSettings()->sortStructMembers.value(); const bool sorted = settings().sortStructMembers();
if (!result.isValid()) if (!result.isValid())
return nullptr; return nullptr;
@@ -2234,7 +2233,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 (debuggerSettings()->sortStructMembers.value()) if (settings().sortStructMembers())
std::sort(children.begin(), children.end(), compareConsoleItems); std::sort(children.begin(), children.end(), compareConsoleItems);
for (ConsoleItem *child : std::as_const(children)) for (ConsoleItem *child : std::as_const(children))
@@ -2346,7 +2345,7 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
parent->appendChild(item.release()); parent->appendChild(item.release());
} }
if (debuggerSettings()->sortStructMembers.value()) { if (settings().sortStructMembers()) {
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

@@ -46,12 +46,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(debuggerSettings()->showAppOnTop.action()) , m_showAppOnTopAction(settings().showAppOnTop.action())
{ {
m_debugIdToIname.insert(WatchItem::InvalidId, "inspect"); m_debugIdToIname.insert(WatchItem::InvalidId, "inspect");
connect(&debuggerSettings()->showQmlObjectTree, &Utils::BaseAspect::changed, connect(&settings().showQmlObjectTree, &Utils::BaseAspect::changed,
this, &QmlInspectorAgent::updateState); this, &QmlInspectorAgent::updateState);
connect(&debuggerSettings()->sortStructMembers, &Utils::BaseAspect::changed, connect(&settings().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);
@@ -171,7 +171,7 @@ void QmlInspectorAgent::addObjectWatch(int objectDebugId)
if (objectDebugId == WatchItem::InvalidId) if (objectDebugId == WatchItem::InvalidId)
return; return;
if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value()) if (!isConnected() || !settings().showQmlObjectTree())
return; return;
// already set // already set
@@ -190,8 +190,7 @@ 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 if (m_engineClient->state() == QmlDebugClient::Enabled && settings().showQmlObjectTree())
&& debuggerSettings()->showQmlObjectTree.value())
reloadEngines(); reloadEngines();
else else
clearObjectTree(); clearObjectTree();
@@ -280,7 +279,7 @@ void QmlInspectorAgent::newObject(int engineId, int /*objectId*/, int /*parentId
static void sortChildrenIfNecessary(WatchItem *propertiesWatch) static void sortChildrenIfNecessary(WatchItem *propertiesWatch)
{ {
if (debuggerSettings()->sortStructMembers.value()) { if (settings().sortStructMembers()) {
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;
}); });
@@ -354,7 +353,7 @@ void QmlInspectorAgent::queryEngineContext()
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << "pending queries:" << m_rootContextQueryIds; qCDebug(qmlInspectorLog) << __FUNCTION__ << "pending queries:" << m_rootContextQueryIds;
if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value()) if (!isConnected() || !settings().showQmlObjectTree())
return; return;
log(LogSend, "LIST_OBJECTS"); log(LogSend, "LIST_OBJECTS");
@@ -369,7 +368,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')'; qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')';
if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value()) if (!isConnected() || !settings().showQmlObjectTree())
return; return;
log(LogSend, "FETCH_OBJECT " + QString::number(debugId)); log(LogSend, "FETCH_OBJECT " + QString::number(debugId));
@@ -383,7 +382,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context, int en
{ {
qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')'; qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')';
if (!isConnected() || !debuggerSettings()->showQmlObjectTree.value()) if (!isConnected() || !settings().showQmlObjectTree())
return; return;
for (const ObjectReference &obj : context.objects()) for (const ObjectReference &obj : context.objects())

View File

@@ -811,7 +811,7 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
addFormatAction(Tr::tr("Octal"), OctalFormat); addFormatAction(Tr::tr("Octal"), OctalFormat);
addFormatAction(Tr::tr("Binary"), BinaryFormat); addFormatAction(Tr::tr("Binary"), BinaryFormat);
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;

View File

@@ -114,7 +114,7 @@ bool SourceFilesHandler::setData(const QModelIndex &idx, const QVariant &data, i
addAction(Tr::tr("Open File \"%1\"").arg(name), true, addAction(Tr::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(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -47,9 +47,9 @@ StackHandler::StackHandler(DebuggerEngine *engine)
setObjectName("StackModel"); setObjectName("StackModel");
setHeader({Tr::tr("Level"), Tr::tr("Function"), Tr::tr("File"), Tr::tr("Line"), Tr::tr("Address") }); setHeader({Tr::tr("Level"), Tr::tr("Function"), Tr::tr("File"), Tr::tr("Line"), Tr::tr("Address") });
connect(debuggerSettings()->expandStack.action(), &QAction::triggered, connect(settings().expandStack.action(), &QAction::triggered,
this, &StackHandler::reloadFullStack); this, &StackHandler::reloadFullStack);
connect(debuggerSettings()->maximalStackDepth.action(), &QAction::triggered, connect(settings().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.
@@ -66,7 +66,7 @@ QVariant SpecialStackItem::data(int column, int role) const
return Tr::tr("<More>"); return Tr::tr("<More>");
if (role == Qt::DecorationRole && column == StackLevelColumn) if (role == Qt::DecorationRole && column == StackLevelColumn)
return Icons::EMPTY.icon(); return Icons::EMPTY.icon();
return QVariant(); return {};
} }
QVariant StackFrameItem::data(int column, int role) const QVariant StackFrameItem::data(int column, int role) const
@@ -86,16 +86,16 @@ QVariant StackFrameItem::data(int column, int role) const
return QString("0x%1").arg(frame.address, 0, 16); return QString("0x%1").arg(frame.address, 0, 16);
return QString(); return QString();
} }
return QVariant(); return {};
} }
if (role == Qt::DecorationRole && column == StackLevelColumn) if (role == Qt::DecorationRole && column == StackLevelColumn)
return handler->iconForRow(row); return handler->iconForRow(row);
if (role == Qt::ToolTipRole && debuggerSettings()->useToolTipsInStackView.value()) if (role == Qt::ToolTipRole && settings().useToolTipsInStackView())
return frame.toToolTip(); return frame.toToolTip();
return QVariant(); return {};
} }
Qt::ItemFlags StackFrameItem::flags(int column) const Qt::ItemFlags StackFrameItem::flags(int column) const
@@ -234,8 +234,8 @@ void StackHandler::setFramesAndCurrentIndex(const GdbMi &frames, bool isFull)
targetFrame = i; targetFrame = i;
} }
bool canExpand = !isFull && (n >= debuggerSettings()->maximalStackDepth()); bool canExpand = !isFull && n >= settings().maximalStackDepth();
debuggerSettings()->expandStack.setEnabled(canExpand); settings().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.
@@ -424,7 +424,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(debuggerSettings()->expandStack.action()); menu->addAction(settings().expandStack.action());
addAction(this, menu, Tr::tr("Copy Contents to Clipboard"), true, [ev] { addAction(this, menu, Tr::tr("Copy Contents to Clipboard"), true, [ev] {
setClipboardAndSelection(selectedText(ev.view(), true)); setClipboardAndSelection(selectedText(ev.view(), true));
@@ -437,7 +437,7 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
addAction(this, menu, Tr::tr("Save as Task File..."), true, [this] { saveTaskFile(); }); addAction(this, menu, Tr::tr("Save as Task File..."), true, [this] { saveTaskFile(); });
if (m_engine->hasCapability(CreateFullBacktraceCapability)) if (m_engine->hasCapability(CreateFullBacktraceCapability))
menu->addAction(debuggerSettings()->createFullBacktrace.action()); menu->addAction(settings().createFullBacktrace.action());
if (m_engine->hasCapability(AdditionalQmlStackCapability)) if (m_engine->hasCapability(AdditionalQmlStackCapability))
addAction(this, menu, Tr::tr("Load QML Stack"), true, [this] { m_engine->loadAdditionalQmlStack(); }); addAction(this, menu, Tr::tr("Load QML Stack"), true, [this] { m_engine->loadAdditionalQmlStack(); });
@@ -485,8 +485,8 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
} }
menu->addSeparator(); menu->addSeparator();
menu->addAction(debuggerSettings()->useToolTipsInStackView.action()); menu->addAction(settings().useToolTipsInStackView.action());
menu->addAction(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;

View File

@@ -227,7 +227,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(debuggerSettings()->settingsDialog.action()); menu->addAction(settings().settingsDialog.action());
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;
} }

View File

@@ -525,7 +525,7 @@ WatchModel::WatchModel(WatchHandler *handler, DebuggerEngine *engine)
m_engine->updateLocalsWindow(showReturn); m_engine->updateLocalsWindow(showReturn);
}); });
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
connect(&s.sortStructMembers, &BaseAspect::changed, connect(&s.sortStructMembers, &BaseAspect::changed,
m_engine, &DebuggerEngine::updateLocals); m_engine, &DebuggerEngine::updateLocals);
connect(&s.showStdNamespace, &BaseAspect::changed, connect(&s.showStdNamespace, &BaseAspect::changed,
@@ -581,9 +581,9 @@ static QString niceTypeHelper(const QString &typeIn)
QString WatchModel::removeNamespaces(QString str) const QString WatchModel::removeNamespaces(QString str) const
{ {
if (!debuggerSettings()->showStdNamespace.value()) if (!settings().showStdNamespace())
str.remove("std::"); str.remove("std::");
if (!debuggerSettings()->showQtNamespace.value()) { if (!settings().showQtNamespace()) {
const QString qtNamespace = m_engine->qtNamespace(); const QString qtNamespace = m_engine->qtNamespace();
if (!qtNamespace.isEmpty()) if (!qtNamespace.isEmpty())
str.remove(qtNamespace); str.remove(qtNamespace);
@@ -1113,8 +1113,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
} }
case Qt::ToolTipRole: case Qt::ToolTipRole:
return debuggerSettings()->useToolTipsInLocalsView.value() return settings().useToolTipsInLocalsView() ? item->toToolTip() : QVariant();
? item->toToolTip() : QVariant();
case Qt::ForegroundRole: case Qt::ForegroundRole:
return valueColor(item, column); return valueColor(item, column);
@@ -1134,7 +1133,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
default: default:
break; break;
} }
return QVariant(); return {};
} }
bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role) bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role)
@@ -1349,7 +1348,7 @@ void WatchModel::expand(WatchItem *item, bool requestEngineUpdate)
if (item->isLoadMore()) { if (item->isLoadMore()) {
item = item->parent(); item = item->parent();
m_maxArrayCount[item->iname] m_maxArrayCount[item->iname]
= m_maxArrayCount.value(item->iname, debuggerSettings()->defaultArraySize.value()) * 10; = m_maxArrayCount.value(item->iname, settings().defaultArraySize()) * 10;
if (requestEngineUpdate) if (requestEngineUpdate)
m_engine->updateItem(item->iname); m_engine->updateItem(item->iname);
} else { } else {
@@ -1823,7 +1822,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
DebuggerSettings &s = *debuggerSettings(); DebuggerSettings &s = settings();
menu->addAction(s.useDebuggingHelpers.action()); menu->addAction(s.useDebuggingHelpers.action());
menu->addAction(s.useToolTipsInLocalsView.action()); menu->addAction(s.useToolTipsInLocalsView.action());
menu->addAction(s.autoDerefPointers.action()); menu->addAction(s.autoDerefPointers.action());
@@ -2190,7 +2189,7 @@ void WatchHandler::insertItems(const GdbMi &data)
{ {
QSet<WatchItem *> itemsToSort; QSet<WatchItem *> itemsToSort;
const bool sortStructMembers = debuggerSettings()->sortStructMembers.value(); const bool sortStructMembers = settings().sortStructMembers();
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);
@@ -2332,7 +2331,7 @@ void WatchHandler::notifyUpdateFinished()
}); });
QMap<QString, QString> values; QMap<QString, QString> values;
if (debuggerSettings()->useAnnotationsInMainEditor.value()) { if (settings().useAnnotationsInMainEditor()) {
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())
@@ -2848,7 +2847,7 @@ QSet<QString> WatchHandler::expandedINames() const
int WatchHandler::maxArrayCount(const QString &iname) const int WatchHandler::maxArrayCount(const QString &iname) const
{ {
return m_model->m_maxArrayCount.value(iname, debuggerSettings()->defaultArraySize()); return m_model->m_maxArrayCount.value(iname, settings().defaultArraySize());
} }
void WatchHandler::recordTypeInfo(const GdbMi &typeInfo) void WatchHandler::recordTypeInfo(const GdbMi &typeInfo)

View File

@@ -32,7 +32,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(&debuggerSettings()->logTimeStamps, &Utils::BaseAspect::changed, connect(&settings().logTimeStamps, &Utils::BaseAspect::changed,
this, &WatchTreeView::updateTimeColumn); this, &WatchTreeView::updateTimeColumn);
} }
@@ -84,8 +84,7 @@ void WatchTreeView::setModel(QAbstractItemModel *model)
void WatchTreeView::updateTimeColumn() void WatchTreeView::updateTimeColumn()
{ {
if (header()) if (header())
header()->setSectionHidden(WatchModelBase::TimeColumn, header()->setSectionHidden(WatchModelBase::TimeColumn, !settings().logTimeStamps());
!debuggerSettings()->logTimeStamps.value());
} }
void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx) void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx)