forked from qt-creator/qt-creator
Debugger: Fix persisting of debugger settings
When triggering them from the context menu while debugging. Fix used settings group when triggering writeSettings() on the aspect instead of the AspectContainer. Explicitly persist respective settings when triggering them on the context menu. Fixes: QTCREATORBUG-30491 Change-Id: I6f429bb54630cbe61c8b2ee063028f323a2d08f6 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -29,9 +29,9 @@ GdbSettings &gdbSettings()
|
|||||||
GdbSettings::GdbSettings()
|
GdbSettings::GdbSettings()
|
||||||
{
|
{
|
||||||
setAutoApply(false);
|
setAutoApply(false);
|
||||||
setSettingsGroup("DebugMode");
|
const Key debugModeGroup("DebugMode");
|
||||||
|
|
||||||
useMessageBoxForSignals.setSettingsKey("UseMessageBoxForSignals");
|
useMessageBoxForSignals.setSettingsKey(debugModeGroup, "UseMessageBoxForSignals");
|
||||||
useMessageBoxForSignals.setDefaultValue(true);
|
useMessageBoxForSignals.setDefaultValue(true);
|
||||||
useMessageBoxForSignals.setLabelText(Tr::tr(
|
useMessageBoxForSignals.setLabelText(Tr::tr(
|
||||||
"Show a message box when receiving a signal"));
|
"Show a message box when receiving a signal"));
|
||||||
@@ -49,7 +49,7 @@ GdbSettings::GdbSettings()
|
|||||||
"breakpoint markers in such cases to the location of the true "
|
"breakpoint markers in such cases to the location of the true "
|
||||||
"breakpoint."));
|
"breakpoint."));
|
||||||
adjustBreakpointLocations.setDefaultValue(true);
|
adjustBreakpointLocations.setDefaultValue(true);
|
||||||
adjustBreakpointLocations.setSettingsKey("AdjustBreakpointLocations");
|
adjustBreakpointLocations.setSettingsKey(debugModeGroup, "AdjustBreakpointLocations");
|
||||||
adjustBreakpointLocations.setLabelText(Tr::tr(
|
adjustBreakpointLocations.setLabelText(Tr::tr(
|
||||||
"Adjust breakpoint locations"));
|
"Adjust breakpoint locations"));
|
||||||
adjustBreakpointLocations.setToolTip(Tr::tr(
|
adjustBreakpointLocations.setToolTip(Tr::tr(
|
||||||
@@ -61,41 +61,41 @@ GdbSettings::GdbSettings()
|
|||||||
|
|
||||||
|
|
||||||
breakOnThrow.setLabelText(Tr::tr("Break on \"throw\""));
|
breakOnThrow.setLabelText(Tr::tr("Break on \"throw\""));
|
||||||
breakOnThrow.setSettingsKey("BreakOnThrow");
|
breakOnThrow.setSettingsKey(debugModeGroup, "BreakOnThrow");
|
||||||
|
|
||||||
breakOnCatch.setLabelText(Tr::tr("Break on \"catch\""));
|
breakOnCatch.setLabelText(Tr::tr("Break on \"catch\""));
|
||||||
breakOnCatch.setSettingsKey("BreakOnCatch");
|
breakOnCatch.setSettingsKey(debugModeGroup, "BreakOnCatch");
|
||||||
|
|
||||||
breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\""));
|
breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\""));
|
||||||
breakOnWarning.setSettingsKey("BreakOnWarning");
|
breakOnWarning.setSettingsKey(debugModeGroup, "BreakOnWarning");
|
||||||
// FIXME: Move to common settings page.
|
// FIXME: Move to common settings page.
|
||||||
breakOnWarning.setLabelText(msgSetBreakpointAtFunction("qWarning"));
|
breakOnWarning.setLabelText(msgSetBreakpointAtFunction("qWarning"));
|
||||||
breakOnWarning.setToolTip(msgSetBreakpointAtFunctionToolTip("qWarning"));
|
breakOnWarning.setToolTip(msgSetBreakpointAtFunctionToolTip("qWarning"));
|
||||||
|
|
||||||
breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\""));
|
breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\""));
|
||||||
breakOnFatal.setSettingsKey("BreakOnFatal");
|
breakOnFatal.setSettingsKey(debugModeGroup, "BreakOnFatal");
|
||||||
breakOnFatal.setLabelText(msgSetBreakpointAtFunction("qFatal"));
|
breakOnFatal.setLabelText(msgSetBreakpointAtFunction("qFatal"));
|
||||||
breakOnFatal.setToolTip(msgSetBreakpointAtFunctionToolTip("qFatal"));
|
breakOnFatal.setToolTip(msgSetBreakpointAtFunctionToolTip("qFatal"));
|
||||||
|
|
||||||
breakOnAbort.setLabelText(Tr::tr("Break on \"abort\""));
|
breakOnAbort.setLabelText(Tr::tr("Break on \"abort\""));
|
||||||
breakOnAbort.setSettingsKey("BreakOnAbort");
|
breakOnAbort.setSettingsKey(debugModeGroup, "BreakOnAbort");
|
||||||
breakOnAbort.setLabelText(msgSetBreakpointAtFunction("abort"));
|
breakOnAbort.setLabelText(msgSetBreakpointAtFunction("abort"));
|
||||||
breakOnAbort.setToolTip(msgSetBreakpointAtFunctionToolTip("abort"));
|
breakOnAbort.setToolTip(msgSetBreakpointAtFunctionToolTip("abort"));
|
||||||
|
|
||||||
loadGdbInit.setSettingsKey("LoadGdbInit");
|
loadGdbInit.setSettingsKey(debugModeGroup, "LoadGdbInit");
|
||||||
loadGdbInit.setDefaultValue(true);
|
loadGdbInit.setDefaultValue(true);
|
||||||
loadGdbInit.setLabelText(Tr::tr("Load .gdbinit file on startup"));
|
loadGdbInit.setLabelText(Tr::tr("Load .gdbinit file on startup"));
|
||||||
loadGdbInit.setToolTip(Tr::tr(
|
loadGdbInit.setToolTip(Tr::tr(
|
||||||
"Allows or inhibits reading the user's default\n"
|
"Allows or inhibits reading the user's default\n"
|
||||||
".gdbinit file on debugger startup."));
|
".gdbinit file on debugger startup."));
|
||||||
|
|
||||||
loadGdbDumpers.setSettingsKey("LoadGdbDumpers2");
|
loadGdbDumpers.setSettingsKey(debugModeGroup, "LoadGdbDumpers2");
|
||||||
loadGdbDumpers.setLabelText(Tr::tr("Load system GDB pretty printers"));
|
loadGdbDumpers.setLabelText(Tr::tr("Load system GDB pretty printers"));
|
||||||
loadGdbDumpers.setToolTip(Tr::tr(
|
loadGdbDumpers.setToolTip(Tr::tr(
|
||||||
"Uses the default GDB pretty printers installed in your "
|
"Uses the default GDB pretty printers installed in your "
|
||||||
"system or linked to the libraries your application uses."));
|
"system or linked to the libraries your application uses."));
|
||||||
|
|
||||||
autoEnrichParameters.setSettingsKey("AutoEnrichParameters");
|
autoEnrichParameters.setSettingsKey(debugModeGroup, "AutoEnrichParameters");
|
||||||
autoEnrichParameters.setDefaultValue(true);
|
autoEnrichParameters.setDefaultValue(true);
|
||||||
autoEnrichParameters.setLabelText(Tr::tr(
|
autoEnrichParameters.setLabelText(Tr::tr(
|
||||||
"Use common locations for debug information"));
|
"Use common locations for debug information"));
|
||||||
@@ -104,7 +104,7 @@ GdbSettings::GdbSettings()
|
|||||||
"of debug information such as <i>/usr/src/debug</i> "
|
"of debug information such as <i>/usr/src/debug</i> "
|
||||||
"when starting GDB.</body></html>"));
|
"when starting GDB.</body></html>"));
|
||||||
|
|
||||||
useDynamicType.setSettingsKey("UseDynamicType");
|
useDynamicType.setSettingsKey(debugModeGroup, "UseDynamicType");
|
||||||
useDynamicType.setDefaultValue(true);
|
useDynamicType.setDefaultValue(true);
|
||||||
useDynamicType.setDisplayName(Tr::tr("Use Dynamic Object Type for Display"));
|
useDynamicType.setDisplayName(Tr::tr("Use Dynamic Object Type for Display"));
|
||||||
useDynamicType.setLabelText(Tr::tr(
|
useDynamicType.setLabelText(Tr::tr(
|
||||||
@@ -113,7 +113,7 @@ GdbSettings::GdbSettings()
|
|||||||
"Specifies whether the dynamic or the static type of objects will be "
|
"Specifies whether the dynamic or the static type of objects will be "
|
||||||
"displayed. Choosing the dynamic type might be slower."));
|
"displayed. Choosing the dynamic type might be slower."));
|
||||||
|
|
||||||
targetAsync.setSettingsKey("TargetAsync");
|
targetAsync.setSettingsKey(debugModeGroup, "TargetAsync");
|
||||||
targetAsync.setLabelText(Tr::tr(
|
targetAsync.setLabelText(Tr::tr(
|
||||||
"Use asynchronous mode to control the inferior"));
|
"Use asynchronous mode to control the inferior"));
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ GdbSettings::GdbSettings()
|
|||||||
"<p>To execute arbitrary Python scripts, "
|
"<p>To execute arbitrary Python scripts, "
|
||||||
"use <i>python execfile('/path/to/script.py')</i>.</p>");
|
"use <i>python execfile('/path/to/script.py')</i>.</p>");
|
||||||
|
|
||||||
gdbStartupCommands.setSettingsKey("GdbStartupCommands");
|
gdbStartupCommands.setSettingsKey(debugModeGroup, "GdbStartupCommands");
|
||||||
gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay);
|
gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay);
|
||||||
gdbStartupCommands.setUseGlobalMacroExpander();
|
gdbStartupCommands.setUseGlobalMacroExpander();
|
||||||
gdbStartupCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
|
gdbStartupCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
|
||||||
@@ -134,7 +134,7 @@ GdbSettings::GdbSettings()
|
|||||||
"attached, and before the debugging helpers are initialized.") + "</p>"
|
"attached, and before the debugging helpers are initialized.") + "</p>"
|
||||||
+ howToUsePython + "</body></html>");
|
+ howToUsePython + "</body></html>");
|
||||||
|
|
||||||
gdbPostAttachCommands.setSettingsKey("GdbPostAttachCommands");
|
gdbPostAttachCommands.setSettingsKey(debugModeGroup, "GdbPostAttachCommands");
|
||||||
gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay);
|
gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay);
|
||||||
gdbPostAttachCommands.setUseGlobalMacroExpander();
|
gdbPostAttachCommands.setUseGlobalMacroExpander();
|
||||||
gdbPostAttachCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
|
gdbPostAttachCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
|
||||||
@@ -144,29 +144,29 @@ GdbSettings::GdbSettings()
|
|||||||
"such as \"monitor reset\" or \"load\".") + "</p>"
|
"such as \"monitor reset\" or \"load\".") + "</p>"
|
||||||
+ howToUsePython + "</body></html>");
|
+ howToUsePython + "</body></html>");
|
||||||
|
|
||||||
multiInferior.setSettingsKey("MultiInferior");
|
multiInferior.setSettingsKey(debugModeGroup, "MultiInferior");
|
||||||
multiInferior.setLabelText(Tr::tr("Debug all child processes"));
|
multiInferior.setLabelText(Tr::tr("Debug all child processes"));
|
||||||
multiInferior.setToolTip(Tr::tr(
|
multiInferior.setToolTip(Tr::tr(
|
||||||
"<html><head/><body>Keeps debugging all children after a fork."
|
"<html><head/><body>Keeps debugging all children after a fork."
|
||||||
"</body></html>"));
|
"</body></html>"));
|
||||||
|
|
||||||
intelFlavor.setSettingsKey("IntelFlavor");
|
intelFlavor.setSettingsKey(debugModeGroup, "IntelFlavor");
|
||||||
intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly"));
|
intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly"));
|
||||||
intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly."));
|
intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly."));
|
||||||
|
|
||||||
usePseudoTracepoints.setSettingsKey("UsePseudoTracepoints");
|
usePseudoTracepoints.setSettingsKey(debugModeGroup, "UsePseudoTracepoints");
|
||||||
usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints"));
|
usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints"));
|
||||||
usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class."));
|
usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class."));
|
||||||
usePseudoTracepoints.setDefaultValue(true);
|
usePseudoTracepoints.setDefaultValue(true);
|
||||||
|
|
||||||
useIndexCache.setSettingsKey("UseIndexCache");
|
useIndexCache.setSettingsKey(debugModeGroup, "UseIndexCache");
|
||||||
useIndexCache.setLabelText(Tr::tr("Use automatic symbol cache"));
|
useIndexCache.setLabelText(Tr::tr("Use automatic symbol cache"));
|
||||||
useIndexCache.setToolTip(Tr::tr("It is possible for GDB to automatically save a copy of "
|
useIndexCache.setToolTip(Tr::tr("It is possible for GDB to automatically save a copy of "
|
||||||
"its symbol index in a cache on disk and retrieve it from there when loading the same "
|
"its symbol index in a cache on disk and retrieve it from there when loading the same "
|
||||||
"binary in the future."));
|
"binary in the future."));
|
||||||
useIndexCache.setDefaultValue(true);
|
useIndexCache.setDefaultValue(true);
|
||||||
|
|
||||||
skipKnownFrames.setSettingsKey("SkipKnownFrames");
|
skipKnownFrames.setSettingsKey(debugModeGroup, "SkipKnownFrames");
|
||||||
skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames"));
|
skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames"));
|
||||||
skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping"));
|
skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping"));
|
||||||
skipKnownFrames.setToolTip(Tr::tr(
|
skipKnownFrames.setToolTip(Tr::tr(
|
||||||
@@ -176,7 +176,7 @@ GdbSettings::GdbSettings()
|
|||||||
"counting code is skipped, and a single <i>Step Into</i> for a signal\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."));
|
"emission ends up directly in the slot connected to it."));
|
||||||
|
|
||||||
enableReverseDebugging.setSettingsKey("EnableReverseDebugging");
|
enableReverseDebugging.setSettingsKey(debugModeGroup, "EnableReverseDebugging");
|
||||||
enableReverseDebugging.setIcon(Icons::REVERSE_MODE.icon());
|
enableReverseDebugging.setIcon(Icons::REVERSE_MODE.icon());
|
||||||
enableReverseDebugging.setDisplayName(Tr::tr("Enable Reverse Debugging"));
|
enableReverseDebugging.setDisplayName(Tr::tr("Enable Reverse Debugging"));
|
||||||
enableReverseDebugging.setLabelText(Tr::tr("Enable reverse debugging"));
|
enableReverseDebugging.setLabelText(Tr::tr("Enable reverse debugging"));
|
||||||
@@ -186,7 +186,7 @@ GdbSettings::GdbSettings()
|
|||||||
"It exhibits unpredictable behavior when going backwards over system "
|
"It exhibits unpredictable behavior when going backwards over system "
|
||||||
"calls and is very likely to destroy your debugging session.</p></body></html>"));
|
"calls and is very likely to destroy your debugging session.</p></body></html>"));
|
||||||
|
|
||||||
gdbWatchdogTimeout.setSettingsKey("WatchdogTimeout");
|
gdbWatchdogTimeout.setSettingsKey(debugModeGroup, "WatchdogTimeout");
|
||||||
gdbWatchdogTimeout.setDefaultValue(40);
|
gdbWatchdogTimeout.setDefaultValue(40);
|
||||||
gdbWatchdogTimeout.setSuffix(Tr::tr("sec"));
|
gdbWatchdogTimeout.setSuffix(Tr::tr("sec"));
|
||||||
gdbWatchdogTimeout.setRange(10, 1000000);
|
gdbWatchdogTimeout.setRange(10, 1000000);
|
||||||
|
@@ -1820,13 +1820,20 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
DebuggerSettings &s = settings();
|
DebuggerSettings &s = settings();
|
||||||
menu->addAction(s.useDebuggingHelpers.action());
|
QAction *debugHelperAction = s.useDebuggingHelpers.action();
|
||||||
|
menu->addAction(debugHelperAction);
|
||||||
menu->addAction(s.useToolTipsInLocalsView.action());
|
menu->addAction(s.useToolTipsInLocalsView.action());
|
||||||
menu->addAction(s.autoDerefPointers.action());
|
menu->addAction(s.autoDerefPointers.action());
|
||||||
menu->addAction(s.sortStructMembers.action());
|
menu->addAction(s.sortStructMembers.action());
|
||||||
menu->addAction(s.useDynamicType.action());
|
QAction *dynamicTypeAction = s.useDynamicType.action();
|
||||||
|
menu->addAction(dynamicTypeAction);
|
||||||
menu->addAction(s.settingsDialog.action());
|
menu->addAction(s.settingsDialog.action());
|
||||||
|
|
||||||
|
// useDebuggingHelpers/useDynamicType have no auto-apply, but need to be persisted on triggered
|
||||||
|
connect(debugHelperAction, &QAction::triggered,
|
||||||
|
&s.useDebuggingHelpers, &BoolAspect::writeSettings, Qt::UniqueConnection);
|
||||||
|
connect(dynamicTypeAction, &QAction::triggered,
|
||||||
|
&s.useDynamicType, &BoolAspect::writeSettings, Qt::UniqueConnection);
|
||||||
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;
|
||||||
|
Reference in New Issue
Block a user