diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 56fdb67f5a9..b832ee49562 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -69,7 +69,8 @@ private: QCheckBox *checkBoxFontSizeFollowsEditor; QCheckBox *checkBoxUseToolTipsInMainEditor; QCheckBox *checkBoxListSourceFiles; - QCheckBox *checkBoxCloseBuffersOnExit; + QCheckBox *checkBoxCloseSourceBuffersOnExit; + QCheckBox *checkBoxCloseMemoryBuffersOnExit; QCheckBox *checkBoxSwitchModeOnExit; QCheckBox *checkBoxBringToForegroundOnInterrrupt; QCheckBox *checkBoxShowQmlObjectTree; @@ -105,12 +106,17 @@ CommonOptionsPageWidget::CommonOptionsPageWidget checkBoxListSourceFiles->setToolTip(tr("Populates the source file view automatically. This might slow down debugger startup considerably.")); checkBoxListSourceFiles->setText(tr("Populate source file view automatically")); - checkBoxCloseBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseBuffersOnExit->setText(tr("Close temporary views on debugger exit")); - checkBoxCloseBuffersOnExit->setToolTip(tr("Stopping and stepping in the debugger " - "will automatically open source or disassembler views associated with the " - "current location. Select this option to automatically close them when " - "the debugger exits.")); + 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")); @@ -160,11 +166,12 @@ CommonOptionsPageWidget::CommonOptionsPageWidget QGridLayout *gridLayout = new QGridLayout(behaviorBox); gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1); gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1); - gridLayout->addWidget(checkBoxCloseBuffersOnExit, 2, 0, 1, 1); - gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 3, 0, 1, 1); - gridLayout->addWidget(checkBoxBreakpointsFullPath, 4, 0, 1, 1); - gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 5, 0, 1, 1); - gridLayout->addLayout(horizontalLayout, 6, 0, 1, 2); + 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(checkBoxListSourceFiles, 1, 1, 1, 1); @@ -186,8 +193,10 @@ CommonOptionsPageWidget::CommonOptionsPageWidget checkBoxUseAlternatingRowColors); m_group->insert(action(UseToolTipsInMainEditor), checkBoxUseToolTipsInMainEditor); - m_group->insert(action(CloseBuffersOnExit), - checkBoxCloseBuffersOnExit); + m_group->insert(action(CloseSourceBuffersOnExit), + checkBoxCloseSourceBuffersOnExit); + m_group->insert(action(CloseMemoryBuffersOnExit), + checkBoxCloseMemoryBuffersOnExit); m_group->insert(action(SwitchModeOnExit), checkBoxSwitchModeOnExit); m_group->insert(action(BreakpointsFullPathByDefault), diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index cf11fe9fa57..914049e2afd 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -433,7 +433,13 @@ DebuggerSettings::DebuggerSettings() item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit")); item->setCheckable(true); item->setDefaultValue(false); - insertItem(CloseBuffersOnExit, item); + insertItem(CloseSourceBuffersOnExit, item); + + item = new SavedAction(this); + item->setSettingsKey(debugModeGroup, QLatin1String("CloseMemoryBuffersOnExit")); + item->setCheckable(true); + item->setDefaultValue(true); + insertItem(CloseMemoryBuffersOnExit, item); item = new SavedAction(this); item->setSettingsKey(debugModeGroup, QLatin1String("SwitchModeOnExit")); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index a88f4842c26..47db7158029 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -99,7 +99,8 @@ enum DebuggerActionCode LogTimeStamps, VerboseLog, OperateByInstruction, - CloseBuffersOnExit, + CloseSourceBuffersOnExit, + CloseMemoryBuffersOnExit, SwitchModeOnExit, BreakpointsFullPathByDefault, RaiseOnInterrupt, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 92d263944ae..7cf5b79d70e 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1982,21 +1982,22 @@ void DebuggerPluginPrivate::cleanupViews() m_reverseDirectionAction->setChecked(false); m_reverseDirectionAction->setEnabled(false); - if (!boolSetting(CloseBuffersOnExit)) - return; + const bool closeSource = boolSetting(CloseSourceBuffersOnExit); + const bool closeMemory = boolSetting(CloseMemoryBuffersOnExit); QList toClose; foreach (IDocument *document, DocumentModel::openedDocuments()) { + const bool isMemory = document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool(); if (document->property(Constants::OPENED_BY_DEBUGGER).toBool()) { bool keepIt = true; - if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) - keepIt = false; - else if (document->isModified()) + if (document->isModified()) keepIt = true; else if (document->filePath().contains(_("qeventdispatcher"))) keepIt = false; + else if (isMemory) + keepIt = !closeMemory; else - keepIt = (document == EditorManager::currentDocument()); + keepIt = !closeSource; if (keepIt) document->setProperty(Constants::OPENED_BY_DEBUGGER, false);