/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "debuggeractions.h"
#include "commonoptionspage.h"
#include "debuggericons.h"
#include "debuggerinternalconstants.h"
#ifdef Q_OS_WIN
#include "registerpostmortemaction.h"
#endif
#include This switches the Locals and Expressions views to "
"automatically dereference pointers. This saves a level in the "
"tree view, but also loses data for the now-missing intermediate "
"level."));
//
// Cdb Options
//
cdbAdditionalArguments.setSettingsKey(cdbSettingsGroup, "AdditionalArguments");
cdbAdditionalArguments.setDisplayStyle(StringAspect::LineEditDisplay);
cdbAdditionalArguments.setLabelText(tr("Additional arguments:"));
cdbSymbolPaths.setSettingsKey(cdbSettingsGroup, "SymbolPaths");
cdbSourcePaths.setSettingsKey(cdbSettingsGroup, "SourcePaths");
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("Catches runtime error messages caused by assert(), for example.")));
useCdbConsole.setSettingsKey(cdbSettingsGroup, "CDB_Console");
useCdbConsole.setToolTip(" " + tr(
"Uses CDB's native console for console applications. "
"This overrides the setting in Environment > System. "
"The native console does not prompt on application exit. "
"It is suitable for diagnosing cases in which the application does not "
"start up properly in the configured console and the subsequent attach fails.")
+ " " + tr(
"Attempts to correct the location of a breakpoint based on file and line number should"
"it be in a comment or in a line for which no code is generated. "
"The correction is based on the code model.") + " Shows \"std::\" prefix for types from the standard library."));
showQtNamespace.setSettingsKey(debugModeGroup, "ShowQtNamespace");
showQtNamespace.setDefaultValue(true);
showQtNamespace.setDisplayName(tr("Show Qt's Namespace in Types"));
showQtNamespace.setLabelText(tr("Show Qt's namespace in types"));
showQtNamespace.setToolTip(tr(" Shows Qt namespace prefix for Qt types. This is only "
"relevant if Qt was configured with \"-qtnamespace\"."));
showQObjectNames.setSettingsKey(debugModeGroup, "ShowQObjectNames2");
showQObjectNames.setDefaultValue(true);
showQObjectNames.setDisplayName(tr("Show QObject names if available"));
showQObjectNames.setLabelText(tr("Show QObject names if available"));
showQObjectNames.setToolTip(tr(" Displays the objectName property of QObject based items. "
"Note that this can negatively impact debugger performance "
"even if no QObjects are present."));
sortStructMembers.setSettingsKey(debugModeGroup, "SortStructMembers");
sortStructMembers.setDisplayName(tr("Sort Members of Classes and Structs Alphabetically"));
sortStructMembers.setLabelText(tr("Sort members of classes and structs alphabetically"));
sortStructMembers.setDefaultValue(true);
//
// DebuggingHelper
//
useDebuggingHelpers.setSettingsKey(debugModeGroup, "UseDebuggingHelper");
useDebuggingHelpers.setDefaultValue(true);
useDebuggingHelpers.setLabelText(tr("Use Debugging Helpers"));
useCodeModel.setSettingsKey(debugModeGroup, "UseCodeModel");
useCodeModel.setDefaultValue(true);
useCodeModel.setLabelText(tr("Use code model"));
useCodeModel.setToolTip(tr(" Selecting this causes the C++ Code Model being asked "
"for variable scope information. This might result in slightly faster "
"debugger operation but may fail for optimized code."));
showThreadNames.setSettingsKey(debugModeGroup, "ShowThreadNames");
showThreadNames.setLabelText(tr("Display thread names"));
showThreadNames.setToolTip(tr(" Displays names of QThread based threads."));
//
// Breakpoints
//
synchronizeBreakpoints.setLabelText(tr("Synchronize Breakpoints"));
adjustBreakpointLocations.setDisplayName(tr("Adjust Breakpoint Locations"));
adjustBreakpointLocations.setToolTip(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(/*GdbOptionsPage::*/tr(
"Adjust breakpoint locations"));
adjustBreakpointLocations.setToolTip(/*GdbOptionsPage::*/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("Break on \"throw\""));
breakOnThrow.setSettingsKey(debugModeGroup, "BreakOnThrow");
breakOnCatch.setLabelText(tr("Break on \"catch\""));
breakOnCatch.setSettingsKey(debugModeGroup, "BreakOnCatch");
breakOnWarning.setLabelText(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("Break on \"qFatal\""));
breakOnFatal.setSettingsKey(debugModeGroup, "BreakOnFatal");
breakOnFatal.setLabelText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal"));
breakOnFatal.setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal"));
breakOnAbort.setLabelText(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(/*GdbOptionsPage::*/tr("Load .gdbinit file on startup"));
loadGdbInit.setToolTip(/*GdbOptionsPage::*/tr(
"Allows or inhibits reading the user's default\n"
".gdbinit file on debugger startup."));
loadGdbDumpers.setSettingsKey(debugModeGroup, "LoadGdbDumpers2");
loadGdbDumpers.setLabelText(/*GdbOptionsPage::*/tr("Load system GDB pretty printers"));
loadGdbDumpers.setToolTip(/*GdbOptionsPage::*/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(/*GdbOptionsPage::*/tr(
"Use common locations for debug information"));
autoEnrichParameters.setToolTip(/*GdbOptionsPage::*/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'). " + /*GdbOptionsPage::*/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.") + "
" + /*GdbOptionsPage::*/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(); extraDumperCommands.setToolTip("" + tr("Python commands entered here will be executed after built-in " "debugging helpers have been loaded and fully initialized. You can " "load additional debugging helpers or modify existing ones here.") + "
"); extraDumperFile.setSettingsKey(debugModeGroup, "ExtraDumperFile"); extraDumperFile.setDisplayStyle(StringAspect::PathChooserDisplay); extraDumperFile.setDisplayName(tr("Extra Debugging Helpers")); // Label text is intentional empty in the GUI. extraDumperFile.setToolTip(tr("Path to a Python file containing additional data dumpers.")); const QString t = tr("Stopping and stepping in the debugger " "will automatically open views associated with the current location.") + '\n'; closeSourceBuffersOnExit.setSettingsKey(debugModeGroup, "CloseBuffersOnExit"); closeSourceBuffersOnExit.setLabelText(tr("Close temporary source views on debugger exit")); closeSourceBuffersOnExit.setToolTip(t + tr("Closes automatically opened source views when the debugger exits.")); closeMemoryBuffersOnExit.setSettingsKey(debugModeGroup, "CloseMemoryBuffersOnExit"); closeMemoryBuffersOnExit.setDefaultValue(true); closeMemoryBuffersOnExit.setLabelText(tr("Close temporary memory views on debugger exit")); closeMemoryBuffersOnExit.setToolTip(t + tr("Closes automatically opened memory views when the debugger exits.")); switchModeOnExit.setSettingsKey(debugModeGroup, "SwitchModeOnExit"); switchModeOnExit.setLabelText(tr("Switch to previous mode on debugger exit")); breakpointsFullPathByDefault.setSettingsKey(debugModeGroup, "BreakpointsFullPath"); breakpointsFullPathByDefault.setToolTip(tr("Enables a full file path in breakpoints by default also for GDB.")); breakpointsFullPathByDefault.setLabelText(tr("Set breakpoints using a full absolute path")); raiseOnInterrupt.setSettingsKey(debugModeGroup, "RaiseOnInterrupt"); raiseOnInterrupt.setDefaultValue(true); raiseOnInterrupt.setLabelText(tr("Bring %1 to foreground when application interrupts") .arg(Core::Constants::IDE_DISPLAY_NAME)); autoQuit.setSettingsKey(debugModeGroup, "AutoQuit"); autoQuit.setLabelText(tr("Automatically Quit Debugger")); multiInferior.setSettingsKey(debugModeGroup, "MultiInferior"); multiInferior.setLabelText(/*GdbOptionsPage::*/tr("Debug all child processes")); multiInferior.setToolTip(/*GdbOptionsPage::*/tr( "Keeps debugging all children after a fork." "")); intelFlavor.setSettingsKey(debugModeGroup, "IntelFlavor"); intelFlavor.setLabelText(/*GdbOptionsPage::*/tr("Use Intel style disassembly")); intelFlavor.setToolTip(/*GdbOptionsPage::*/tr( "GDB shows by default AT&&T style disassembly.")); useAnnotationsInMainEditor.setSettingsKey(debugModeGroup, "UseAnnotations"); useAnnotationsInMainEditor.setLabelText(tr("Use annotations in main editor when debugging")); useAnnotationsInMainEditor.setToolTip(tr("Shows simple variable values " "as annotations in the main editor during debugging.")); useAnnotationsInMainEditor.setDefaultValue(true); usePseudoTracepoints.setSettingsKey(debugModeGroup, "UsePseudoTracepoints"); usePseudoTracepoints.setLabelText(/*GdbOptionsPage::*/tr("Use pseudo message tracepoints")); usePseudoTracepoints.setToolTip( /*GdbOptionsPage::*/ tr("Uses Python to extend the ordinary GDB breakpoint class.")); usePseudoTracepoints.setDefaultValue(true); useIndexCache.setSettingsKey(debugModeGroup, "UseIndexCache"); useIndexCache.setLabelText(tr("Use automatic symbol cache")); useIndexCache.setToolTip(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.setLabelText(tr("Use tooltips in main editor when debugging")); useToolTipsInMainEditor.setToolTip(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("Use Tooltips in Locals View when Debugging")); useToolTipsInLocalsView.setToolTip(tr("
Enables tooltips in the locals " "view during debugging.")); useToolTipsInBreakpointsView.setSettingsKey(debugModeGroup, "UseToolTipsInBreakpointsView"); useToolTipsInBreakpointsView.setLabelText(tr("Use Tooltips in Breakpoints View when Debugging")); useToolTipsInBreakpointsView.setToolTip(tr("
Enables tooltips in the breakpoints " "view during debugging.")); useToolTipsInStackView.setSettingsKey(debugModeGroup, "UseToolTipsInStackView"); useToolTipsInStackView.setLabelText(tr("Use Tooltips in Stack View when Debugging")); useToolTipsInStackView.setToolTip(tr("
Enables tooltips in the stack " "view during debugging.")); useToolTipsInStackView.setDefaultValue(true); skipKnownFrames.setSettingsKey(debugModeGroup, "SkipKnownFrames"); skipKnownFrames.setDisplayName(tr("Skip Known Frames")); skipKnownFrames.setLabelText(/*GdbOptionsPage::*/tr("Skip known frames when stepping")); skipKnownFrames.setToolTip(/*GdbOptionsPage::*/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("Enable Reverse Debugging")); enableReverseDebugging.setLabelText(/*GdbOptionsPage::*/tr("Enable reverse debugging")); enableReverseDebugging.setToolTip(/*GdbOptionsPage::*/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"); registerForPostMortem->setToolTip( tr("Registers %1 for debugging crashed applications.") .arg(Core::Constants::IDE_DISPLAY_NAME)); registerForPostMortem->setLabelText( tr("Use %1 for post-mortem debugging") .arg(Core::Constants::IDE_DISPLAY_NAME)); #else // Some dummy. registerForPostMortem = new BoolAspect; registerForPostMortem->setVisible(false); #endif allPluginBreakpoints.setSettingsKey(debugModeGroup, "AllPluginBreakpoints"); allPluginBreakpoints.setDefaultValue(true); selectedPluginBreakpoints.setSettingsKey(debugModeGroup, "SelectedPluginBreakpoints"); noPluginBreakpoints.setSettingsKey(debugModeGroup, "NoPluginBreakpoints"); selectedPluginBreakpointsPattern.setSettingsKey(debugModeGroup, "SelectedPluginBreakpointsPattern"); selectedPluginBreakpointsPattern.setDefaultValue(QString(".*")); maximalStackDepth.setSettingsKey(debugModeGroup, "MaximalStackDepth"); maximalStackDepth.setDefaultValue(20); maximalStackDepth.setSpecialValueText(tr("The maximum length of string entries in the "
"Locals and Expressions views. Longer than that are cut off "
"and displayed with an ellipsis attached."));
maximalStringLength.setSettingsKey(debugModeGroup, "MaximalStringLength");
maximalStringLength.setDefaultValue(10000);
maximalStringLength.setSpecialValueText(tr(" The maximum length for strings in separated windows. "
"Longer strings are cut off and displayed with an ellipsis attached."));
expandStack.setLabelText(tr("Reload Full Stack"));
createFullBacktrace.setLabelText(tr("Create Full Backtrace"));
gdbWatchdogTimeout.setSettingsKey(debugModeGroup, "WatchdogTimeout");
gdbWatchdogTimeout.setDefaultValue(20);
gdbWatchdogTimeout.setSuffix(/*GdbOptionsPage::*/tr("sec"));
gdbWatchdogTimeout.setRange(20, 1000000);
gdbWatchdogTimeout.setLabelText(/*GdbOptionsPage::*/tr("GDB timeout:"));
gdbWatchdogTimeout.setToolTip(/*GdbOptionsPage::*/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
//
showQmlObjectTree.setSettingsKey(debugModeGroup, "ShowQmlObjectTree");
showQmlObjectTree.setDefaultValue(true);
showQmlObjectTree.setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping."));
showQmlObjectTree.setLabelText(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);
// 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(&skipKnownFrames);
page2.registerAspect(&usePseudoTracepoints);
page2.registerAspect(&useIndexCache);
page2.registerAspect(&gdbStartupCommands);
page2.registerAspect(&gdbPostAttachCommands);
// Page 3
page3.registerAspect(&targetAsync);
page3.registerAspect(&autoEnrichParameters);
page3.registerAspect(&breakOnWarning);
page3.registerAspect(&breakOnFatal);
page3.registerAspect(&breakOnAbort);
page3.registerAspect(&enableReverseDebugging);
page3.registerAspect(&multiInferior);
// Page 4
page4.registerAspect(&useDebuggingHelpers);
page4.registerAspect(&useCodeModel);
page4.registerAspect(&showThreadNames);
page4.registerAspect(&showStdNamespace);
page4.registerAspect(&showQtNamespace);
page4.registerAspect(&extraDumperFile);
page4.registerAspect(&extraDumperCommands);
page4.registerAspect(&showQObjectNames);
page4.registerAspect(&displayStringLimit);
page4.registerAspect(&maximalStringLength);
// Page 5
page5.registerAspect(&cdbAdditionalArguments);
page5.registerAspect(&cdbBreakEvents);
page5.registerAspect(&cdbBreakOnCrtDbgReport);
page5.registerAspect(&useCdbConsole);
page5.registerAspect(&cdbBreakPointCorrection);
page5.registerAspect(&cdbUsePythonDumper);
page5.registerAspect(&firstChanceExceptionTaskEntry);
page5.registerAspect(&secondChanceExceptionTaskEntry);
page5.registerAspect(&ignoreFirstChanceAccessViolation);
if (HostOsInfo::isWindowsHost())
page5.registerAspect(registerForPostMortem);
// Page 6
page6.registerAspect(&cdbSymbolPaths);
page6.registerAspect(&cdbSourcePaths);
// Pageless
all.registerAspect(&autoDerefPointers);
all.registerAspect(&useToolTipsInLocalsView);
all.registerAspect(&alwaysAdjustColumnWidths);
all.registerAspect(&useToolTipsInBreakpointsView);
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(page3);
all.registerAspects(page4);
all.registerAspects(page5);
all.registerAspects(page6);
all.forEachAspect([](BaseAspect *aspect) {
aspect->setAutoApply(false);
// FIXME: Make the positioning part of the LayoutBuilder later
if (auto boolAspect = dynamic_cast