diff --git a/src/plugins/debugger/CMakeLists.txt b/src/plugins/debugger/CMakeLists.txt index d06e82a27e1..4280af0235c 100644 --- a/src/plugins/debugger/CMakeLists.txt +++ b/src/plugins/debugger/CMakeLists.txt @@ -51,7 +51,7 @@ add_qtc_plugin(Debugger disassembleragent.cpp disassembleragent.h disassemblerlines.cpp disassemblerlines.h gdb/gdbengine.cpp gdb/gdbengine.h - gdb/gdboptionspage.cpp + gdb/gdbsettings.cpp gdb/gdbsettings.h imageviewer.cpp imageviewer.h enginemanager.cpp enginemanager.h lldb/lldbengine.cpp lldb/lldbengine.h diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index be2adfc04d9..1cc48186b64 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -104,7 +104,7 @@ Project { prefix: "gdb/" files: [ "gdbengine.cpp", "gdbengine.h", - "gdboptionspage.cpp", + "gdbsettings.cpp", "gdbsettings.h", ] } diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 907e626f4dc..afa7dd14598 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -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( - "

" - + 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( - "Adds common paths to locations " - "of debug information such as /usr/src/debug " - "when starting GDB.")); - - 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( - "

To execute simple Python commands, prefix them with \"python\".

" - "

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.

" - "

To execute arbitrary Python scripts, " - "use python execfile('/path/to/script.py').

"); - - gdbStartupCommands.setSettingsKey(debugModeGroup, "GdbStartupCommands"); - gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay); - gdbStartupCommands.setUseGlobalMacroExpander(); - gdbStartupCommands.setToolTip("

" + 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.") + "

" - + howToUsePython + ""); - - gdbPostAttachCommands.setSettingsKey(debugModeGroup, "GdbPostAttachCommands"); - gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay); - gdbPostAttachCommands.setUseGlobalMacroExpander(); - gdbPostAttachCommands.setToolTip("

" + Tr::tr( - "GDB commands entered here will be executed after " - "GDB has successfully attached to remote targets.

" - "

You can add commands to further set up the target here, " - "such as \"monitor reset\" or \"load\".") + "

" - + howToUsePython + ""); - 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( - "Keeps debugging all children after a fork." - "")); - - 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( - "

