Debugger: Split out gdb related options into own page object

Goal is to make option setup more similar to the other "simple" pages.
The GdbOptionPage is now separated in the setup code, but aggregated
into the old place and accessed there.

The per-backend separation seem quite weak, a full split would currently
need to have include gdb/* in several places now is an indication
that the gdb/non-gdb split in the options is dubious at best.

Change-Id: Iad210016739aa4a63645731e16825f546bdd5e8a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-05-30 13:17:58 +02:00
parent 091b853068
commit 0cf1477324
7 changed files with 305 additions and 234 deletions

View File

@@ -108,14 +108,6 @@ DebuggerSettings::DebuggerSettings()
"the font size in the main editor changes."));
fontSizeFollowsEditor.setLabelText(Tr::tr("Debugger font size follows main editor"));
useMessageBoxForSignals.setSettingsKey(debugModeGroup, "UseMessageBoxForSignals");
useMessageBoxForSignals.setDefaultValue(true);
useMessageBoxForSignals.setLabelText(Tr::tr(
"Show a message box when receiving a signal"));
useMessageBoxForSignals.setToolTip(Tr::tr(
"Displays a message box as soon as your application\n"
"receives a signal like SIGSEGV during debugging."));
logTimeStamps.setLabelText(Tr::tr("Log Time Stamps"));
logTimeStamps.setSettingsKey(debugModeGroup, "LogTimeStamps");
@@ -239,121 +231,6 @@ DebuggerSettings::DebuggerSettings()
//
synchronizeBreakpoints.setLabelText(Tr::tr("Synchronize Breakpoints"));
adjustBreakpointLocations.setDisplayName(Tr::tr("Adjust Breakpoint Locations"));
adjustBreakpointLocations.setToolTip(
"<p>"
+ Tr::tr("Not all source code lines generate "
"executable code. Putting a breakpoint on such a line acts as "
"if the breakpoint was set on the next line that generated code. "
"Selecting 'Adjust Breakpoint Locations' shifts the red "
"breakpoint markers in such cases to the location of the true "
"breakpoint."));
adjustBreakpointLocations.setDefaultValue(true);
adjustBreakpointLocations.setSettingsKey(debugModeGroup, "AdjustBreakpointLocations");
adjustBreakpointLocations.setLabelText(Tr::tr(
"Adjust breakpoint locations"));
adjustBreakpointLocations.setToolTip(Tr::tr(
"GDB allows setting breakpoints on source lines for which no code \n"
"was generated. In such situations the breakpoint is shifted to the\n"
"next source code line for which code was actually generated.\n"
"This option reflects such temporary change by moving the breakpoint\n"
"markers in the source code editor."));
breakOnThrow.setLabelText(Tr::tr("Break on \"throw\""));
breakOnThrow.setSettingsKey(debugModeGroup, "BreakOnThrow");
breakOnCatch.setLabelText(Tr::tr("Break on \"catch\""));
breakOnCatch.setSettingsKey(debugModeGroup, "BreakOnCatch");
breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\""));
breakOnWarning.setSettingsKey(debugModeGroup, "BreakOnWarning");
// FIXME: Move to common settings page.
breakOnWarning.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("qWarning"));
breakOnWarning.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qWarning"));
breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\""));
breakOnFatal.setSettingsKey(debugModeGroup, "BreakOnFatal");
breakOnFatal.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal"));
breakOnFatal.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal"));
breakOnAbort.setLabelText(Tr::tr("Break on \"abort\""));
breakOnAbort.setSettingsKey(debugModeGroup, "BreakOnAbort");
breakOnAbort.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("abort"));
breakOnAbort.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort"));
//
// Settings
//
loadGdbInit.setSettingsKey(debugModeGroup, "LoadGdbInit");
loadGdbInit.setDefaultValue(true);
loadGdbInit.setLabelText(Tr::tr("Load .gdbinit file on startup"));
loadGdbInit.setToolTip(Tr::tr(
"Allows or inhibits reading the user's default\n"
".gdbinit file on debugger startup."));
loadGdbDumpers.setSettingsKey(debugModeGroup, "LoadGdbDumpers2");
loadGdbDumpers.setLabelText(Tr::tr("Load system GDB pretty printers"));
loadGdbDumpers.setToolTip(Tr::tr(
"Uses the default GDB pretty printers installed in your "
"system or linked to the libraries your application uses."));
autoEnrichParameters.setSettingsKey(debugModeGroup, "AutoEnrichParameters");
autoEnrichParameters.setDefaultValue(true);
autoEnrichParameters.setLabelText(Tr::tr(
"Use common locations for debug information"));
autoEnrichParameters.setToolTip(Tr::tr(
"<html><head/><body>Adds common paths to locations "
"of debug information such as <i>/usr/src/debug</i> "
"when starting GDB.</body></html>"));
useDynamicType.setSettingsKey(debugModeGroup, "UseDynamicType");
useDynamicType.setDefaultValue(true);
useDynamicType.setDisplayName(Tr::tr("Use Dynamic Object Type for Display"));
useDynamicType.setLabelText(Tr::tr(
"Use dynamic object type for display"));
useDynamicType.setToolTip(Tr::tr(
"Specifies whether the dynamic or the static type of objects will be "
"displayed. Choosing the dynamic type might be slower."));
targetAsync.setSettingsKey(debugModeGroup, "TargetAsync");
targetAsync.setLabelText(Tr::tr(
"Use asynchronous mode to control the inferior"));
warnOnReleaseBuilds.setSettingsKey(debugModeGroup, "WarnOnReleaseBuilds");
warnOnReleaseBuilds.setDefaultValue(true);
warnOnReleaseBuilds.setLabelText(Tr::tr("Warn when debugging \"Release\" builds"));
warnOnReleaseBuilds.setToolTip(Tr::tr("Shows a warning when starting the debugger "
"on a binary with insufficient debug information."));
QString howToUsePython = Tr::tr(
"<p>To execute simple Python commands, prefix them with \"python\".</p>"
"<p>To execute sequences of Python commands spanning multiple lines "
"prepend the block with \"python\" on a separate line, and append "
"\"end\" on a separate line.</p>"
"<p>To execute arbitrary Python scripts, "
"use <i>python execfile('/path/to/script.py')</i>.</p>");
gdbStartupCommands.setSettingsKey(debugModeGroup, "GdbStartupCommands");
gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay);
gdbStartupCommands.setUseGlobalMacroExpander();
gdbStartupCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
"GDB commands entered here will be executed after "
"GDB has been started, but before the debugged program is started or "
"attached, and before the debugging helpers are initialized.") + "</p>"
+ howToUsePython + "</body></html>");
gdbPostAttachCommands.setSettingsKey(debugModeGroup, "GdbPostAttachCommands");
gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay);
gdbPostAttachCommands.setUseGlobalMacroExpander();
gdbPostAttachCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
"GDB commands entered here will be executed after "
"GDB has successfully attached to remote targets.</p>"
"<p>You can add commands to further set up the target here, "
"such as \"monitor reset\" or \"load\".") + "</p>"
+ howToUsePython + "</body></html>");
extraDumperCommands.setSettingsKey(debugModeGroup, "GdbCustomDumperCommands");
extraDumperCommands.setDisplayStyle(StringAspect::TextEditDisplay);
extraDumperCommands.setUseGlobalMacroExpander();
@@ -395,16 +272,6 @@ DebuggerSettings::DebuggerSettings()
autoQuit.setSettingsKey(debugModeGroup, "AutoQuit");
autoQuit.setLabelText(Tr::tr("Automatically Quit Debugger"));
multiInferior.setSettingsKey(debugModeGroup, "MultiInferior");
multiInferior.setLabelText(Tr::tr("Debug all child processes"));
multiInferior.setToolTip(Tr::tr(
"<html><head/><body>Keeps debugging all children after a fork."
"</body></html>"));
intelFlavor.setSettingsKey(debugModeGroup, "IntelFlavor");
intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly"));
intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly."));
useAnnotationsInMainEditor.setSettingsKey(debugModeGroup, "UseAnnotations");
useAnnotationsInMainEditor.setLabelText(Tr::tr("Use annotations in main editor when debugging"));
useAnnotationsInMainEditor.setToolTip(
@@ -413,17 +280,11 @@ DebuggerSettings::DebuggerSettings()
"as annotations in the main editor during debugging."));
useAnnotationsInMainEditor.setDefaultValue(true);
usePseudoTracepoints.setSettingsKey(debugModeGroup, "UsePseudoTracepoints");
usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints"));
usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class."));
usePseudoTracepoints.setDefaultValue(true);
useIndexCache.setSettingsKey(debugModeGroup, "UseIndexCache");
useIndexCache.setLabelText(Tr::tr("Use automatic symbol cache"));
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 "
"binary in the future."));
useIndexCache.setDefaultValue(true);
warnOnReleaseBuilds.setSettingsKey(debugModeGroup, "WarnOnReleaseBuilds");
warnOnReleaseBuilds.setDefaultValue(true);
warnOnReleaseBuilds.setLabelText(Tr::tr("Warn when debugging \"Release\" builds"));
warnOnReleaseBuilds.setToolTip(Tr::tr("Shows a warning when starting the debugger "
"on a binary with insufficient debug information."));
useToolTipsInMainEditor.setSettingsKey(debugModeGroup, "UseToolTips");
useToolTipsInMainEditor.setLabelText(Tr::tr("Use tooltips in main editor when debugging"));
@@ -454,27 +315,6 @@ DebuggerSettings::DebuggerSettings()
"view during debugging."));
useToolTipsInStackView.setDefaultValue(true);
skipKnownFrames.setSettingsKey(debugModeGroup, "SkipKnownFrames");
skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames"));
skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping"));
skipKnownFrames.setToolTip(Tr::tr(
"<html><head/><body><p>"
"Allows <i>Step Into</i> to compress several steps into one step\n"
"for less noisy debugging. For example, the atomic reference\n"
"counting code is skipped, and a single <i>Step Into</i> for a signal\n"
"emission ends up directly in the slot connected to it."));
enableReverseDebugging.setSettingsKey(debugModeGroup, "EnableReverseDebugging");
enableReverseDebugging.setIcon(Icons::REVERSE_MODE.icon());
enableReverseDebugging.setDisplayName(Tr::tr("Enable Reverse Debugging"));
enableReverseDebugging.setLabelText(Tr::tr("Enable reverse debugging"));
enableReverseDebugging.setToolTip(Tr::tr(
"<html><head/><body><p>Enables stepping backwards.</p><p>"
"<b>Note:</b> This feature is very slow and unstable on the GDB side. "
"It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>"));
#ifdef Q_OS_WIN
registerForPostMortem = new RegisterPostMortemAction;
registerForPostMortem->setSettingsKey(debugModeGroup, "RegisterForPostMortem");
@@ -543,18 +383,6 @@ DebuggerSettings::DebuggerSettings()
createFullBacktrace.setLabelText(Tr::tr("Create Full Backtrace"));
gdbWatchdogTimeout.setSettingsKey(debugModeGroup, "WatchdogTimeout");
gdbWatchdogTimeout.setDefaultValue(20);
gdbWatchdogTimeout.setSuffix(Tr::tr("sec"));
gdbWatchdogTimeout.setRange(20, 1000000);
gdbWatchdogTimeout.setLabelText(Tr::tr("GDB timeout:"));
gdbWatchdogTimeout.setToolTip(Tr::tr(
"The number of seconds before a non-responsive GDB process is terminated.\n"
"The default value of 20 seconds should be sufficient for most\n"
"applications, but there are situations when loading big libraries or\n"
"listing source files takes much longer than that on slow machines.\n"
"In this case, the value should be increased."));
//
// QML Tools
//
@@ -586,27 +414,6 @@ DebuggerSettings::DebuggerSettings()
page1.registerAspect(&sourcePathMap);
// Page 2
page2.registerAspect(&gdbWatchdogTimeout);
page2.registerAspect(&skipKnownFrames);
page2.registerAspect(&useMessageBoxForSignals);
page2.registerAspect(&adjustBreakpointLocations);
page2.registerAspect(&useDynamicType);
page2.registerAspect(&loadGdbInit);
page2.registerAspect(&loadGdbDumpers);
page2.registerAspect(&intelFlavor);
page2.registerAspect(&usePseudoTracepoints);
page2.registerAspect(&useIndexCache);
page2.registerAspect(&gdbStartupCommands);
page2.registerAspect(&gdbPostAttachCommands);
page2.registerAspect(&targetAsync);
page2.registerAspect(&autoEnrichParameters);
page2.registerAspect(&breakOnWarning);
page2.registerAspect(&breakOnFatal);
page2.registerAspect(&breakOnAbort);
page2.registerAspect(&enableReverseDebugging);
page2.registerAspect(&multiInferior);
// Page 4
page4.registerAspect(&useDebuggingHelpers);
page4.registerAspect(&useCodeModel);
@@ -645,12 +452,9 @@ DebuggerSettings::DebuggerSettings()
all.registerAspect(&useToolTipsInStackView);
all.registerAspect(&logTimeStamps);
all.registerAspect(&sortStructMembers);
all.registerAspect(&breakOnThrow); // ??
all.registerAspect(&breakOnCatch); // ??
// Collect all
all.registerAspects(page1);
all.registerAspects(page2);
all.registerAspects(page4);
all.registerAspects(page5);
all.registerAspects(page6);
@@ -671,11 +475,13 @@ DebuggerSettings::~DebuggerSettings()
void DebuggerSettings::readSettings()
{
all.readSettings(Core::ICore::settings());
GdbSettings::readSettings(Core::ICore::settings());
}
void DebuggerSettings::writeSettings() const
{
all.writeSettings(Core::ICore::settings());
GdbSettings::writeSettings(Core::ICore::settings());
}
QString DebuggerSettings::dump()