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

@@ -51,7 +51,7 @@ add_qtc_plugin(Debugger
disassembleragent.cpp disassembleragent.h disassembleragent.cpp disassembleragent.h
disassemblerlines.cpp disassemblerlines.h disassemblerlines.cpp disassemblerlines.h
gdb/gdbengine.cpp gdb/gdbengine.h gdb/gdbengine.cpp gdb/gdbengine.h
gdb/gdboptionspage.cpp gdb/gdbsettings.cpp gdb/gdbsettings.h
imageviewer.cpp imageviewer.h imageviewer.cpp imageviewer.h
enginemanager.cpp enginemanager.h enginemanager.cpp enginemanager.h
lldb/lldbengine.cpp lldb/lldbengine.h lldb/lldbengine.cpp lldb/lldbengine.h

View File

@@ -104,7 +104,7 @@ Project {
prefix: "gdb/" prefix: "gdb/"
files: [ files: [
"gdbengine.cpp", "gdbengine.h", "gdbengine.cpp", "gdbengine.h",
"gdboptionspage.cpp", "gdbsettings.cpp", "gdbsettings.h",
] ]
} }

View File

@@ -108,14 +108,6 @@ DebuggerSettings::DebuggerSettings()
"the font size in the main editor changes.")); "the font size in the main editor changes."));
fontSizeFollowsEditor.setLabelText(Tr::tr("Debugger font size follows main editor")); 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.setLabelText(Tr::tr("Log Time Stamps"));
logTimeStamps.setSettingsKey(debugModeGroup, "LogTimeStamps"); logTimeStamps.setSettingsKey(debugModeGroup, "LogTimeStamps");
@@ -239,121 +231,6 @@ DebuggerSettings::DebuggerSettings()
// //
synchronizeBreakpoints.setLabelText(Tr::tr("Synchronize Breakpoints")); 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.setSettingsKey(debugModeGroup, "GdbCustomDumperCommands");
extraDumperCommands.setDisplayStyle(StringAspect::TextEditDisplay); extraDumperCommands.setDisplayStyle(StringAspect::TextEditDisplay);
extraDumperCommands.setUseGlobalMacroExpander(); extraDumperCommands.setUseGlobalMacroExpander();
@@ -395,16 +272,6 @@ DebuggerSettings::DebuggerSettings()
autoQuit.setSettingsKey(debugModeGroup, "AutoQuit"); autoQuit.setSettingsKey(debugModeGroup, "AutoQuit");
autoQuit.setLabelText(Tr::tr("Automatically Quit Debugger")); 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.setSettingsKey(debugModeGroup, "UseAnnotations");
useAnnotationsInMainEditor.setLabelText(Tr::tr("Use annotations in main editor when debugging")); useAnnotationsInMainEditor.setLabelText(Tr::tr("Use annotations in main editor when debugging"));
useAnnotationsInMainEditor.setToolTip( useAnnotationsInMainEditor.setToolTip(
@@ -413,17 +280,11 @@ DebuggerSettings::DebuggerSettings()
"as annotations in the main editor during debugging.")); "as annotations in the main editor during debugging."));
useAnnotationsInMainEditor.setDefaultValue(true); useAnnotationsInMainEditor.setDefaultValue(true);
usePseudoTracepoints.setSettingsKey(debugModeGroup, "UsePseudoTracepoints"); warnOnReleaseBuilds.setSettingsKey(debugModeGroup, "WarnOnReleaseBuilds");
usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints")); warnOnReleaseBuilds.setDefaultValue(true);
usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class.")); warnOnReleaseBuilds.setLabelText(Tr::tr("Warn when debugging \"Release\" builds"));
usePseudoTracepoints.setDefaultValue(true); warnOnReleaseBuilds.setToolTip(Tr::tr("Shows a warning when starting the debugger "
"on a binary with insufficient debug information."));
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);
useToolTipsInMainEditor.setSettingsKey(debugModeGroup, "UseToolTips"); useToolTipsInMainEditor.setSettingsKey(debugModeGroup, "UseToolTips");
useToolTipsInMainEditor.setLabelText(Tr::tr("Use tooltips in main editor when debugging")); useToolTipsInMainEditor.setLabelText(Tr::tr("Use tooltips in main editor when debugging"));
@@ -454,27 +315,6 @@ DebuggerSettings::DebuggerSettings()
"view during debugging.")); "view during debugging."));
useToolTipsInStackView.setDefaultValue(true); 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 #ifdef Q_OS_WIN
registerForPostMortem = new RegisterPostMortemAction; registerForPostMortem = new RegisterPostMortemAction;
registerForPostMortem->setSettingsKey(debugModeGroup, "RegisterForPostMortem"); registerForPostMortem->setSettingsKey(debugModeGroup, "RegisterForPostMortem");
@@ -543,18 +383,6 @@ DebuggerSettings::DebuggerSettings()
createFullBacktrace.setLabelText(Tr::tr("Create Full Backtrace")); 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 // QML Tools
// //
@@ -586,27 +414,6 @@ DebuggerSettings::DebuggerSettings()
page1.registerAspect(&sourcePathMap); 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 // Page 4
page4.registerAspect(&useDebuggingHelpers); page4.registerAspect(&useDebuggingHelpers);
page4.registerAspect(&useCodeModel); page4.registerAspect(&useCodeModel);
@@ -645,12 +452,9 @@ DebuggerSettings::DebuggerSettings()
all.registerAspect(&useToolTipsInStackView); all.registerAspect(&useToolTipsInStackView);
all.registerAspect(&logTimeStamps); all.registerAspect(&logTimeStamps);
all.registerAspect(&sortStructMembers); all.registerAspect(&sortStructMembers);
all.registerAspect(&breakOnThrow); // ??
all.registerAspect(&breakOnCatch); // ??
// Collect all // Collect all
all.registerAspects(page1); all.registerAspects(page1);
all.registerAspects(page2);
all.registerAspects(page4); all.registerAspects(page4);
all.registerAspects(page5); all.registerAspects(page5);
all.registerAspects(page6); all.registerAspects(page6);
@@ -671,11 +475,13 @@ DebuggerSettings::~DebuggerSettings()
void DebuggerSettings::readSettings() void DebuggerSettings::readSettings()
{ {
all.readSettings(Core::ICore::settings()); all.readSettings(Core::ICore::settings());
GdbSettings::readSettings(Core::ICore::settings());
} }
void DebuggerSettings::writeSettings() const void DebuggerSettings::writeSettings() const
{ {
all.writeSettings(Core::ICore::settings()); all.writeSettings(Core::ICore::settings());
GdbSettings::writeSettings(Core::ICore::settings());
} }
QString DebuggerSettings::dump() QString DebuggerSettings::dump()