" - "Allows Step Into 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 Step Into 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( - "

Enables stepping backwards.

" - "Note: 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.

")); - - #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() diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index a6fb497815f..df2560ed72f 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -3,13 +3,13 @@ #pragma once +#include + #include #include #include #include -#include - namespace Debugger::Internal { class SourcePathMapAspectPrivate; @@ -50,7 +50,7 @@ class GeneralSettings ~GeneralSettings(); }; -class DebuggerSettings +class DebuggerSettings : public GdbSettings { public: explicit DebuggerSettings(); @@ -77,31 +77,6 @@ public: SourcePathMapAspect sourcePathMap; - // Page 2: GDB - Utils::IntegerAspect gdbWatchdogTimeout; - Utils::BoolAspect skipKnownFrames; - Utils::BoolAspect useMessageBoxForSignals; - Utils::BoolAspect adjustBreakpointLocations; - Utils::BoolAspect useDynamicType; - Utils::BoolAspect loadGdbInit; - Utils::BoolAspect loadGdbDumpers; - Utils::BoolAspect intelFlavor; - Utils::BoolAspect usePseudoTracepoints; - Utils::BoolAspect useIndexCache; - Utils::StringAspect gdbStartupCommands; - Utils::StringAspect gdbPostAttachCommands; - - // Page 3: GDB Extended - Utils::BoolAspect targetAsync; - Utils::BoolAspect autoEnrichParameters; - Utils::BoolAspect breakOnThrow; - Utils::BoolAspect breakOnCatch; - Utils::BoolAspect breakOnWarning; - Utils::BoolAspect breakOnFatal; - Utils::BoolAspect breakOnAbort; - Utils::BoolAspect enableReverseDebugging; - Utils::BoolAspect multiInferior; - // Page 4: Locals and expressions Utils::BoolAspect useDebuggingHelpers; Utils::BoolAspect useCodeModel; @@ -163,7 +138,6 @@ public: Utils::AspectContainer all; // All Utils::AspectContainer page1; // General - Utils::AspectContainer page2; // GDB Utils::AspectContainer page4; // Locals & Expressions Utils::AspectContainer page5; // CDB Utils::AspectContainer page6; // CDB Paths diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index dffa503c456..4aa0f1b33c6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -364,7 +364,6 @@ const char MENU_GROUP_SPECIAL[] = "Debugger.Group.Special"; const char MENU_GROUP_START_QML[] = "Debugger.Group.Start.Qml"; void addCdbOptionPages(QList *opts); -void addGdbOptionPages(QList *opts); static QIcon startIcon(bool toolBarStyle) { @@ -1126,7 +1125,6 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments) // }); m_optionPages.append(new LocalsAndExpressionsOptionsPage); - addGdbOptionPages(&m_optionPages); addCdbOptionPages(&m_optionPages); connect(ModeManager::instance(), &ModeManager::currentModeAboutToChange, this, [] { diff --git a/src/plugins/debugger/gdb/gdbsettings.cpp b/src/plugins/debugger/gdb/gdbsettings.cpp new file mode 100644 index 00000000000..62f4dec40cf --- /dev/null +++ b/src/plugins/debugger/gdb/gdbsettings.cpp @@ -0,0 +1,254 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "gdbsettings.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +using namespace Core; +using namespace Utils; + +namespace Debugger::Internal { + +GdbSettings::GdbSettings() +{ + setId("M.Gdb"); + setDisplayName(Tr::tr("GDB")); + setCategory(Constants::DEBUGGER_SETTINGS_CATEGORY); + setSettingsGroup("DebugMode"); + + useMessageBoxForSignals.setSettingsKey("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.")); + + adjustBreakpointLocations.setDisplayName(Tr::tr("Adjust Breakpoint Locations")); + adjustBreakpointLocations.setToolTip( + "

" + + 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("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("BreakOnThrow"); + + breakOnCatch.setLabelText(Tr::tr("Break on \"catch\"")); + breakOnCatch.setSettingsKey("BreakOnCatch"); + + breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\"")); + breakOnWarning.setSettingsKey("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("BreakOnFatal"); + breakOnFatal.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal")); + breakOnFatal.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal")); + + breakOnAbort.setLabelText(Tr::tr("Break on \"abort\"")); + breakOnAbort.setSettingsKey("BreakOnAbort"); + breakOnAbort.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("abort")); + breakOnAbort.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort")); + + loadGdbInit.setSettingsKey("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("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("AutoEnrichParameters"); + autoEnrichParameters.setDefaultValue(true); + autoEnrichParameters.setLabelText(Tr::tr( + "Use common locations for debug information")); + autoEnrichParameters.setToolTip(Tr::tr( + "Adds common paths to locations " + "of debug information such as /usr/src/debug " + "when starting GDB.")); + + useDynamicType.setSettingsKey("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("TargetAsync"); + targetAsync.setLabelText(Tr::tr( + "Use asynchronous mode to control the inferior")); + + QString howToUsePython = Tr::tr( + "

To execute simple Python commands, prefix them with \"python\".

" + "

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.

" + "

To execute arbitrary Python scripts, " + "use python execfile('/path/to/script.py').

"); + + gdbStartupCommands.setSettingsKey("GdbStartupCommands"); + gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay); + gdbStartupCommands.setUseGlobalMacroExpander(); + gdbStartupCommands.setToolTip("

" + 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.") + "

" + + howToUsePython + ""); + + gdbPostAttachCommands.setSettingsKey("GdbPostAttachCommands"); + gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay); + gdbPostAttachCommands.setUseGlobalMacroExpander(); + gdbPostAttachCommands.setToolTip("

" + Tr::tr( + "GDB commands entered here will be executed after " + "GDB has successfully attached to remote targets.

" + "

You can add commands to further set up the target here, " + "such as \"monitor reset\" or \"load\".") + "

