diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 41e5c37c789b23e444c3d1321a97ef71e2ec91df..b8e15eaed1641cf27ffaceca086457ac502d6955 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -352,42 +352,6 @@ void CdbEnginePrivate::checkVersion() } } -void CdbEngine::startupChecks() -{ - // Check symbol server unless the user has an external/internal setup - if (!qgetenv("_NT_SYMBOL_PATH").isEmpty() - || CdbOptions::indexOfSymbolServerPath(m_d->m_options->symbolPaths) != -1) - return; - // Prompt to use Symbol server unless the user checked "No nagging". - Core::ICore *core = Core::ICore::instance(); - const QString nagSymbolServerKey = CdbOptions::settingsGroup() + QLatin1String("/NoPromptSymbolServer"); - bool noFurtherNagging = core->settings()->value(nagSymbolServerKey, false).toBool(); - if (noFurtherNagging) - return; - - const QString symServUrl = QLatin1String("http://support.microsoft.com/kb/311503"); - const QString msg = tr("<html><head/><body><p>The debugger is not configured to use the public " - "<a href=\"%1\">Microsoft Symbol Server</a>. This is recommended " - "for retrieval of the symbols of the operating system libraries.</p>" - "<p><i>Note:</i> A fast internet connection is required for this to work smoothly. Also, a delay " - "might occur when connecting for the first time.</p>" - "<p>Would you like to set it up?</p></br>" - "</body></html>").arg(symServUrl); - const QDialogButtonBox::StandardButton answer = - Utils::CheckableMessageBox::question(core->mainWindow(), tr("Symbol Server"), msg, - tr("Do not ask again"), &noFurtherNagging); - core->settings()->setValue(nagSymbolServerKey, noFurtherNagging); - if (answer == QDialogButtonBox::No) - return; - // Prompt for path and add it. Synchronize QSetting and debugger. - const QString cacheDir = CdbSymbolPathListEditor::promptCacheDirectory(core->mainWindow()); - if (cacheDir.isEmpty()) - return; - m_d->m_options->symbolPaths.push_back(CdbOptions::symbolServerPath(cacheDir)); - m_d->m_options->toSettings(core->settings()); - syncDebuggerPaths(); -} - void CdbEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); @@ -395,7 +359,12 @@ void CdbEngine::setupEngine() if (debugCDBExecution) qDebug("setupEngine"); CdbCore::BreakPoint::clearNormalizeFileNameCache(); - startupChecks(); + // Nag to add symbol server + if (CdbSymbolPathListEditor::promptToAddSymbolServer(CdbOptions::settingsGroup(), + &(m_d->m_options->symbolPaths))) { + m_d->m_options->toSettings(Core::ICore::instance()->settings()); + syncDebuggerPaths(); + } m_d->checkVersion(); if (m_d->m_hDebuggeeProcess) { warning(QLatin1String("Internal error: Attempt to start debugger while another process is being debugged.")); diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 32ecbc57ea7e2d45eb1642adc0a96561391d2a48..9fd5208cea61d7dcc88ca778537aef34f4c1093c 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -109,7 +109,6 @@ private slots: void warning(const QString &w); private: - void startupChecks(); inline bool startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage); void processTerminated(unsigned long exitCode); void evaluateWatcher(WatchData *wd); diff --git a/src/plugins/debugger/cdb2/cdbengine2.cpp b/src/plugins/debugger/cdb2/cdbengine2.cpp index 98d54a71be69edbdea7135b78f917e4b31a66d95..8c1911b54bcbed78b79695d73d3a06afb27bc5f1 100644 --- a/src/plugins/debugger/cdb2/cdbengine2.cpp +++ b/src/plugins/debugger/cdb2/cdbengine2.cpp @@ -44,6 +44,9 @@ #include "cdbparsehelpers.h" #include "watchutils.h" #include "gdb/gdbmi.h" +#include "shared/cdbsymbolpathlisteditor.h" + +#include <coreplugin/icore.h> #include <utils/winutils.h> #include <utils/qtcassert.h> @@ -316,6 +319,11 @@ void CdbEngine::setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEd void CdbEngine::setupEngine() { + // Nag to add symbol server + if (Debugger::Internal::CdbSymbolPathListEditor::promptToAddSymbolServer(CdbOptions::settingsGroup(), + &(m_options->symbolPaths))) + m_options->toSettings(Core::ICore::instance()->settings()); + QString errorMessage; if (!doSetupEngine(&errorMessage)) { // Start engine which will run until initial breakpoint showMessage(errorMessage, LogError); diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp index be283bf260b38088c38226cb449dd72e0fd4c7c9..ff98d4ac238f78a7e77033c736edd0e1eaa31be7 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp @@ -29,7 +29,10 @@ #include "cdbsymbolpathlisteditor.h" +#include <coreplugin/icore.h> + #include <utils/pathchooser.h> +#include <utils/checkablemessagebox.h> #include <QtCore/QDir> #include <QtCore/QDebug> @@ -39,6 +42,7 @@ #include <QtGui/QVBoxLayout> #include <QtGui/QFormLayout> #include <QtGui/QMessageBox> +#include <QtGui/QMainWindow> namespace Debugger { namespace Internal { @@ -163,5 +167,41 @@ int CdbSymbolPathListEditor::indexOfSymbolServerPath(const QStringList &paths, Q return -1; } +bool CdbSymbolPathListEditor::promptToAddSymbolServer(const QString &settingsGroup, QStringList *symbolPaths) +{ + // Check symbol server unless the user has an external/internal setup + if (!qgetenv("_NT_SYMBOL_PATH").isEmpty() + || CdbSymbolPathListEditor::indexOfSymbolServerPath(*symbolPaths) != -1) + return false; + // Prompt to use Symbol server unless the user checked "No nagging". + Core::ICore *core = Core::ICore::instance(); + const QString nagSymbolServerKey = settingsGroup + QLatin1String("/NoPromptSymbolServer"); + bool noFurtherNagging = core->settings()->value(nagSymbolServerKey, false).toBool(); + if (noFurtherNagging) + return false; + + const QString symServUrl = QLatin1String("http://support.microsoft.com/kb/311503"); + const QString msg = tr("<html><head/><body><p>The debugger is not configured to use the public " + "<a href=\"%1\">Microsoft Symbol Server</a>. This is recommended " + "for retrieval of the symbols of the operating system libraries.</p>" + "<p><i>Note:</i> A fast internet connection is required for this to work smoothly. Also, a delay " + "might occur when connecting for the first time.</p>" + "<p>Would you like to set it up?</p></br>" + "</body></html>").arg(symServUrl); + const QDialogButtonBox::StandardButton answer = + Utils::CheckableMessageBox::question(core->mainWindow(), tr("Symbol Server"), msg, + tr("Do not ask again"), &noFurtherNagging); + core->settings()->setValue(nagSymbolServerKey, noFurtherNagging); + if (answer == QDialogButtonBox::No) + return false; + // Prompt for path and add it. Synchronize QSetting and debugger. + const QString cacheDir = CdbSymbolPathListEditor::promptCacheDirectory(core->mainWindow()); + if (cacheDir.isEmpty()) + return false; + + symbolPaths->push_back(CdbSymbolPathListEditor::symbolServerPath(cacheDir)); + return true; +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h index f8c5bb04b7a9235b61a2ee2aa174603fe36666bd..52f6b3d3b385d7cdf96464abde04d4b0eafc67bd 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.h @@ -86,6 +86,9 @@ public: // Check for symbol server in list of paths. static int indexOfSymbolServerPath(const QStringList &paths, QString *cacheDir = 0); + // Nag user to add a symbol server to the path list on debugger startup. + static bool promptToAddSymbolServer(const QString &settingsGroup, QStringList *symbolPaths); + private slots: void addSymbolServer(); };