diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 0369ed14893..d21aab57c91 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -7,19 +7,133 @@ #include "debuggerinternalconstants.h" #include "debuggertr.h" +#ifdef Q_OS_WIN +#include "registerpostmortemaction.h" +#endif + #include +#include + using namespace Core; using namespace Debugger::Constants; using namespace Utils; namespace Debugger::Internal { -/////////////////////////////////////////////////////////////////////// -// -// CommonOptionsPage -// -/////////////////////////////////////////////////////////////////////// +// CommonSettings + +CommonSettings &commonSettings() +{ + static CommonSettings settings; + return settings; +} + +CommonSettings::CommonSettings() +{ + const QString debugModeGroup("DebugMode"); + + useAlternatingRowColors.setSettingsKey(debugModeGroup, "UseAlternatingRowColours"); + useAlternatingRowColors.setLabelText(Tr::tr("Use alternating row colors in debug views")); + + stationaryEditorWhileStepping.setSettingsKey(debugModeGroup, "StationaryEditorWhileStepping"); + stationaryEditorWhileStepping.setLabelText(Tr::tr("Keep editor stationary when stepping")); + stationaryEditorWhileStepping.setToolTip( + Tr::tr("Scrolls the editor only when it is necessary to keep the current line in view, " + "instead of keeping the next statement centered at all times.")); + + forceLoggingToConsole.setSettingsKey(debugModeGroup, "ForceLoggingToConsole"); + forceLoggingToConsole.setLabelText(Tr::tr("Force logging to console")); + forceLoggingToConsole.setToolTip( + Tr::tr("Sets QT_LOGGING_TO_CONSOLE=1 in the environment of the debugged program, " + "preventing storing debug output in system logs.")); + + fontSizeFollowsEditor.setSettingsKey(debugModeGroup, "FontSizeFollowsEditor"); + fontSizeFollowsEditor.setToolTip(Tr::tr("Changes the font size in the debugger views when " + "the font size in the main editor changes.")); + fontSizeFollowsEditor.setLabelText(Tr::tr("Debugger font size follows main editor")); + +#ifdef Q_OS_WIN + registerForPostMortem = new RegisterPostMortemAction; + registerForPostMortem->setSettingsKey(debugModeGroup, "RegisterForPostMortem"); + registerForPostMortem->setToolTip(Tr::tr("Registers %1 for debugging crashed applications.") + .arg(QGuiApplication::applicationDisplayName())); + registerForPostMortem->setLabelText( + Tr::tr("Use %1 for post-mortem debugging").arg(QGuiApplication::applicationDisplayName())); + registerAspect(registerForPostMortem); +#else + // Some dummy. + registerForPostMortem = new BoolAspect; + registerForPostMortem->setVisible(false); +#endif + + maximalStackDepth.setSettingsKey(debugModeGroup, "MaximalStackDepth"); + maximalStackDepth.setDefaultValue(20); + maximalStackDepth.setSpecialValueText(Tr::tr("")); + maximalStackDepth.setRange(0, 1000); + maximalStackDepth.setSingleStep(5); + maximalStackDepth.setLabelText(Tr::tr("Maximum stack depth:")); + + showQmlObjectTree.setSettingsKey(debugModeGroup, "ShowQmlObjectTree"); + showQmlObjectTree.setDefaultValue(true); + showQmlObjectTree.setToolTip(Tr::tr("Shows QML object tree in Locals and Expressions " + "when connected and not stepping.")); + showQmlObjectTree.setLabelText(Tr::tr("Show QML object tree")); + + const QString t = Tr::tr("Stopping and stepping in the debugger " + "will automatically open views associated with the current location.") + '\n'; + + closeSourceBuffersOnExit.setSettingsKey(debugModeGroup, "CloseBuffersOnExit"); + closeSourceBuffersOnExit.setLabelText(Tr::tr("Close temporary source views on debugger exit")); + closeSourceBuffersOnExit.setToolTip(t + Tr::tr("Closes automatically opened source views when the debugger exits.")); + + closeMemoryBuffersOnExit.setSettingsKey(debugModeGroup, "CloseMemoryBuffersOnExit"); + closeMemoryBuffersOnExit.setDefaultValue(true); + closeMemoryBuffersOnExit.setLabelText(Tr::tr("Close temporary memory views on debugger exit")); + closeMemoryBuffersOnExit.setToolTip(t + Tr::tr("Closes automatically opened memory views when the debugger exits.")); + + switchModeOnExit.setSettingsKey(debugModeGroup, "SwitchModeOnExit"); + switchModeOnExit.setLabelText(Tr::tr("Switch to previous mode on debugger exit")); + + breakpointsFullPathByDefault.setSettingsKey(debugModeGroup, "BreakpointsFullPath"); + breakpointsFullPathByDefault.setToolTip(Tr::tr("Enables a full file path in breakpoints by default also for GDB.")); + breakpointsFullPathByDefault.setLabelText(Tr::tr("Set breakpoints using a full absolute path")); + + raiseOnInterrupt.setSettingsKey(debugModeGroup, "RaiseOnInterrupt"); + raiseOnInterrupt.setDefaultValue(true); + raiseOnInterrupt.setLabelText(Tr::tr("Bring %1 to foreground when application interrupts") + .arg(QGuiApplication::applicationDisplayName())); + + useAnnotationsInMainEditor.setSettingsKey(debugModeGroup, "UseAnnotations"); + useAnnotationsInMainEditor.setLabelText(Tr::tr("Use annotations in main editor when debugging")); + useAnnotationsInMainEditor.setToolTip( + "

