diff options
Diffstat (limited to 'src/plugins/debugger')
21 files changed, 219 insertions, 274 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 15d82c3436..5afd9da1a1 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1217,7 +1217,7 @@ void CdbEngine::activateFrame(int index) void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) { if (m_pythonVersion > 0x030000) { - watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); + watchHandler()->notifyUpdateStarted(updateParameters); DebuggerCommand cmd("theDumper.fetchVariables", ScriptCommand); watchHandler()->appendFormatRequests(&cmd); @@ -1270,7 +1270,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) return; } - watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); + watchHandler()->notifyUpdateStarted(updateParameters); /* Watchers: Forcibly discard old symbol group as switching from * thread 0/frame 0 -> thread 1/assembly -> thread 0/frame 0 will otherwise re-use it diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 96977c9fc8..47654f52bd 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -45,208 +45,11 @@ using namespace Core; using namespace Debugger::Constants; using namespace ProjectExplorer; +using namespace Utils; namespace Debugger { namespace Internal { -class CommonOptionsPageWidget : public QWidget -{ - Q_OBJECT - -public: - explicit CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group); - - GlobalDebuggerOptions globalOptions() const; - void setGlobalOptions(const GlobalDebuggerOptions &go); - -private: - QCheckBox *checkBoxUseAlternatingRowColors; - QCheckBox *checkBoxFontSizeFollowsEditor; - QCheckBox *checkBoxUseToolTipsInMainEditor; - QCheckBox *checkBoxCloseSourceBuffersOnExit; - QCheckBox *checkBoxCloseMemoryBuffersOnExit; - QCheckBox *checkBoxSwitchModeOnExit; - QCheckBox *checkBoxBringToForegroundOnInterrrupt; - QCheckBox *checkBoxShowQmlObjectTree; - QCheckBox *checkBoxBreakpointsFullPath; - QCheckBox *checkBoxRegisterForPostMortem; - QCheckBox *checkBoxWarnOnReleaseBuilds; - QCheckBox *checkBoxKeepEditorStationaryWhileStepping; - QLabel *labelMaximalStackDepth; - QSpinBox *spinBoxMaximalStackDepth; - - DebuggerSourcePathMappingWidget *sourcesMappingWidget; - const QSharedPointer<Utils::SavedActionSet> m_group; -}; - -CommonOptionsPageWidget::CommonOptionsPageWidget - (const QSharedPointer<Utils::SavedActionSet> &group) - : m_group(group) -{ - QGroupBox *behaviorBox = new QGroupBox(this); - behaviorBox->setTitle(tr("Behavior")); - - checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox); - checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views")); - - checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox); - checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes.")); - checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor")); - - checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox); - checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging")); - - QString t = tr("Stopping and stepping in the debugger " - "will automatically open views associated with the current location.") + QLatin1Char('\n'); - checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit")); - checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close " - "automatically opened source views when the debugger exits.")); - - checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit")); - checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close " - "automatically opened memory views when the debugger exits.")); - - checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox); - checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit")); - - checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox); - checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts")); - - checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox); - checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping.")); - checkBoxShowQmlObjectTree->setText(tr("Show QML object tree")); - - checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox); - checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB.")); - checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path")); - - checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox); - checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications.")); - checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging")); - - checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox); - checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds")); - checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger " - "on a binary with insufficient debug information.")); - - checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox); - checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping")); - checkBoxKeepEditorStationaryWhileStepping->setToolTip(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.")); - - labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox); - - spinBoxMaximalStackDepth = new QSpinBox(behaviorBox); - spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>")); - spinBoxMaximalStackDepth->setMaximum(999); - spinBoxMaximalStackDepth->setSingleStep(5); - spinBoxMaximalStackDepth->setValue(10); - - sourcesMappingWidget = new DebuggerSourcePathMappingWidget(this); - - QHBoxLayout *horizontalLayout = new QHBoxLayout(); - horizontalLayout->addWidget(labelMaximalStackDepth); - horizontalLayout->addWidget(spinBoxMaximalStackDepth); - horizontalLayout->addStretch(); - - QGridLayout *gridLayout = new QGridLayout(behaviorBox); - gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1); - gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1); - gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1); - gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1); - gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1); - gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1); - gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1); - gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2); - - gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1); - gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1); - gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1); - gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1); - gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1); - - QVBoxLayout *verticalLayout = new QVBoxLayout(this); - verticalLayout->addWidget(behaviorBox); - verticalLayout->addWidget(sourcesMappingWidget); - verticalLayout->addStretch(); - - m_group->clear(); - - m_group->insert(action(UseAlternatingRowColors), - checkBoxUseAlternatingRowColors); - m_group->insert(action(UseToolTipsInMainEditor), - checkBoxUseToolTipsInMainEditor); - m_group->insert(action(CloseSourceBuffersOnExit), - checkBoxCloseSourceBuffersOnExit); - m_group->insert(action(CloseMemoryBuffersOnExit), - checkBoxCloseMemoryBuffersOnExit); - m_group->insert(action(SwitchModeOnExit), - checkBoxSwitchModeOnExit); - m_group->insert(action(BreakpointsFullPathByDefault), - checkBoxBreakpointsFullPath); - m_group->insert(action(RaiseOnInterrupt), - checkBoxBringToForegroundOnInterrrupt); - m_group->insert(action(ShowQmlObjectTree), - checkBoxShowQmlObjectTree); - m_group->insert(action(WarnOnReleaseBuilds), - checkBoxWarnOnReleaseBuilds); - m_group->insert(action(StationaryEditorWhileStepping), - checkBoxKeepEditorStationaryWhileStepping); - m_group->insert(action(FontSizeFollowsEditor), - checkBoxFontSizeFollowsEditor); - m_group->insert(action(AutoDerefPointers), 0); - m_group->insert(action(UseToolTipsInLocalsView), 0); - m_group->insert(action(AlwaysAdjustColumnWidths), 0); - m_group->insert(action(UseToolTipsInBreakpointsView), 0); - m_group->insert(action(UseToolTipsInStackView), 0); - m_group->insert(action(UseAddressInBreakpointsView), 0); - m_group->insert(action(UseAddressInStackView), 0); - m_group->insert(action(MaximalStackDepth), spinBoxMaximalStackDepth); - m_group->insert(action(ShowStdNamespace), 0); - m_group->insert(action(ShowQtNamespace), 0); - m_group->insert(action(ShowQObjectNames), 0); - m_group->insert(action(SortStructMembers), 0); - m_group->insert(action(LogTimeStamps), 0); - m_group->insert(action(BreakOnThrow), 0); - m_group->insert(action(BreakOnCatch), 0); - if (Utils::HostOsInfo::isWindowsHost()) { - Utils::SavedAction *registerAction = action(RegisterForPostMortem); - m_group->insert(registerAction, - checkBoxRegisterForPostMortem); - connect(registerAction, &QAction::toggled, - checkBoxRegisterForPostMortem, &QAbstractButton::setChecked); - } else { - checkBoxRegisterForPostMortem->setVisible(false); - } -} - -GlobalDebuggerOptions CommonOptionsPageWidget::globalOptions() const -{ - GlobalDebuggerOptions o; - SourcePathMap allPathMap = sourcesMappingWidget->sourcePathMap(); - for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) { - const QString key = it.key(); - if (key.startsWith(QLatin1Char('('))) - o.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value())); - else - o.sourcePathMap.insert(key, it.value()); - } - return o; -} - -void CommonOptionsPageWidget::setGlobalOptions(const GlobalDebuggerOptions &go) -{ - SourcePathMap allPathMap = go.sourcePathMap; - foreach (auto regExpMap, go.sourcePathRegExpMap) - allPathMap.insert(regExpMap.first.pattern(), regExpMap.second); - - sourcesMappingWidget->setSourcePathMap(allPathMap); -} - /////////////////////////////////////////////////////////////////////// // // CommonOptionsPage @@ -260,41 +63,184 @@ CommonOptionsPage::CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> setDisplayName(QCoreApplication::translate("Debugger", "General")); setCategory(DEBUGGER_SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY)); - setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); -} - -CommonOptionsPage::~CommonOptionsPage() -{ + setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } void CommonOptionsPage::apply() { - QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return); + m_group.apply(ICore::settings()); - m_group->apply(ICore::settings()); + GlobalDebuggerOptions newOptions; + SourcePathMap allPathMap = m_sourceMappingWidget->sourcePathMap(); + for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) { + const QString key = it.key(); + if (key.startsWith(QLatin1Char('('))) + newOptions.sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value())); + else + newOptions.sourcePathMap.insert(key, it.value()); + } - const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions(); - if (newGlobalOptions != *m_options) { - *m_options = newGlobalOptions; + if (newOptions.sourcePathMap != m_options->sourcePathMap + || newOptions.sourcePathRegExpMap != m_options->sourcePathRegExpMap) { + *m_options = newOptions; m_options->toSettings(); } } void CommonOptionsPage::finish() { - if (!m_group.isNull()) - m_group->finish(); + m_group.finish(); delete m_widget; } QWidget *CommonOptionsPage::widget() { - if (m_group.isNull()) - m_group = QSharedPointer<Utils::SavedActionSet>(new Utils::SavedActionSet); - if (!m_widget) { - m_widget = new CommonOptionsPageWidget(m_group); - m_widget->setGlobalOptions(*m_options); + m_widget = new QWidget; + + auto behaviorBox = new QGroupBox(m_widget); + behaviorBox->setTitle(tr("Behavior")); + + auto checkBoxUseAlternatingRowColors = new QCheckBox(behaviorBox); + checkBoxUseAlternatingRowColors->setText(tr("Use alternating row colors in debug views")); + + auto checkBoxFontSizeFollowsEditor = new QCheckBox(behaviorBox); + checkBoxFontSizeFollowsEditor->setToolTip(tr("Changes the font size in the debugger views when the font size in the main editor changes.")); + checkBoxFontSizeFollowsEditor->setText(tr("Debugger font size follows main editor")); + + auto checkBoxUseToolTipsInMainEditor = new QCheckBox(behaviorBox); + checkBoxUseToolTipsInMainEditor->setText(tr("Use tooltips in main editor while debugging")); + + QString t = tr("Stopping and stepping in the debugger " + "will automatically open views associated with the current location.") + QLatin1Char('\n'); + auto checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox); + checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit")); + checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close " + "automatically opened source views when the debugger exits.")); + + auto checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox); + checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit")); + checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close " + "automatically opened memory views when the debugger exits.")); + + auto checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox); + checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit")); + + auto checkBoxBringToForegroundOnInterrrupt = new QCheckBox(behaviorBox); + checkBoxBringToForegroundOnInterrrupt->setText(tr("Bring Qt Creator to foreground when application interrupts")); + + auto checkBoxShowQmlObjectTree = new QCheckBox(behaviorBox); + checkBoxShowQmlObjectTree->setToolTip(tr("Shows QML object tree in Locals and Expressions when connected and not stepping.")); + checkBoxShowQmlObjectTree->setText(tr("Show QML object tree")); + + auto checkBoxBreakpointsFullPath = new QCheckBox(behaviorBox); + checkBoxBreakpointsFullPath->setToolTip(tr("Enables a full file path in breakpoints by default also for GDB.")); + checkBoxBreakpointsFullPath->setText(tr("Set breakpoints using a full absolute path")); + + auto checkBoxRegisterForPostMortem = new QCheckBox(behaviorBox); + checkBoxRegisterForPostMortem->setToolTip(tr("Registers Qt Creator for debugging crashed applications.")); + checkBoxRegisterForPostMortem->setText(tr("Use Qt Creator for post-mortem debugging")); + + auto checkBoxWarnOnReleaseBuilds = new QCheckBox(behaviorBox); + checkBoxWarnOnReleaseBuilds->setText(tr("Warn when debugging \"Release\" builds")); + checkBoxWarnOnReleaseBuilds->setToolTip(tr("Shows a warning when starting the debugger " + "on a binary with insufficient debug information.")); + + auto checkBoxKeepEditorStationaryWhileStepping = new QCheckBox(behaviorBox); + checkBoxKeepEditorStationaryWhileStepping->setText(tr("Keep editor stationary when stepping")); + checkBoxKeepEditorStationaryWhileStepping->setToolTip(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.")); + + auto labelMaximalStackDepth = new QLabel(tr("Maximum stack depth:"), behaviorBox); + + auto spinBoxMaximalStackDepth = new QSpinBox(behaviorBox); + spinBoxMaximalStackDepth->setSpecialValueText(tr("<unlimited>")); + spinBoxMaximalStackDepth->setMaximum(999); + spinBoxMaximalStackDepth->setSingleStep(5); + spinBoxMaximalStackDepth->setValue(10); + + m_sourceMappingWidget = new DebuggerSourcePathMappingWidget(m_widget); + + auto horizontalLayout = new QHBoxLayout; + horizontalLayout->addWidget(labelMaximalStackDepth); + horizontalLayout->addWidget(spinBoxMaximalStackDepth); + horizontalLayout->addStretch(); + + auto gridLayout = new QGridLayout(behaviorBox); + gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1); + gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1); + gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1); + gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1); + gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1); + gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1); + gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1); + gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2); + + gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1); + gridLayout->addWidget(checkBoxSwitchModeOnExit, 1, 1, 1, 1); + gridLayout->addWidget(checkBoxShowQmlObjectTree, 2, 1, 1, 1); + gridLayout->addWidget(checkBoxKeepEditorStationaryWhileStepping, 3, 1, 1, 1); + gridLayout->addWidget(checkBoxRegisterForPostMortem, 4, 1, 1, 1); + + auto verticalLayout = new QVBoxLayout(m_widget); + verticalLayout->addWidget(behaviorBox); + verticalLayout->addWidget(m_sourceMappingWidget); + verticalLayout->addStretch(); + + m_group.clear(); + + m_group.insert(action(UseAlternatingRowColors), + checkBoxUseAlternatingRowColors); + m_group.insert(action(UseToolTipsInMainEditor), + checkBoxUseToolTipsInMainEditor); + m_group.insert(action(CloseSourceBuffersOnExit), + checkBoxCloseSourceBuffersOnExit); + m_group.insert(action(CloseMemoryBuffersOnExit), + checkBoxCloseMemoryBuffersOnExit); + m_group.insert(action(SwitchModeOnExit), + checkBoxSwitchModeOnExit); + m_group.insert(action(BreakpointsFullPathByDefault), + checkBoxBreakpointsFullPath); + m_group.insert(action(RaiseOnInterrupt), + checkBoxBringToForegroundOnInterrrupt); + m_group.insert(action(ShowQmlObjectTree), + checkBoxShowQmlObjectTree); + m_group.insert(action(WarnOnReleaseBuilds), + checkBoxWarnOnReleaseBuilds); + m_group.insert(action(StationaryEditorWhileStepping), + checkBoxKeepEditorStationaryWhileStepping); + m_group.insert(action(FontSizeFollowsEditor), + checkBoxFontSizeFollowsEditor); + m_group.insert(action(AutoDerefPointers), 0); + m_group.insert(action(UseToolTipsInLocalsView), 0); + m_group.insert(action(AlwaysAdjustColumnWidths), 0); + m_group.insert(action(UseToolTipsInBreakpointsView), 0); + m_group.insert(action(UseToolTipsInStackView), 0); + m_group.insert(action(UseAddressInBreakpointsView), 0); + m_group.insert(action(UseAddressInStackView), 0); + m_group.insert(action(MaximalStackDepth), spinBoxMaximalStackDepth); + m_group.insert(action(ShowStdNamespace), 0); + m_group.insert(action(ShowQtNamespace), 0); + m_group.insert(action(ShowQObjectNames), 0); + m_group.insert(action(SortStructMembers), 0); + m_group.insert(action(LogTimeStamps), 0); + m_group.insert(action(BreakOnThrow), 0); + m_group.insert(action(BreakOnCatch), 0); + if (HostOsInfo::isWindowsHost()) { + SavedAction *registerAction = action(RegisterForPostMortem); + m_group.insert(registerAction, checkBoxRegisterForPostMortem); + connect(registerAction, &QAction::toggled, + checkBoxRegisterForPostMortem, &QAbstractButton::setChecked); + } else { + checkBoxRegisterForPostMortem->setVisible(false); + } + + SourcePathMap allPathMap = m_options->sourcePathMap; + foreach (auto regExpMap, m_options->sourcePathRegExpMap) + allPathMap.insert(regExpMap.first.pattern(), regExpMap.second); + m_sourceMappingWidget->setSourcePathMap(allPathMap); } return m_widget; } @@ -331,7 +277,7 @@ LocalsAndExpressionsOptionsPage::LocalsAndExpressionsOptionsPage() setDisplayName(QCoreApplication::translate("Debugger", "Locals && Expressions")); setCategory(DEBUGGER_SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("Debugger", DEBUGGER_SETTINGS_TR_CATEGORY)); - setCategoryIcon(Utils::Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); + setCategoryIcon(Icon(DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON)); } void LocalsAndExpressionsOptionsPage::apply() @@ -428,5 +374,3 @@ QWidget *LocalsAndExpressionsOptionsPage::widget() } // namespace Internal } // namespace Debugger - -#include "commonoptionspage.moc" diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h index 05f4a120fa..ea2383f54c 100644 --- a/src/plugins/debugger/commonoptionspage.h +++ b/src/plugins/debugger/commonoptionspage.h @@ -33,15 +33,11 @@ #include <QPointer> #include <QSharedPointer> -QT_BEGIN_NAMESPACE -class QSpinBox; -QT_END_NAMESPACE - namespace Debugger { namespace Internal { class GlobalDebuggerOptions; -class CommonOptionsPageWidget; +class DebuggerSourcePathMappingWidget; /////////////////////////////////////////////////////////////////////// // @@ -55,21 +51,21 @@ class CommonOptionsPage : public Core::IOptionsPage public: explicit CommonOptionsPage(const QSharedPointer<GlobalDebuggerOptions> &go); - ~CommonOptionsPage(); // IOptionsPage - QWidget *widget(); - void apply(); - void finish(); + QWidget *widget() final; + void apply() final; + void finish() final; static QString msgSetBreakpointAtFunction(const char *function); static QString msgSetBreakpointAtFunctionToolTip(const char *function, const QString &hint = QString()); private: + QPointer<QWidget> m_widget; + Utils::SavedActionSet m_group; const QSharedPointer<GlobalDebuggerOptions> m_options; - QSharedPointer<Utils::SavedActionSet> m_group; - QPointer<CommonOptionsPageWidget> m_widget; + DebuggerSourcePathMappingWidget *m_sourceMappingWidget = nullptr; }; @@ -87,9 +83,9 @@ public: LocalsAndExpressionsOptionsPage(); // IOptionsPage - QWidget *widget(); - void apply(); - void finish(); + QWidget *widget() final; + void apply() final; + void finish() final; private: QPointer<QWidget> m_widget; diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index b80189782d..626be0e04f 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -21,12 +21,6 @@ Project { Depends { name: "QtSupport" } Depends { name: "TextEditor" } - - Depends { - name: "Qt.test" - condition: qtc.testsEnabled - } - pluginTestDepends: [ "QmakeProjectManager" ] diff --git a/src/plugins/debugger/debugger.qrc b/src/plugins/debugger/debugger.qrc index f49e25cd7b..301234efae 100644 --- a/src/plugins/debugger/debugger.qrc +++ b/src/plugins/debugger/debugger.qrc @@ -25,8 +25,6 @@ <file>images/debugger_stepout_small@2x.png</file> <file>images/debugger_stepover_small.png</file> <file>images/debugger_stepover_small@2x.png</file> - <file>images/breakpoint.png</file> - <file>images/breakpoint@2x.png</file> <file>images/breakpoint_disabled.png</file> <file>images/breakpoint_disabled@2x.png</file> <file>images/breakpoint_pending_overlay.png</file> diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index b1f180c53c..4cf54ea50c 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -45,15 +45,6 @@ class GlobalDebuggerOptions public: void toSettings() const; void fromSettings(); - bool operator==(const GlobalDebuggerOptions &rhs) const - { - return sourcePathMap == rhs.sourcePathMap - && sourcePathRegExpMap == rhs.sourcePathRegExpMap; - } - bool operator!=(const GlobalDebuggerOptions &rhs) const - { - return !(*this == rhs); - } SourcePathMap sourcePathMap; SourcePathRegExpMap sourcePathRegExpMap; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index e96885a9cc..f23da12034 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1240,6 +1240,7 @@ void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode, // Nothing to do. break; case EngineShutdownRequested: + case InferiorShutdownRequested: notifyEngineShutdownOk(); break; case InferiorRunOk: @@ -2059,7 +2060,7 @@ void DebuggerEngine::updateItem(const QString &iname) WatchModelBase *model = handler->model(); QTC_CHECK(model); if (item && !model->hasChildren(model->indexForItem(item))) { - handler->notifyUpdateStarted({iname}); + handler->notifyUpdateStarted(UpdateParameters(iname)); item->setValue(decodeData({}, "notaccessible")); item->setHasChildren(false); item->outdated = false; diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index e2dfd41d32..770d079c44 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -122,7 +122,8 @@ public: class UpdateParameters { public: - UpdateParameters() {} + UpdateParameters(const QString &partialVariable = QString()) : + partialVariable(partialVariable) {} QStringList partialVariables() const { diff --git a/src/plugins/debugger/debuggericons.cpp b/src/plugins/debugger/debuggericons.cpp index e16fd5cd0f..3fc7fd50b9 100644 --- a/src/plugins/debugger/debuggericons.cpp +++ b/src/plugins/debugger/debuggericons.cpp @@ -31,11 +31,11 @@ namespace Debugger { namespace Icons { const Icon BREAKPOINT({ - {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}}, Icon::Tint); + {":/utils/images/filledcircle.png", Theme::IconsErrorColor}}, Icon::Tint); const Icon BREAKPOINT_DISABLED({ {":/debugger/images/breakpoint_disabled.png", Theme::IconsErrorColor}}, Icon::Tint); const Icon BREAKPOINT_PENDING({ - {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}, + {":/utils/images/filledcircle.png", Theme::IconsErrorColor}, {":/debugger/images/breakpoint_pending_overlay.png", Theme::PanelTextColorDark}}, Icon::IconStyleOptions(Icon::Tint | Icon::PunchEdges)); const Icon BREAKPOINTS( ":/debugger/images/debugger_breakpoints.png"); diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index da20b9170c..6aaaa4074c 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -294,7 +294,7 @@ QList<Task> DebuggerKitInformation::validateDebugger(const Kit *k) if (errors & DebuggerDoesNotMatch) { const QString message = tr("The ABI of the selected debugger does not " "match the toolchain ABI."); - result << Task(Task::Error, message, FileName(), -1, id); + result << Task(Task::Warning, message, FileName(), -1, id); } return result; } diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 47dc345feb..c31cbff994 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -474,9 +474,13 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration * if (rp.languages & CppLanguage) { const QList<Task> tasks = DebuggerKitInformation::validateDebugger(kit); if (!tasks.isEmpty()) { - foreach (const Task &t, tasks) + foreach (const Task &t, tasks) { + if (t.type == Task::Warning) + continue; errors->append(t.description); - return 0; + } + if (!errors->isEmpty()) + return 0; } } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index cdcdb13c55..53f94c4f6b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4493,7 +4493,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters ¶ms) { m_pendingBreakpointRequests = 0; - watchHandler()->notifyUpdateStarted(params.partialVariables()); + watchHandler()->notifyUpdateStarted(params); DebuggerCommand cmd("fetchVariables", Discardable|InUpdateLocals|PythonCommand); watchHandler()->appendFormatRequests(&cmd); diff --git a/src/plugins/debugger/images/breakpoint.png b/src/plugins/debugger/images/breakpoint.png Binary files differdeleted file mode 100644 index 57dc3054c8..0000000000 --- a/src/plugins/debugger/images/breakpoint.png +++ /dev/null diff --git a/src/plugins/debugger/images/breakpoint@2x.png b/src/plugins/debugger/images/breakpoint@2x.png Binary files differdeleted file mode 100644 index d4062c909c..0000000000 --- a/src/plugins/debugger/images/breakpoint@2x.png +++ /dev/null diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 0b79fdbb0a..eba04d0ca1 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -796,7 +796,7 @@ void LldbEngine::assignValueInDebugger(WatchItem *, void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms) { - watchHandler()->notifyUpdateStarted(params.partialVariables()); + watchHandler()->notifyUpdateStarted(params); DebuggerCommand cmd("fetchVariables"); watchHandler()->appendFormatRequests(&cmd); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index c3aec855a0..83f3fed071 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -1087,6 +1087,12 @@ void QmlEngine::quitDebugger() shutdownInferior(); } +void QmlEngine::doUpdateLocals(const UpdateParameters ¶ms) +{ + Q_UNUSED(params); + d->updateLocals(); +} + void QmlEngine::disconnected() { showMessage(tr("QML Debugger disconnected."), StatusBar); @@ -2150,7 +2156,7 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response) StackHandler *stackHandler = engine->stackHandler(); WatchHandler * watchHandler = engine->watchHandler(); - watchHandler->notifyUpdateStarted({"local"}); + watchHandler->notifyUpdateStarted(); const int frameIndex = stackHandler->currentIndex(); if (frameIndex < 0) diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 2ce3efd73e..1f6b9c9bbe 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -129,6 +129,8 @@ private: bool hasCapability(unsigned) const override; void quitDebugger() override; + void doUpdateLocals(const UpdateParameters ¶ms) override; + void closeConnection(); void startApplicationLauncher(); void stopApplicationLauncher(); diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index 30d72c378c..0f430bb45e 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -84,6 +84,8 @@ QmlInspectorAgent::QmlInspectorAgent(QmlEngine *engine, QmlDebugConnection *conn m_debugIdToIname.insert(WatchItem::InvalidId, "inspect"); connect(action(ShowQmlObjectTree), &Utils::SavedAction::valueChanged, this, &QmlInspectorAgent::updateState); + connect(action(SortStructMembers), &Utils::SavedAction::valueChanged, + this, &QmlInspectorAgent::updateState); m_delayQueryTimer.setSingleShot(true); m_delayQueryTimer.setInterval(100); connect(&m_delayQueryTimer, &QTimer::timeout, diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp index ea914102b0..187a769eaa 100644 --- a/src/plugins/debugger/registerhandler.cpp +++ b/src/plugins/debugger/registerhandler.cpp @@ -748,7 +748,7 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev) }; addFormatAction(tr("Hexadecimal"), HexadecimalFormat); - addFormatAction(tr("DecimalFormat"), DecimalFormat); + addFormatAction(tr("Decimal"), DecimalFormat); addFormatAction(tr("Octal"), OctalFormat); addFormatAction(tr("Binary"), BinaryFormat); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 1b47b7cf95..b0de874251 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1755,8 +1755,9 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) const DisplayFormats alternativeFormats = typeFormatList(item); + const QString iname = item->iname; const int typeFormat = theTypeFormats.value(stripForFormat(item->type), AutomaticFormat); - const int individualFormat = theIndividualFormats.value(item->iname, AutomaticFormat); + const int individualFormat = theIndividualFormats.value(iname, AutomaticFormat); auto addBaseChangeAction = [this, menu](const QString &text, int base) { addCheckableAction(menu, text, true, theUnprintableBase == base, [this, base] { @@ -1775,26 +1776,26 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) const QString spacer = " "; menu->addSeparator(); - addAction(menu, tr("Change Display for Object Named \"%1\":").arg(item->name), false); + addAction(menu, tr("Change Display for Object Named \"%1\":").arg(iname), false); QString msg = (individualFormat == AutomaticFormat && typeFormat != AutomaticFormat) ? tr("Use Format for Type (Currently %1)").arg(nameForFormat(typeFormat)) : QString(tr("Use Display Format Based on Type") + ' '); addCheckableAction(menu, spacer + msg, true, individualFormat == AutomaticFormat, - [this, item] { + [this, iname] { // FIXME: Extend to multi-selection. //const QModelIndexList active = activeRows(); //foreach (const QModelIndex &idx, active) // setModelData(LocalsIndividualFormatRole, AutomaticFormat, idx); - setIndividualFormat(item->iname, AutomaticFormat); + setIndividualFormat(iname, AutomaticFormat); m_engine->updateLocals(); }); for (int format : alternativeFormats) { addCheckableAction(menu, spacer + nameForFormat(format), true, format == individualFormat, - [this, act, format, item] { - setIndividualFormat(item->iname, format); + [this, act, format, iname] { + setIndividualFormat(iname, format); m_engine->updateLocals(); }); } @@ -1803,18 +1804,18 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item) addAction(menu, tr("Change Display for Type \"%1\":").arg(item->type), false); addCheckableAction(menu, spacer + tr("Automatic"), true, typeFormat == AutomaticFormat, - [this, item] { + [this, iname] { //const QModelIndexList active = activeRows(); //foreach (const QModelIndex &idx, active) // setModelData(LocalsTypeFormatRole, AutomaticFormat, idx); - setTypeFormat(item->iname, AutomaticFormat); + setTypeFormat(iname, AutomaticFormat); m_engine->updateLocals(); }); for (int format : alternativeFormats) { addCheckableAction(menu, spacer + nameForFormat(format), true, format == typeFormat, - [this, act, format, item] { - setTypeFormat(item->iname, format); + [this, act, format, iname] { + setTypeFormat(iname, format); m_engine->updateLocals(); }); } @@ -1999,8 +2000,12 @@ void WatchHandler::resetWatchers() loadSessionData(); } -void WatchHandler::notifyUpdateStarted(const QStringList &inames) +void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters) { + QStringList inames = updateParameters.partialVariables(); + if (inames.isEmpty()) + inames.append("local"); + auto marker = [](WatchItem *item) { item->outdated = true; }; if (inames.isEmpty()) { diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index cf62cf2aed..e47fa012fd 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -26,6 +26,7 @@ #pragma once #include "watchdata.h" +#include "debuggerengine.h" #include <QVector> @@ -111,7 +112,7 @@ public: void resetValueCache(); void resetWatchers(); - void notifyUpdateStarted(const QStringList &inames = {}); + void notifyUpdateStarted(const UpdateParameters &updateParameters = UpdateParameters()); void notifyUpdateFinished(); void reexpandItems(); |