View File

@@ -3,13 +3,13 @@
#pragma once #pragma once
#include <gdb/gdbsettings.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QHash> #include <QHash>
#include <QMap> #include <QMap>
#include <QVector> #include <QVector>
#include <utils/aspects.h>
namespace Debugger::Internal { namespace Debugger::Internal {
class SourcePathMapAspectPrivate; class SourcePathMapAspectPrivate;
@@ -50,7 +50,7 @@ class GeneralSettings
~GeneralSettings(); ~GeneralSettings();
}; };
class DebuggerSettings class DebuggerSettings : public GdbSettings
{ {
public: public:
explicit DebuggerSettings(); explicit DebuggerSettings();
@@ -77,31 +77,6 @@ public:
SourcePathMapAspect sourcePathMap; 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 // Page 4: Locals and expressions
Utils::BoolAspect useDebuggingHelpers; Utils::BoolAspect useDebuggingHelpers;
Utils::BoolAspect useCodeModel; Utils::BoolAspect useCodeModel;
@@ -163,7 +138,6 @@ public:
Utils::AspectContainer all; // All Utils::AspectContainer all; // All
Utils::AspectContainer page1; // General Utils::AspectContainer page1; // General
Utils::AspectContainer page2; // GDB
Utils::AspectContainer page4; // Locals & Expressions Utils::AspectContainer page4; // Locals & Expressions
Utils::AspectContainer page5; // CDB Utils::AspectContainer page5; // CDB
Utils::AspectContainer page6; // CDB Paths Utils::AspectContainer page6; // CDB Paths

View File

@@ -364,7 +364,6 @@ const char MENU_GROUP_SPECIAL[] = "Debugger.Group.Special";
const char MENU_GROUP_START_QML[] = "Debugger.Group.Start.Qml"; const char MENU_GROUP_START_QML[] = "Debugger.Group.Start.Qml";
void addCdbOptionPages(QList<IOptionsPage*> *opts); void addCdbOptionPages(QList<IOptionsPage*> *opts);
void addGdbOptionPages(QList<IOptionsPage*> *opts);
static QIcon startIcon(bool toolBarStyle) static QIcon startIcon(bool toolBarStyle)
{ {
@@ -1126,7 +1125,6 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
// }); // });
m_optionPages.append(new LocalsAndExpressionsOptionsPage); m_optionPages.append(new LocalsAndExpressionsOptionsPage);
addGdbOptionPages(&m_optionPages);
addCdbOptionPages(&m_optionPages); addCdbOptionPages(&m_optionPages);
connect(ModeManager::instance(), &ModeManager::currentModeAboutToChange, this, [] { connect(ModeManager::instance(), &ModeManager::currentModeAboutToChange, this, [] {

View File

@@ -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 <debugger/debuggeractions.h>
#include <debugger/debuggerconstants.h>
#include <debugger/debuggercore.h>
#include <debugger/debuggericons.h>
#include <debugger/debuggerinternalconstants.h>
#include <debugger/debuggertr.h>
#include <utils/layoutbuilder.h>
#include <commonoptionspage.h>
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(
"<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("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(
"<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("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(
"<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("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("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>");
multiInferior.setSettingsKey("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("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(
"<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("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>"));
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("<html><head/><body><i>" +
Tr::tr("The options below give access to advanced<br>"
"or experimental functions of GDB.<p>"
"Enabling them may negatively impact<br>"
"your debugging experience.") + "</i></body></html>");
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

View File

@@ -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 <coreplugin/dialogs/ioptionspage.h>
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