" + + Tr::tr("Shows simple variable values " + "as annotations in the main editor during debugging.")); + useAnnotationsInMainEditor.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")); + useToolTipsInMainEditor.setToolTip( + "

" + + Tr::tr("Enables tooltips for variable " + "values during debugging. Since this can slow down debugging and " + "does not provide reliable information as it does not use scope " + "information, it is switched off by default.")); + useToolTipsInMainEditor.setDefaultValue(true); +} + +CommonSettings::~CommonSettings() +{ + delete registerForPostMortem; +} + class CommonOptionsPageWidget : public Core::IOptionsPageWidget { @@ -67,23 +181,12 @@ public: } }; -CommonOptionsPage::CommonOptionsPage() -{ - setId(DEBUGGER_COMMON_SETTINGS_ID); - setDisplayName(Tr::tr("General")); - setCategory(DEBUGGER_SETTINGS_CATEGORY); - setDisplayCategory(Tr::tr("Debugger")); - setCategoryIconPath(":/debugger/images/settingscategory_debugger.png"); - setWidgetCreator([] { return new CommonOptionsPageWidget; }); -} - -QString CommonOptionsPage::msgSetBreakpointAtFunction(const char *function) +QString msgSetBreakpointAtFunction(const char *function) { return Tr::tr("Stop when %1() is called").arg(QLatin1String(function)); } -QString CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(const char *function, - const QString &hint) +QString msgSetBreakpointAtFunctionToolTip(const char *function, const QString &hint) { QString result = ""; result += Tr::tr("Always adds a breakpoint on the %1() function.") @@ -96,6 +199,23 @@ QString CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(const char *functio return result; } +// CommonSettingPage + +class CommonSettingsPage final : public Core::IOptionsPage +{ +public: + CommonSettingsPage() + { + setId(DEBUGGER_COMMON_SETTINGS_ID); + setDisplayName(Tr::tr("General")); + setCategory(DEBUGGER_SETTINGS_CATEGORY); + setDisplayCategory(Tr::tr("Debugger")); + setCategoryIconPath(":/debugger/images/settingscategory_debugger.png"); + setWidgetCreator([] { return new CommonOptionsPageWidget; }); + } +}; + +const CommonSettingsPage commonSettingsPage; /////////////////////////////////////////////////////////////////////// // diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h index 33349605115..f5806b39d69 100644 --- a/src/plugins/debugger/commonoptionspage.h +++ b/src/plugins/debugger/commonoptionspage.h @@ -7,16 +7,65 @@ namespace Debugger::Internal { -class CommonOptionsPage final : public Core::IOptionsPage +class SourcePathMapAspectPrivate; + +// Entries starting with '(' are considered regular expressions in the ElfReader. +// This is useful when there are multiple build machines with different +// path, and the user would like to match anything up to some known +// directory to his local project. +// Syntax: (/home/.*)/KnownSubdir -> /home/my/project +using SourcePathMap = QMap; + +class SourcePathMapAspect : public Utils::TypedAspect { public: - CommonOptionsPage(); + SourcePathMapAspect(); + ~SourcePathMapAspect() override; - static QString msgSetBreakpointAtFunction(const char *function); - static QString msgSetBreakpointAtFunctionToolTip(const char *function, - const QString &hint = {}); + void fromMap(const QVariantMap &map) override; + void toMap(QVariantMap &map) const override; + + void addToLayout(Layouting::LayoutItem &parent) override; + + void readSettings() override; + void writeSettings() const override; + +private: + void guiToBuffer() override; + void bufferToGui() override; + + SourcePathMapAspectPrivate *d = nullptr; }; +class CommonSettings final : public Utils::AspectContainer +{ +public: + CommonSettings(); + ~CommonSettings(); + + Utils::BoolAspect useAlternatingRowColors; + Utils::BoolAspect useAnnotationsInMainEditor; + Utils::BoolAspect useToolTipsInMainEditor; + Utils::BoolAspect closeSourceBuffersOnExit; + Utils::BoolAspect closeMemoryBuffersOnExit; + Utils::BoolAspect raiseOnInterrupt; + Utils::BoolAspect breakpointsFullPathByDefault; + Utils::BoolAspect warnOnReleaseBuilds; + Utils::IntegerAspect maximalStackDepth; + + Utils::BoolAspect fontSizeFollowsEditor; + Utils::BoolAspect switchModeOnExit; + Utils::BoolAspect showQmlObjectTree; + Utils::BoolAspect stationaryEditorWhileStepping; + Utils::BoolAspect forceLoggingToConsole; + + SourcePathMapAspect sourcePathMap; + + Utils::BoolAspect *registerForPostMortem = nullptr; +}; + +CommonSettings &commonSettings(); + class LocalsAndExpressionsOptionsPage final : public Core::IOptionsPage { public: @@ -24,3 +73,5 @@ public: }; } // Debugger::Internal + +Q_DECLARE_METATYPE(Debugger::Internal::SourcePathMap) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index aaf9971a623..e1b4c57fb4d 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -9,10 +9,6 @@ #include "debuggertr.h" #include "gdb/gdbsettings.h" -#ifdef Q_OS_WIN -#include "registerpostmortemaction.h" -#endif - #include #include @@ -25,14 +21,7 @@ using namespace Utils; namespace Debugger::Internal { -const char debugModeSettingsGroupC[] = "DebugMode"; -const char cdbSettingsGroupC[] = "CDB2"; - -////////////////////////////////////////////////////////////////////////// -// // DebuggerSettings -// -////////////////////////////////////////////////////////////////////////// DebuggerSettings &settings() { @@ -41,6 +30,25 @@ DebuggerSettings &settings() } DebuggerSettings::DebuggerSettings() : + useAlternatingRowColors{commonSettings().useAlternatingRowColors}, + useAnnotationsInMainEditor{commonSettings().useAnnotationsInMainEditor}, + useToolTipsInMainEditor{commonSettings().useToolTipsInMainEditor}, + closeSourceBuffersOnExit{commonSettings().closeSourceBuffersOnExit}, + closeMemoryBuffersOnExit{commonSettings().closeMemoryBuffersOnExit}, + raiseOnInterrupt{commonSettings().raiseOnInterrupt}, + breakpointsFullPathByDefault{commonSettings().breakpointsFullPathByDefault}, + warnOnReleaseBuilds{commonSettings().warnOnReleaseBuilds}, + maximalStackDepth{commonSettings().maximalStackDepth}, + + fontSizeFollowsEditor{commonSettings().fontSizeFollowsEditor}, + switchModeOnExit{commonSettings().switchModeOnExit}, + showQmlObjectTree{commonSettings().showQmlObjectTree}, + stationaryEditorWhileStepping{commonSettings().stationaryEditorWhileStepping}, + forceLoggingToConsole{commonSettings().forceLoggingToConsole}, + + sourcePathMap{commonSettings().sourcePathMap}, + registerForPostMortem{*commonSettings().registerForPostMortem}, + gdbWatchdogTimeout{gdbSettings().gdbWatchdogTimeout}, skipKnownFrames{gdbSettings().skipKnownFrames}, useMessageBoxForSignals{gdbSettings().useMessageBoxForSignals}, @@ -63,8 +71,8 @@ DebuggerSettings::DebuggerSettings() : enableReverseDebugging{gdbSettings().enableReverseDebugging}, multiInferior{gdbSettings().multiInferior} { - const QString debugModeGroup(debugModeSettingsGroupC); - const QString cdbSettingsGroup(cdbSettingsGroupC); + const QString debugModeGroup("DebugMode"); + const QString cdbSettingsGroup("CDB2"); settingsDialog.setLabelText(Tr::tr("Configure Debugger...")); @@ -101,29 +109,6 @@ DebuggerSettings::DebuggerSettings() : alwaysAdjustColumnWidths.setSettingsKey(debugModeGroup, "AlwaysAdjustColumnWidths"); alwaysAdjustColumnWidths.setDefaultValue(true); - // Needed by QML Inspector - //useAlternatingRowColors.setLabelText(Tr::tr("Use Alternating Row Colors")); - useAlternatingRowColors.setSettingsKey(debugModeGroup, "UseAlternatingRowColours"); - useAlternatingRowColors.setLabelText(Tr::tr("Use alternating row colors in debug views")); - - stationaryEditorWhileStepping.setSettingsKey(debugModeGroup, "StationaryEditorWhileStepping"); - stationaryEditorWhileStepping.setLabelText(Tr::tr("Keep editor stationary when stepping")); - stationaryEditorWhileStepping.setToolTip(Tr::tr("Scrolls the editor only when it is necessary " - "to keep the current line in view, " - "instead of keeping the next statement centered at " - "all times.")); - - forceLoggingToConsole.setSettingsKey(debugModeGroup, "ForceLoggingToConsole"); - forceLoggingToConsole.setLabelText(Tr::tr("Force logging to console")); - forceLoggingToConsole.setToolTip(Tr::tr("Sets QT_LOGGING_TO_CONSOLE=1 in the environment " - "of the debugged program, preventing storing debug output " - "in system logs.")); - - fontSizeFollowsEditor.setSettingsKey(debugModeGroup, "FontSizeFollowsEditor"); - fontSizeFollowsEditor.setToolTip(Tr::tr("Changes the font size in the debugger views when " - "the font size in the main editor changes.")); - fontSizeFollowsEditor.setLabelText(Tr::tr("Debugger font size follows main editor")); - logTimeStamps.setLabelText(Tr::tr("Log Time Stamps")); logTimeStamps.setSettingsKey(debugModeGroup, "LogTimeStamps"); @@ -150,11 +135,9 @@ DebuggerSettings::DebuggerSettings() : cdbBreakEvents.setSettingsKey(cdbSettingsGroup, "BreakEvent"); cdbBreakOnCrtDbgReport.setSettingsKey(cdbSettingsGroup, "BreakOnCrtDbgReport"); - cdbBreakOnCrtDbgReport.setLabelText( - CommonOptionsPage::msgSetBreakpointAtFunction(Constants::CRT_DEBUG_REPORT)); - cdbBreakOnCrtDbgReport.setToolTip( - CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(Constants::CRT_DEBUG_REPORT, - Tr::tr("Catches runtime error messages caused by assert(), for example."))); + cdbBreakOnCrtDbgReport.setLabelText(msgSetBreakpointAtFunction(Constants::CRT_DEBUG_REPORT)); + cdbBreakOnCrtDbgReport.setToolTip(msgSetBreakpointAtFunctionToolTip(Constants::CRT_DEBUG_REPORT, + Tr::tr("Catches runtime error messages caused by assert(), for example."))); useCdbConsole.setSettingsKey(cdbSettingsGroup, "CDB_Console"); useCdbConsole.setToolTip("

" + Tr::tr( @@ -261,57 +244,9 @@ DebuggerSettings::DebuggerSettings() : // Label text is intentional empty in the GUI. extraDumperFile.setToolTip(Tr::tr("Path to a Python file containing additional data dumpers.")); - const QString t = Tr::tr("Stopping and stepping in the debugger " - "will automatically open views associated with the current location.") + '\n'; - - closeSourceBuffersOnExit.setSettingsKey(debugModeGroup, "CloseBuffersOnExit"); - closeSourceBuffersOnExit.setLabelText(Tr::tr("Close temporary source views on debugger exit")); - closeSourceBuffersOnExit.setToolTip(t + Tr::tr("Closes automatically opened source views when the debugger exits.")); - - closeMemoryBuffersOnExit.setSettingsKey(debugModeGroup, "CloseMemoryBuffersOnExit"); - closeMemoryBuffersOnExit.setDefaultValue(true); - closeMemoryBuffersOnExit.setLabelText(Tr::tr("Close temporary memory views on debugger exit")); - closeMemoryBuffersOnExit.setToolTip(t + Tr::tr("Closes automatically opened memory views when the debugger exits.")); - - switchModeOnExit.setSettingsKey(debugModeGroup, "SwitchModeOnExit"); - switchModeOnExit.setLabelText(Tr::tr("Switch to previous mode on debugger exit")); - - breakpointsFullPathByDefault.setSettingsKey(debugModeGroup, "BreakpointsFullPath"); - breakpointsFullPathByDefault.setToolTip(Tr::tr("Enables a full file path in breakpoints by default also for GDB.")); - breakpointsFullPathByDefault.setLabelText(Tr::tr("Set breakpoints using a full absolute path")); - - raiseOnInterrupt.setSettingsKey(debugModeGroup, "RaiseOnInterrupt"); - raiseOnInterrupt.setDefaultValue(true); - raiseOnInterrupt.setLabelText(Tr::tr("Bring %1 to foreground when application interrupts") - .arg(QGuiApplication::applicationDisplayName())); - autoQuit.setSettingsKey(debugModeGroup, "AutoQuit"); autoQuit.setLabelText(Tr::tr("Automatically Quit Debugger")); - useAnnotationsInMainEditor.setSettingsKey(debugModeGroup, "UseAnnotations"); - useAnnotationsInMainEditor.setLabelText(Tr::tr("Use annotations in main editor when debugging")); - useAnnotationsInMainEditor.setToolTip( - "

" - + Tr::tr("Shows simple variable values " - "as annotations in the main editor during debugging.")); - useAnnotationsInMainEditor.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")); - useToolTipsInMainEditor.setToolTip( - "

" - + Tr::tr("Enables tooltips for variable " - "values during debugging. Since this can slow down debugging and " - "does not provide reliable information as it does not use scope " - "information, it is switched off by default.")); - useToolTipsInMainEditor.setDefaultValue(true); - useToolTipsInLocalsView.setSettingsKey(debugModeGroup, "UseToolTipsInLocalsView"); useToolTipsInLocalsView.setLabelText(Tr::tr("Use Tooltips in Locals View when Debugging")); useToolTipsInLocalsView.setToolTip("

" @@ -331,19 +266,6 @@ DebuggerSettings::DebuggerSettings() : "view during debugging.")); useToolTipsInStackView.setDefaultValue(true); -#ifdef Q_OS_WIN - registerForPostMortem = new RegisterPostMortemAction; - registerForPostMortem->setSettingsKey(debugModeGroup, "RegisterForPostMortem"); - registerForPostMortem->setToolTip(Tr::tr("Registers %1 for debugging crashed applications.") - .arg(QGuiApplication::applicationDisplayName())); - registerForPostMortem->setLabelText( - Tr::tr("Use %1 for post-mortem debugging").arg(QGuiApplication::applicationDisplayName())); -#else - // Some dummy. - registerForPostMortem = new BoolAspect; - registerForPostMortem->setVisible(false); -#endif - allPluginBreakpoints.setSettingsKey(debugModeGroup, "AllPluginBreakpoints"); allPluginBreakpoints.setDefaultValue(true); @@ -354,13 +276,6 @@ DebuggerSettings::DebuggerSettings() : selectedPluginBreakpointsPattern.setSettingsKey(debugModeGroup, "SelectedPluginBreakpointsPattern"); selectedPluginBreakpointsPattern.setDefaultValue(QString(".*")); - maximalStackDepth.setSettingsKey(debugModeGroup, "MaximalStackDepth"); - maximalStackDepth.setDefaultValue(20); - maximalStackDepth.setSpecialValueText(Tr::tr("")); - maximalStackDepth.setRange(0, 1000); - maximalStackDepth.setSingleStep(5); - maximalStackDepth.setLabelText(Tr::tr("Maximum stack depth:")); - displayStringLimit.setSettingsKey(debugModeGroup, "DisplayStringLimit"); displayStringLimit.setDefaultValue(300); displayStringLimit.setSpecialValueText(Tr::tr("")); @@ -400,35 +315,9 @@ DebuggerSettings::DebuggerSettings() : // // QML Tools // - showQmlObjectTree.setSettingsKey(debugModeGroup, "ShowQmlObjectTree"); - showQmlObjectTree.setDefaultValue(true); - showQmlObjectTree.setToolTip(Tr::tr("Shows QML object tree in Locals and Expressions " - "when connected and not stepping.")); - showQmlObjectTree.setLabelText(Tr::tr("Show QML object tree")); - const QString qmlInspectorGroup = "QML.Inspector"; showAppOnTop.setSettingsKey(qmlInspectorGroup, "QmlInspector.ShowAppOnTop"); - // Page 1 - page1.registerAspect(&useAlternatingRowColors); - page1.registerAspect(&useAnnotationsInMainEditor); - page1.registerAspect(&useToolTipsInMainEditor); - page1.registerAspect(&closeSourceBuffersOnExit); - page1.registerAspect(&closeMemoryBuffersOnExit); - page1.registerAspect(&raiseOnInterrupt); - page1.registerAspect(&breakpointsFullPathByDefault); - page1.registerAspect(&warnOnReleaseBuilds); - page1.registerAspect(&maximalStackDepth); - - page1.registerAspect(&fontSizeFollowsEditor); - page1.registerAspect(&switchModeOnExit); - page1.registerAspect(&showQmlObjectTree); - page1.registerAspect(&stationaryEditorWhileStepping); - page1.registerAspect(&forceLoggingToConsole); - - page1.registerAspect(&sourcePathMap); - if (HostOsInfo::isWindowsHost()) - page1.registerAspect(registerForPostMortem); // Page 4 page4.registerAspect(&useDebuggingHelpers); @@ -481,11 +370,6 @@ DebuggerSettings::DebuggerSettings() : }); } -DebuggerSettings::~DebuggerSettings() -{ - delete registerForPostMortem; -} - void DebuggerSettings::readSettings() { all.readSettings(); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 063967dc90f..9ea285388ae 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -5,56 +5,39 @@ #include -#include -#include #include namespace Debugger::Internal { -class SourcePathMapAspectPrivate; - -// Entries starting with '(' are considered regular expressions in the ElfReader. -// This is useful when there are multiple build machines with different -// path, and the user would like to match anything up to some known -// directory to his local project. -// Syntax: (/home/.*)/KnownSubdir -> /home/my/project -using SourcePathMap = QMap; - -class SourcePathMapAspect : public Utils::TypedAspect -{ -public: - SourcePathMapAspect(); - ~SourcePathMapAspect() override; - - void fromMap(const QVariantMap &map) override; - void toMap(QVariantMap &map) const override; - - void addToLayout(Layouting::LayoutItem &parent) override; - - void readSettings() override; - void writeSettings() const override; - -private: - void guiToBuffer() override; - void bufferToGui() override; - - SourcePathMapAspectPrivate *d = nullptr; -}; - -class GeneralSettings -{ - GeneralSettings(); - ~GeneralSettings(); -}; - class DebuggerSettings { public: - explicit DebuggerSettings(); - ~DebuggerSettings(); + DebuggerSettings(); static QString dump(); + // Page 1: General + Utils::BoolAspect &useAlternatingRowColors; + Utils::BoolAspect &useAnnotationsInMainEditor; + Utils::BoolAspect &useToolTipsInMainEditor; + Utils::BoolAspect &closeSourceBuffersOnExit; + Utils::BoolAspect &closeMemoryBuffersOnExit; + Utils::BoolAspect &raiseOnInterrupt; + Utils::BoolAspect &breakpointsFullPathByDefault; + Utils::BoolAspect &warnOnReleaseBuilds; + Utils::IntegerAspect &maximalStackDepth; + + Utils::BoolAspect &fontSizeFollowsEditor; + Utils::BoolAspect &switchModeOnExit; + Utils::BoolAspect &showQmlObjectTree; + Utils::BoolAspect &stationaryEditorWhileStepping; + Utils::BoolAspect &forceLoggingToConsole; + + Utils::TypedAspect> &sourcePathMap; + + Utils::BoolAspect ®isterForPostMortem; + + // Page 2: Gdb Utils::IntegerAspect &gdbWatchdogTimeout; Utils::BoolAspect &skipKnownFrames; Utils::BoolAspect &useMessageBoxForSignals; @@ -78,25 +61,6 @@ public: Utils::BoolAspect &enableReverseDebugging; Utils::BoolAspect &multiInferior; - // Page 1: General - Utils::BoolAspect useAlternatingRowColors; - Utils::BoolAspect useAnnotationsInMainEditor; - Utils::BoolAspect useToolTipsInMainEditor; - Utils::BoolAspect closeSourceBuffersOnExit; - Utils::BoolAspect closeMemoryBuffersOnExit; - Utils::BoolAspect raiseOnInterrupt; - Utils::BoolAspect breakpointsFullPathByDefault; - Utils::BoolAspect warnOnReleaseBuilds; - Utils::IntegerAspect maximalStackDepth; - - Utils::BoolAspect fontSizeFollowsEditor; - Utils::BoolAspect switchModeOnExit; - Utils::BoolAspect showQmlObjectTree; - Utils::BoolAspect stationaryEditorWhileStepping; - Utils::BoolAspect forceLoggingToConsole; - - SourcePathMapAspect sourcePathMap; - // Page 4: Locals and expressions Utils::BoolAspect useDebuggingHelpers; Utils::BoolAspect useCodeModel; @@ -119,8 +83,6 @@ public: Utils::BoolAspect secondChanceExceptionTaskEntry; Utils::BoolAspect ignoreFirstChanceAccessViolation; - Utils::BoolAspect *registerForPostMortem = nullptr; - // Page 6: CDB Paths Utils::StringListAspect cdbSymbolPaths; Utils::StringListAspect cdbSourcePaths; @@ -172,6 +134,7 @@ private: DebuggerSettings &settings(); -} // Debugger::Internal +QString msgSetBreakpointAtFunction(const char *function); +QString msgSetBreakpointAtFunctionToolTip(const char *function, const QString &hint = {}); -Q_DECLARE_METATYPE(Debugger::Internal::SourcePathMap) +} // Debugger::Internal diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index e7f8b47848d..48d4a938cea 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -2821,7 +2821,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp) bool hasEmbeddedInfo = elfData.indexOf(".debug_info") >= 0; bool hasLink = elfData.indexOf(".gnu_debuglink") >= 0; if (hasEmbeddedInfo) { - const SourcePathMap sourcePathMap = settings().sourcePathMap(); + const QMap sourcePathMap = settings().sourcePathMap(); QList> globalRegExpSourceMap; globalRegExpSourceMap.reserve(sourcePathMap.size()); for (auto it = sourcePathMap.begin(), end = sourcePathMap.end(); it != end; ++it) { diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 6a6f60f08d5..63ab6b95d41 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -25,7 +25,6 @@ #include "sourceutils.h" #include "shared/hostutils.h" #include "console/console.h" - #include "commonoptionspage.h" #include "analyzer/analyzerconstants.h" @@ -697,7 +696,6 @@ public: std::unique_ptr m_perspectiveCmake; DebuggerKitAspect debuggerKitAspect; - CommonOptionsPage commonOptionsPage; DebuggerRunWorkerFactory debuggerWorkerFactory; diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index a8959ff4455..6ec92416ed8 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -3,7 +3,7 @@ #include "debuggersourcepathmappingwidget.h" -#include "debuggeractions.h" +#include "commonoptionspage.h" #include "debuggerengine.h" #include "debuggertr.h" diff --git a/src/plugins/debugger/gdb/gdbsettings.cpp b/src/plugins/debugger/gdb/gdbsettings.cpp index 31c8e3f6912..eef19df9719 100644 --- a/src/plugins/debugger/gdb/gdbsettings.cpp +++ b/src/plugins/debugger/gdb/gdbsettings.cpp @@ -69,18 +69,18 @@ GdbSettings::GdbSettings() 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")); + breakOnWarning.setLabelText(msgSetBreakpointAtFunction("qWarning")); + breakOnWarning.setToolTip(msgSetBreakpointAtFunctionToolTip("qWarning")); breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\"")); breakOnFatal.setSettingsKey("BreakOnFatal"); - breakOnFatal.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal")); - breakOnFatal.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal")); + breakOnFatal.setLabelText(msgSetBreakpointAtFunction("qFatal")); + breakOnFatal.setToolTip(msgSetBreakpointAtFunctionToolTip("qFatal")); breakOnAbort.setLabelText(Tr::tr("Break on \"abort\"")); breakOnAbort.setSettingsKey("BreakOnAbort"); - breakOnAbort.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("abort")); - breakOnAbort.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort")); + breakOnAbort.setLabelText(msgSetBreakpointAtFunction("abort")); + breakOnAbort.setToolTip(msgSetBreakpointAtFunctionToolTip("abort")); loadGdbInit.setSettingsKey("LoadGdbInit"); loadGdbInit.setDefaultValue(true);