" + + howToUsePython + ""); + + multiInferior.setSettingsKey("MultiInferior"); + multiInferior.setLabelText(Tr::tr("Debug all child processes")); + multiInferior.setToolTip(Tr::tr( + "Keeps debugging all children after a fork." + "")); + + intelFlavor.setSettingsKey("IntelFlavor"); + intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly")); + intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly.")); + + usePseudoTracepoints.setSettingsKey("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("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); + + skipKnownFrames.setSettingsKey("SkipKnownFrames"); + skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames")); + skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping")); + skipKnownFrames.setToolTip(Tr::tr( + "

" + "Allows Step Into 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 Step Into for a signal\n" + "emission ends up directly in the slot connected to it.")); + + enableReverseDebugging.setSettingsKey("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( + "

Enables stepping backwards.

" + "Note: 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.

")); + + gdbWatchdogTimeout.setSettingsKey("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.")); + + + setLayouter([this] { + using namespace Layouting; + + auto labelDangerous = new QLabel("" + + Tr::tr("The options below give access to advanced
" + "or experimental functions of GDB.

" + "Enabling them may negatively impact
" + "your debugging experience.") + "
"); + + Group general { + title(Tr::tr("General")), + Column { + Row { gdbWatchdogTimeout, st }, + skipKnownFrames, + useMessageBoxForSignals, + adjustBreakpointLocations, + useDynamicType, + loadGdbInit, + loadGdbDumpers, + intelFlavor, + usePseudoTracepoints, + useIndexCache, + st + } + }; + + Group extended { + title(Tr::tr("Extended")), + Column { + labelDangerous, + targetAsync, + autoEnrichParameters, + breakOnWarning, + breakOnFatal, + breakOnAbort, + enableReverseDebugging, + multiInferior, + st + } + }; + + Group startup { + title(Tr::tr("Additional Startup Commands")), + Column { gdbStartupCommands } + }; + + Group attach { + title(Tr::tr("Additional Attach Commands")), + Column { gdbPostAttachCommands }, + }; + + return Grid { general, extended, br, startup, attach }; + }); + + readSettings(); +} + +} // Debugger::Internal diff --git a/src/plugins/debugger/gdb/gdbsettings.h b/src/plugins/debugger/gdb/gdbsettings.h new file mode 100644 index 00000000000..d04e89eb966 --- /dev/null +++ b/src/plugins/debugger/gdb/gdbsettings.h @@ -0,0 +1,39 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include + +namespace Debugger::Internal { + +class GdbSettings : public Core::PagedSettings +{ +public: + GdbSettings(); + + Utils::IntegerAspect gdbWatchdogTimeout{this}; + Utils::BoolAspect skipKnownFrames{this}; + Utils::BoolAspect useMessageBoxForSignals{this}; + Utils::BoolAspect adjustBreakpointLocations{this}; + Utils::BoolAspect useDynamicType{this}; + Utils::BoolAspect loadGdbInit{this}; + Utils::BoolAspect loadGdbDumpers{this}; + Utils::BoolAspect intelFlavor{this}; + Utils::BoolAspect usePseudoTracepoints{this}; + Utils::BoolAspect useIndexCache{this}; + Utils::StringAspect gdbStartupCommands{this}; + Utils::StringAspect gdbPostAttachCommands{this}; + + Utils::BoolAspect targetAsync{this}; + Utils::BoolAspect autoEnrichParameters{this}; + Utils::BoolAspect breakOnThrow{this}; + Utils::BoolAspect breakOnCatch{this}; + Utils::BoolAspect breakOnWarning{this}; + Utils::BoolAspect breakOnFatal{this}; + Utils::BoolAspect breakOnAbort{this}; + Utils::BoolAspect enableReverseDebugging{this}; + Utils::BoolAspect multiInferior{this}; +}; + +} // Debugger::Internal