From 5ac407eeccc446b9ba958cea2cc1fb47e4090dd4 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Jul 2014 14:23:52 +0200 Subject: [PATCH] Debugger: Reduce line noise Move some function out of the DebuggerCore "namespace", to avoid one indirection and removes clutter in the calling code. Change-Id: I1c870d5c7eeade32fa63dedf581490fbb090cd6a Reviewed-by: Christian Stenger Reviewed-by: hjk --- src/plugins/debugger/breakhandler.cpp | 9 +-- src/plugins/debugger/breakwindow.cpp | 12 +-- src/plugins/debugger/cdb/cdbengine.cpp | 47 ++++++------ src/plugins/debugger/cdb/cdboptionspage.cpp | 20 +++-- src/plugins/debugger/commonoptionspage.cpp | 72 +++++++++--------- src/plugins/debugger/debuggercore.h | 31 ++++---- src/plugins/debugger/debuggerengine.cpp | 15 ++-- src/plugins/debugger/debuggerplugin.cpp | 47 ++++++------ src/plugins/debugger/debuggerrunner.cpp | 4 +- .../debugger/debuggertooltipmanager.cpp | 19 +++-- src/plugins/debugger/gdb/gdbengine.cpp | 76 +++++++++---------- src/plugins/debugger/gdb/gdboptionspage.cpp | 46 ++++++----- src/plugins/debugger/gdb/gdbplainengine.cpp | 2 +- .../debugger/gdb/remotegdbserveradapter.cpp | 8 +- src/plugins/debugger/lldb/lldbengine.cpp | 28 +++---- src/plugins/debugger/logwindow.cpp | 18 ++--- src/plugins/debugger/moduleswindow.cpp | 9 +-- src/plugins/debugger/pdb/pdbengine.cpp | 4 +- src/plugins/debugger/qml/qmlengine.cpp | 2 +- .../debugger/qml/qmlinspectoradapter.cpp | 7 +- .../debugger/qml/qmlinspectoragent.cpp | 31 +++----- .../debugger/qml/qmlv8debuggerclient.cpp | 2 +- src/plugins/debugger/registerwindow.cpp | 7 +- src/plugins/debugger/snapshotwindow.cpp | 2 +- src/plugins/debugger/sourcefileswindow.cpp | 6 +- src/plugins/debugger/stackhandler.cpp | 9 +-- src/plugins/debugger/stackwindow.cpp | 23 +++--- src/plugins/debugger/threadswindow.cpp | 4 +- src/plugins/debugger/watchhandler.cpp | 32 ++++---- src/plugins/debugger/watchwindow.cpp | 19 ++--- 30 files changed, 286 insertions(+), 325 deletions(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index d0e53fe70c7..ac94225b88a 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -336,15 +336,14 @@ void BreakHandler::saveBreakpoints() map.insert(_("message"), data.message); list.append(map); } - DebuggerCore::setSessionValue("Breakpoints", list); + setSessionValue("Breakpoints", list); //qDebug() << "SAVED BREAKPOINTS" << this << list.size(); } void BreakHandler::loadBreakpoints() { - QTC_ASSERT(debuggerCore(), return); //qDebug() << "LOADING BREAKPOINTS..."; - QVariant value = DebuggerCore::sessionValue("Breakpoints"); + QVariant value = sessionValue("Breakpoints"); QList list = value.toList(); //clear(); foreach (const QVariant &var, list) { @@ -686,7 +685,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const } switch (role) { case Qt::ToolTipRole: - if (debuggerCore()->boolSetting(UseToolTipsInBreakpointsView)) + if (boolSetting(UseToolTipsInBreakpointsView)) return QVariant(it->toToolTip()); break; } @@ -1217,7 +1216,7 @@ void BreakHandler::gotoLocation(BreakpointModelId id) const { ConstIterator it = m_storage.find(id); BREAK_ASSERT(it != m_storage.end(), return); - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); if (it->data.type == BreakpointByAddress) { if (engine) engine->gotoLocation(it->data.address); diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index c6a5bd0c06b..461729779e2 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -655,7 +655,7 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) : m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); QFormLayout *formLayout = new QFormLayout; - if (debuggerCore()->currentEngine()->hasCapability(BreakConditionCapability)) + if (currentEngine()->hasCapability(BreakConditionCapability)) formLayout->addRow(tr("&Condition:"), m_lineEditCondition); formLayout->addRow(tr("&Ignore count:"), m_spinBoxIgnoreCount); formLayout->addRow(tr("&Thread specification:"), m_lineEditThreadSpec); @@ -678,7 +678,7 @@ BreakTreeView::BreakTreeView() { setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png"))); setSelectionMode(QAbstractItemView::ExtendedSelection); - connect(debuggerCore()->action(UseAddressInBreakpointsView), + connect(action(UseAddressInBreakpointsView), SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool))); } @@ -816,11 +816,11 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev) menu.addSeparator(); menu.addAction(synchronizeAction); menu.addSeparator(); - menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView)); - if (debuggerCore()->currentEngine()->hasCapability(MemoryAddressCapability)) - menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView)); + menu.addAction(action(UseToolTipsInBreakpointsView)); + if (currentEngine()->hasCapability(MemoryAddressCapability)) + menu.addAction(action(UseAddressInBreakpointsView)); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index e08afc4b836..f1bcf882748 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -195,7 +195,7 @@ namespace Internal { static inline bool isCreatorConsole(const DebuggerStartParameters &sp) { - return !debuggerCore()->boolSetting(UseCdbConsole) && sp.useTerminal + return !boolSetting(UseCdbConsole) && sp.useTerminal && (sp.startMode == StartInternal || sp.startMode == StartExternal); } @@ -345,11 +345,11 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp) : m_watchPointY(0), m_ignoreCdbOutput(false) { - connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered(bool)), + connect(action(OperateByInstruction), SIGNAL(triggered(bool)), this, SLOT(operateByInstructionTriggered(bool))); - connect(debuggerCore()->action(VerboseLog), SIGNAL(triggered(bool)), + connect(action(VerboseLog), SIGNAL(triggered(bool)), this, SLOT(verboseLogTriggered(bool))); - connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()), + connect(action(CreateFullBacktrace), SIGNAL(triggered()), this, SLOT(createFullBacktrace())); setObjectName(QLatin1String("CdbEngine")); connect(&m_process, SIGNAL(finished(int)), this, SLOT(processFinished())); @@ -366,8 +366,8 @@ void CdbEngine::init() m_specialStopMode = NoSpecialStop; m_nextCommandToken = 0; m_currentBuiltinCommandIndex = -1; - m_operateByInstructionPending = debuggerCore()->action(OperateByInstruction)->isChecked(); - m_verboseLogPending = debuggerCore()->boolSetting(VerboseLog); + m_operateByInstructionPending = action(OperateByInstruction)->isChecked(); + m_verboseLogPending = boolSetting(VerboseLog); m_operateByInstruction = true; // Default CDB setting m_verboseLog = false; // Default CDB setting m_notifyEngineShutdownOnTermination = false; @@ -597,9 +597,9 @@ void CdbEngine::setupEngine() if (debug) qDebug(">setupEngine"); // Nag to add symbol server and cache - QStringList symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths); + QStringList symbolPaths = stringListSetting(CdbSymbolPaths); if (CdbSymbolPathListEditor::promptToAddSymbolPaths(&symbolPaths)) - debuggerCore()->action(CdbSymbolPaths)->setValue(symbolPaths); + action(CdbSymbolPaths)->setValue(symbolPaths); init(); if (!m_logTime.elapsed()) @@ -680,18 +680,18 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa << QLatin1String(".idle_cmd ") + QString::fromLatin1(m_extensionCommandPrefixBA) + QLatin1String("idle"); if (sp.useTerminal) // Separate console arguments << QLatin1String("-2"); - if (debuggerCore()->boolSetting(IgnoreFirstChanceAccessViolation)) + if (boolSetting(IgnoreFirstChanceAccessViolation)) arguments << QLatin1String("-x"); - const QStringList &symbolPaths = debuggerCore()->stringListSetting(CdbSymbolPaths); + const QStringList &symbolPaths = stringListSetting(CdbSymbolPaths); if (!symbolPaths.isEmpty()) arguments << QLatin1String("-y") << symbolPaths.join(QString(QLatin1Char(';'))); - const QStringList &sourcePaths = debuggerCore()->stringListSetting(CdbSourcePaths); + const QStringList &sourcePaths = stringListSetting(CdbSourcePaths); if (!sourcePaths.isEmpty()) arguments << QLatin1String("-srcpath") << sourcePaths.join(QString(QLatin1Char(';'))); // Compile argument string preserving quotes - QString nativeArguments = debuggerCore()->stringSetting(CdbAdditionalArguments); + QString nativeArguments = stringSetting(CdbAdditionalArguments); switch (sp.startMode) { case StartInternal: case StartExternal: @@ -786,9 +786,9 @@ void CdbEngine::setupInferior() postCommand("sxn ibp", 0); // Do not break on initial breakpoints. postCommand(".asm source_line", 0); // Source line in assembly postCommand(m_extensionCommandPrefixBA + "setparameter maxStringLength=" - + debuggerCore()->action(MaximalStringLength)->value().toByteArray() + + action(MaximalStringLength)->value().toByteArray() + " maxStackDepth=" - + debuggerCore()->action(MaximalStackDepth)->value().toByteArray() + + action(MaximalStackDepth)->value().toByteArray() , 0); postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid); } @@ -827,13 +827,12 @@ void CdbEngine::runEngine() if (debug) qDebug("runEngine"); - const QStringList &breakEvents = - debuggerCore()->stringListSetting(CdbBreakEvents); + const QStringList breakEvents = stringListSetting(CdbBreakEvents); foreach (const QString &breakEvent, breakEvents) postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0); // Break functions: each function must be fully qualified, // else the debugger will slow down considerably. - if (debuggerCore()->boolSetting(CdbBreakOnCrtDbgReport)) { + if (boolSetting(CdbBreakOnCrtDbgReport)) { const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor()); const QByteArray debugModule = module + 'D'; const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W'); @@ -846,13 +845,13 @@ void CdbEngine::runEngine() postBuiltinCommand(breakAtFunctionCommand(wideFunc, debugModule), 0, &CdbEngine::handleBreakInsert); } - if (debuggerCore()->boolSetting(BreakOnWarning)) { + if (boolSetting(BreakOnWarning)) { postBuiltinCommand("bm /( QtCored4!qWarning", 0, &CdbEngine::handleBreakInsert); // 'bm': All overloads. postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::warning", 0, &CdbEngine::handleBreakInsert); } - if (debuggerCore()->boolSetting(BreakOnFatal)) { + if (boolSetting(BreakOnFatal)) { postBuiltinCommand("bm /( QtCored4!qFatal", 0, &CdbEngine::handleBreakInsert); // 'bm': All overloads. postBuiltinCommand("bm /( Qt5Cored!QMessageLogger::fatal", 0, @@ -1061,9 +1060,9 @@ void CdbEngine::handleAddWatch(const CdbExtensionCommandPtr &reply) void CdbEngine::addLocalsOptions(ByteArrayInputStream &str) const { - if (debuggerCore()->boolSetting(VerboseLog)) + if (boolSetting(VerboseLog)) str << blankSeparator << "-v"; - if (debuggerCore()->boolSetting(UseDebuggingHelpers)) + if (boolSetting(UseDebuggingHelpers)) str << blankSeparator << "-c"; const QByteArray typeFormats = watchHandler()->typeFormatRequests(); if (!typeFormats.isEmpty()) @@ -1521,7 +1520,7 @@ void CdbEngine::updateLocals(bool forNewStackFrame) addLocalsOptions(str); // Uninitialized variables if desired. Quote as safeguard against shadowed // variables in case of errors in uninitializedVariables(). - if (debuggerCore()->boolSetting(UseCodeModel)) { + if (boolSetting(UseCodeModel)) { QStringList uninitializedVariables; getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(), frame.function, frame.file, frame.line, &uninitializedVariables); @@ -1932,7 +1931,7 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply) { const int flags = reply->cookie.toInt(); if (reply->success) { - if (debuggerCore()->boolSetting(VerboseLog)) + if (boolSetting(VerboseLog)) showMessage(QLatin1String("Locals: ") + QString::fromLatin1(reply->reply), LogDebug); QList watchData; WatchHandler *handler = watchHandler(); @@ -2915,7 +2914,7 @@ void CdbEngine::attemptBreakpointSynchronization() case BreakpointInsertRequested: if (!m_autoBreakPointCorrection && parameters.type == BreakpointByFileAndLine - && debuggerCore()->boolSetting(CdbBreakPointCorrection)) { + && boolSetting(CdbBreakPointCorrection)) { if (lineCorrection.isNull()) lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(), CppTools::CppModelManagerInterface::instance()->workingCopy())); diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index e709191ecce..0da4608011a 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -182,15 +182,14 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) m_ui.breakCrtDbgReportCheckBox ->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptionsPage::crtDbgReport, hint)); - DebuggerCore *dc = debuggerCore(); - group.insert(dc->action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit); - group.insert(dc->action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox); - group.insert(dc->action(UseCdbConsole), m_ui.consoleCheckBox); - group.insert(dc->action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox); - group.insert(dc->action(IgnoreFirstChanceAccessViolation), + group.insert(action(CdbAdditionalArguments), m_ui.additionalArgumentsLineEdit); + group.insert(action(CdbBreakOnCrtDbgReport), m_ui.breakCrtDbgReportCheckBox); + group.insert(action(UseCdbConsole), m_ui.consoleCheckBox); + group.insert(action(CdbBreakPointCorrection), m_ui.breakpointCorrectionCheckBox); + group.insert(action(IgnoreFirstChanceAccessViolation), m_ui.ignoreFirstChanceAccessViolationCheckBox); - m_breakEventWidget->setBreakEvents(dc->stringListSetting(CdbBreakEvents)); + m_breakEventWidget->setBreakEvents(stringListSetting(CdbBreakEvents)); } QStringList CdbOptionsPageWidget::breakEvents() const @@ -226,7 +225,7 @@ void CdbOptionsPage::apply() if (!m_widget) return; m_widget->group.apply(Core::ICore::settings()); - debuggerCore()->action(CdbBreakEvents)->setValue(m_widget->breakEvents()); + action(CdbBreakEvents)->setValue(m_widget->breakEvents()); } void CdbOptionsPage::finish() @@ -274,9 +273,8 @@ CdbPathsPageWidget::CdbPathsPageWidget(QWidget *parent) : layout->addWidget(gbSymbolPath); layout->addWidget(gbSourcePath); - DebuggerCore *dc = debuggerCore(); - group.insert(dc->action(CdbSymbolPaths), m_symbolPathListEditor); - group.insert(dc->action(CdbSourcePaths), m_sourcePathListEditor); + group.insert(action(CdbSymbolPaths), m_symbolPathListEditor); + group.insert(action(CdbSourcePaths), m_sourcePathListEditor); } CdbPathsPage::CdbPathsPage() diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 7c5a18fb733..82a488cf8f0 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -175,48 +175,47 @@ CommonOptionsPageWidget::CommonOptionsPageWidget verticalLayout->addWidget(sourcesMappingWidget); verticalLayout->addStretch(); - DebuggerCore *dc = debuggerCore(); m_group->clear(); - m_group->insert(dc->action(ListSourceFiles), + m_group->insert(action(ListSourceFiles), checkBoxListSourceFiles); - m_group->insert(dc->action(UseAlternatingRowColors), + m_group->insert(action(UseAlternatingRowColors), checkBoxUseAlternatingRowColors); - m_group->insert(dc->action(UseToolTipsInMainEditor), + m_group->insert(action(UseToolTipsInMainEditor), checkBoxUseToolTipsInMainEditor); - m_group->insert(dc->action(CloseBuffersOnExit), + m_group->insert(action(CloseBuffersOnExit), checkBoxCloseBuffersOnExit); - m_group->insert(dc->action(SwitchModeOnExit), + m_group->insert(action(SwitchModeOnExit), checkBoxSwitchModeOnExit); - m_group->insert(dc->action(BreakpointsFullPathByDefault), + m_group->insert(action(BreakpointsFullPathByDefault), checkBoxBreakpointsFullPath); - m_group->insert(dc->action(RaiseOnInterrupt), + m_group->insert(action(RaiseOnInterrupt), checkBoxBringToForegroundOnInterrrupt); - m_group->insert(dc->action(ShowQmlObjectTree), + m_group->insert(action(ShowQmlObjectTree), checkBoxShowQmlObjectTree); - m_group->insert(dc->action(WarnOnReleaseBuilds), + m_group->insert(action(WarnOnReleaseBuilds), checkBoxWarnOnReleaseBuilds); - m_group->insert(dc->action(StationaryEditorWhileStepping), + m_group->insert(action(StationaryEditorWhileStepping), checkBoxKeepEditorStationaryWhileStepping); - m_group->insert(dc->action(FontSizeFollowsEditor), + m_group->insert(action(FontSizeFollowsEditor), checkBoxFontSizeFollowsEditor); - m_group->insert(dc->action(AutoDerefPointers), 0); - m_group->insert(dc->action(UseToolTipsInLocalsView), 0); - m_group->insert(dc->action(AlwaysAdjustColumnWidths), 0); - m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0); - m_group->insert(dc->action(UseToolTipsInStackView), 0); - m_group->insert(dc->action(UseAddressInBreakpointsView), 0); - m_group->insert(dc->action(UseAddressInStackView), 0); - m_group->insert(dc->action(MaximalStackDepth), spinBoxMaximalStackDepth); - m_group->insert(dc->action(ShowStdNamespace), 0); - m_group->insert(dc->action(ShowQtNamespace), 0); - m_group->insert(dc->action(SortStructMembers), 0); - m_group->insert(dc->action(LogTimeStamps), 0); - m_group->insert(dc->action(VerboseLog), 0); - m_group->insert(dc->action(BreakOnThrow), 0); - m_group->insert(dc->action(BreakOnCatch), 0); + 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(SortStructMembers), 0); + m_group->insert(action(LogTimeStamps), 0); + m_group->insert(action(VerboseLog), 0); + m_group->insert(action(BreakOnThrow), 0); + m_group->insert(action(BreakOnCatch), 0); if (Utils::HostOsInfo::isWindowsHost()) { - Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem); + Utils::SavedAction *registerAction = action(RegisterForPostMortem); m_group->insert(registerAction, checkBoxRegisterForPostMortem); connect(registerAction, SIGNAL(toggled(bool)), @@ -340,7 +339,6 @@ QWidget *LocalsAndExpressionsOptionsPage::widget() { if (!m_widget) { m_widget = new QWidget; - DebuggerCore *dc = debuggerCore(); auto debuggingHelperGroupBox = new QGroupBox(m_widget); debuggingHelperGroupBox->setTitle(tr("Use Debugging Helper")); @@ -357,7 +355,7 @@ QWidget *LocalsAndExpressionsOptionsPage::widget() auto checkBoxUseCodeModel = new QCheckBox(debuggingHelperGroupBox); checkBoxUseCodeModel->setText(tr("Use code model")); - checkBoxUseCodeModel->setToolTip(dc->action(UseCodeModel)->toolTip()); + checkBoxUseCodeModel->setToolTip(action(UseCodeModel)->toolTip()); checkBoxUseCodeModel->setToolTip(tr("Makes use of Qt Creator's code model " "to find out if a variable has already been assigned a " "value at the point the debugger interrupts.")); @@ -409,13 +407,13 @@ QWidget *LocalsAndExpressionsOptionsPage::widget() layout->addStretch(); m_group.clear(); - m_group.insert(dc->action(UseDebuggingHelpers), debuggingHelperGroupBox); - m_group.insert(dc->action(UseCodeModel), checkBoxUseCodeModel); - m_group.insert(dc->action(ShowThreadNames), checkBoxShowThreadNames); - m_group.insert(dc->action(ShowStdNamespace), checkBoxShowStdNamespace); - m_group.insert(dc->action(ShowQtNamespace), checkBoxShowQtNamespace); - m_group.insert(dc->action(DisplayStringLimit), spinBoxDisplayStringLimit); - m_group.insert(dc->action(MaximalStringLength), spinBoxMaximalStringLength); + m_group.insert(action(UseDebuggingHelpers), debuggingHelperGroupBox); + m_group.insert(action(UseCodeModel), checkBoxUseCodeModel); + m_group.insert(action(ShowThreadNames), checkBoxShowThreadNames); + m_group.insert(action(ShowStdNamespace), checkBoxShowStdNamespace); + m_group.insert(action(ShowQtNamespace), checkBoxShowQtNamespace); + m_group.insert(action(DisplayStringLimit), spinBoxDisplayStringLimit); + m_group.insert(action(MaximalStringLength), spinBoxMaximalStringLength); #ifndef QT_DEBUG #if 0 diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index 81c2408ddf2..f25c42ed21f 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -57,7 +57,6 @@ class DebuggerEngine; namespace Internal { class BreakHandler; -class SnapshotHandler; class Symbol; class Section; class GlobalDebuggerOptions; @@ -75,20 +74,12 @@ class DebuggerCore : public QObject public: DebuggerCore() {} - static QVariant sessionValue(const QByteArray &name); - static void setSessionValue(const QByteArray &name, const QVariant &value); - static QVariant configValue(const QByteArray &name); - static void setConfigValue(const QByteArray &name, const QVariant &value); - virtual void updateState(DebuggerEngine *engine) = 0; virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0; virtual QIcon locationMarkIcon() const = 0; virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0; virtual bool hasSnapshots() const = 0; virtual void openTextEditor(const QString &titlePattern, const QString &contents) = 0; - virtual BreakHandler *breakHandler() const = 0; - virtual SnapshotHandler *snapshotHandler() const = 0; - virtual DebuggerEngine *currentEngine() const = 0; virtual bool isActiveDebugLanguage(int language) const = 0; // void runTest(const QString &fileName); @@ -104,8 +95,6 @@ public: virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0; virtual QWidget *mainWindow() const = 0; virtual bool isDockVisible(const QString &objectName) const = 0; -// virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi, -// DebuggerEngineType et = NoEngineType) const = 0; virtual void showModuleSymbols(const QString &moduleName, const QVector &symbols) = 0; virtual void showModuleSections(const QString &moduleName, @@ -113,10 +102,6 @@ public: virtual void openMemoryEditor() = 0; virtual void languagesChanged() = 0; - virtual Utils::SavedAction *action(int code) const = 0; - virtual bool boolSetting(int code) const = 0; - virtual QString stringSetting(int code) const = 0; - virtual QStringList stringListSetting(int code) const = 0; virtual void setThreads(const QStringList &list, int index) = 0; virtual QSharedPointer globalDebuggerOptions() const = 0; @@ -127,9 +112,23 @@ public slots: virtual void attachExternalApplication(ProjectExplorer::RunControl *rc) = 0; }; +// Some convenience. +QVariant sessionValue(const QByteArray &name); +void setSessionValue(const QByteArray &name, const QVariant &value); +QVariant configValue(const QByteArray &name); +void setConfigValue(const QByteArray &name, const QVariant &value); + +Utils::SavedAction *action(int code); +bool boolSetting(int code); +QString stringSetting(int code); +QStringList stringListSetting(int code); + +BreakHandler *breakHandler(); +DebuggerEngine *currentEngine(); + // This is the only way to access the global object. DebuggerCore *debuggerCore(); -inline BreakHandler *breakHandler() { return debuggerCore()->breakHandler(); } + QMessageBox *showMessageBox(int icon, const QString &title, const QString &text, int buttons = 0); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 98808c173b6..de3d8130a84 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -174,7 +174,7 @@ public: m_isStateDebugging(false) { connect(&m_locationTimer, SIGNAL(timeout()), SLOT(resetLocation())); - connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)), + connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)), SLOT(reloadDisassembly())); VariableManager::registerFileVariables(PrefixDebugExecutable, @@ -521,8 +521,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) if (!d->m_startParameters.environment.size()) d->m_startParameters.environment = Utils::Environment(); - debuggerCore()->action(OperateByInstruction) - ->setEnabled(hasCapability(DisassemblerCapability)); + action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability)); QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished, qDebug() << state()); @@ -543,7 +542,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) d->resetLocation(); if ((hasCapability(OperateByInstructionCapability) && - debuggerCore()->boolSetting(OperateByInstruction)) || !loc.hasDebugInfo()) { + boolSetting(OperateByInstruction)) || !loc.hasDebugInfo()) { d->m_disassemblerAgent.setLocation(loc); return; } @@ -559,7 +558,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) EditorManager::IgnoreNavigationHistory, &newEditor); QTC_ASSERT(editor, return); // Unreadable file? - editor->gotoLine(line, 0, !debuggerCore()->boolSetting(StationaryEditorWhileStepping)); + editor->gotoLine(line, 0, !boolSetting(StationaryEditorWhileStepping)); if (newEditor) editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true); @@ -953,7 +952,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop() QTC_ASSERT(state() == InferiorRunOk, qDebug() << this << state()); showStatusMessage(tr("Stopped.")); setState(InferiorStopOk); - if (debuggerCore()->boolSetting(RaiseOnInterrupt)) + if (boolSetting(RaiseOnInterrupt)) ICore::raiseWindow(debuggerCore()->mainWindow()); } @@ -1620,7 +1619,7 @@ void DebuggerEngine::executeDebuggerCommand(const QString &, DebuggerLanguages) BreakHandler *DebuggerEngine::breakHandler() const { - return debuggerCore()->breakHandler(); + return Internal::breakHandler(); } bool DebuggerEngine::isDying() const @@ -1752,7 +1751,7 @@ void DebuggerEngine::setStateDebugging(bool on) void DebuggerEngine::checkForReleaseBuild(const DebuggerStartParameters &sp) { - if (!debuggerCore()->boolSetting(WarnOnReleaseBuilds) || !(sp.languages & CppLanguage)) + if (!boolSetting(WarnOnReleaseBuilds) || !(sp.languages & CppLanguage)) return; QString binary = sp.executable; if (binary.isEmpty()) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 5b556e6462d..99f46413a4d 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -533,7 +533,7 @@ public: static QWidget *addSearch(BaseTreeView *treeView, const QString &title, const char *objectName) { - QAction *act = debuggerCore()->action(UseAlternatingRowColors); + QAction *act = action(UseAlternatingRowColors); treeView->setAlternatingRowColors(act->isChecked()); QObject::connect(act, SIGNAL(toggled(bool)), treeView, SLOT(setAlternatingRowColorsHelper(bool))); @@ -715,7 +715,6 @@ public: void connectEngine(DebuggerEngine *engine); void disconnectEngine() { connectEngine(0); } - DebuggerEngine *currentEngine() const { return m_currentEngine; } DebuggerEngine *dummyEngine(); void setThreads(const QStringList &list, int index) @@ -897,9 +896,6 @@ public slots: bool isReverseDebugging() const; - BreakHandler *breakHandler() const { return m_breakHandler; } - SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; } - void displayDebugger(DebuggerEngine *engine, bool updateEngine = true); void dumpLog(); @@ -1158,11 +1154,6 @@ public slots: void openTextEditor(const QString &titlePattern0, const QString &contents); void showMessage(const QString &msg, int channel, int timeout = -1); - SavedAction *action(int code) const; - bool boolSetting(int code) const; - QString stringSetting(int code) const; - QStringList stringListSetting(int code) const; - void showModuleSymbols(const QString &moduleName, const Symbols &symbols); void showModuleSections(const QString &moduleName, const Sections §ions); @@ -1497,12 +1488,12 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, return true; } -void DebuggerCore::setConfigValue(const QByteArray &name, const QVariant &value) +void setConfigValue(const QByteArray &name, const QVariant &value) { ICore::settings()->setValue(_("DebugMode/" + name), value); } -QVariant DebuggerCore::configValue(const QByteArray &name) +QVariant configValue(const QByteArray &name) { return ICore::settings()->value(_("DebugMode/" + name)); } @@ -2029,7 +2020,7 @@ void DebuggerPluginPrivate::toggleBreakpointByFileAndLine(const QString &fileNam handler->removeBreakpoint(id); } else { BreakpointParameters data(BreakpointByFileAndLine); - if (debuggerCore()->boolSetting(BreakpointsFullPathByDefault)) + if (boolSetting(BreakpointsFullPathByDefault)) data.pathUsage = BreakpointUseFullPath; data.tracepoint = !tracePointMessage.isEmpty(); data.message = tracePointMessage; @@ -2536,12 +2527,12 @@ const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const return m_codeModelSnapshot; } -void DebuggerCore::setSessionValue(const QByteArray &key, const QVariant &value) +void setSessionValue(const QByteArray &key, const QVariant &value) { SessionManager::setValue(QString::fromUtf8(key), value); } -QVariant DebuggerCore::sessionValue(const QByteArray &key) +QVariant sessionValue(const QByteArray &key) { return SessionManager::value(QString::fromUtf8(key)); } @@ -3366,25 +3357,35 @@ void DebuggerPluginPrivate::extensionsInitialized() // time gdb -i mi -ex 'b debuggerplugin.cpp:800' -ex r -ex q bin/qtcreator.bin } -SavedAction *DebuggerPluginPrivate::action(int code) const +DebuggerEngine *currentEngine() { - return m_debuggerSettings->item(code); + return theDebuggerCore->m_currentEngine; } -bool DebuggerPluginPrivate::boolSetting(int code) const +SavedAction *action(int code) { - return m_debuggerSettings->item(code)->value().toBool(); + return theDebuggerCore->m_debuggerSettings->item(code); } -QString DebuggerPluginPrivate::stringSetting(int code) const +bool boolSetting(int code) { - QString raw = m_debuggerSettings->item(code)->value().toString(); + return theDebuggerCore->m_debuggerSettings->item(code)->value().toBool(); +} + +QString stringSetting(int code) +{ + QString raw = theDebuggerCore->m_debuggerSettings->item(code)->value().toString(); return VariableManager::expandedString(raw); } -QStringList DebuggerPluginPrivate::stringListSetting(int code) const +QStringList stringListSetting(int code) { - return m_debuggerSettings->item(code)->value().toStringList(); + return theDebuggerCore->m_debuggerSettings->item(code)->value().toStringList(); +} + +BreakHandler *breakHandler() +{ + return theDebuggerCore->m_breakHandler; } void DebuggerPluginPrivate::showModuleSymbols(const QString &moduleName, diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index fcee2fedc2f..d9428a426c3 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -172,7 +172,7 @@ void DebuggerRunControl::start() if (d->m_engine->startParameters().startMode == StartInternal) { QStringList unhandledIds; - foreach (const BreakpointModelId &id, debuggerCore()->breakHandler()->allBreakpointIds()) { + foreach (const BreakpointModelId &id, breakHandler()->allBreakpointIds()) { if (d->m_engine->breakHandler()->breakpointData(id).enabled && !d->m_engine->acceptsBreakpoint(id)) unhandledIds.append(id.toString()); @@ -431,7 +431,7 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME); DebuggerStartParameters sp = sp0; - if (!debuggerCore()->boolSetting(AutoEnrichParameters)) { + if (!boolSetting(AutoEnrichParameters)) { const QString sysroot = sp.sysRoot; if (sp.debugInfoLocation.isEmpty()) sp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug"); diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 1253a197b79..8a767b6e1a9 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -1185,7 +1185,7 @@ void DebuggerToolTipManager::sessionAboutToChange() void DebuggerToolTipManager::loadSessionData() { - const QString data = DebuggerCore::sessionValue(sessionSettingsKeyC).toString(); + const QString data = sessionValue(sessionSettingsKeyC).toString(); QXmlStreamReader r(data); r.readNextStartElement(); if (r.tokenType() == QXmlStreamReader::StartElement && r.name() == QLatin1String(sessionDocumentC)) @@ -1207,7 +1207,7 @@ void DebuggerToolTipManager::saveSessionData() tw->saveSessionData(w); w.writeEndDocument(); - DebuggerCore::setSessionValue(sessionSettingsKeyC, QVariant(data)); + setSessionValue(sessionSettingsKeyC, QVariant(data)); } void DebuggerToolTipManager::closeAllToolTips() @@ -1349,16 +1349,15 @@ void DebuggerToolTipManager::slotTooltipOverrideRequested bool DebuggerToolTipManager::tryHandleToolTipOverride(BaseTextEditor *editor, const QPoint &point, int pos) { - DebuggerCore *core = debuggerCore(); - if (!core->boolSetting(UseToolTipsInMainEditor)) + if (!boolSetting(UseToolTipsInMainEditor)) return false; - DebuggerEngine *currentEngine = core->currentEngine(); - if (!currentEngine || !currentEngine->canDisplayTooltip()) + DebuggerEngine *engine = currentEngine(); + if (!engine || !engine->canDisplayTooltip()) return false; DebuggerToolTipContext context; - context.engineType = currentEngine->objectName(); + context.engineType = engine->objectName(); context.fileName = editor->document()->filePath(); context.position = pos; context.mousePosition = point; @@ -1370,18 +1369,18 @@ bool DebuggerToolTipManager::tryHandleToolTipOverride(BaseTextEditor *editor, co return false; // Prefer a filter on an existing local variable if it can be found. - if (const WatchData *localVariable = currentEngine->watchHandler()->findCppLocalVariable(context.expression)) { + if (const WatchData *localVariable = engine->watchHandler()->findCppLocalVariable(context.expression)) { context.expression = QLatin1String(localVariable->exp); if (context.expression.isEmpty()) context.expression = localVariable->name; context.iname = localVariable->iname; - showToolTip(context, currentEngine); + showToolTip(context, engine); return true; } context.iname = "tooltip." + context.expression.toLatin1().toHex(); - if (currentEngine->setToolTipExpression(editor, context)) + if (engine->setToolTipExpression(editor, context)) return true; // Other tooltip, close all in case mouse never entered the tooltip diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 6096b09d53d..c24875231af 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -230,13 +230,13 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters) m_commandTimer.setSingleShot(true); connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout())); - connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), + connect(action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), SLOT(reloadLocals())); - connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()), + connect(action(CreateFullBacktrace), SIGNAL(triggered()), SLOT(createFullBacktrace())); - connect(debuggerCore()->action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + connect(action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), SLOT(reloadLocals())); - connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)), + connect(action(UseDynamicType), SIGNAL(valueChanged(QVariant)), SLOT(reloadLocals())); } @@ -668,7 +668,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) break; } - if (debuggerCore()->boolSetting(IdentifyDebugInfoPackages)) { + if (boolSetting(IdentifyDebugInfoPackages)) { // From SuSE's gdb: >&"Missing separate debuginfo for ...\n" // ">&"Try: zypper install -C \"debuginfo(build-id)=c084ee5876ed1ac12730181c9f07c3e027d8e943\"\n" if (data.startsWith("Missing separate debuginfo for ")) { @@ -994,7 +994,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0) int GdbEngine::commandTimeoutTime() const { - int time = debuggerCore()->action(GdbWatchdogTimeout)->value().toInt(); + int time = action(GdbWatchdogTimeout)->value().toInt(); return 1000 * qMax(40, time); } @@ -1132,7 +1132,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response) } GdbCommand cmd = m_cookieForToken.take(token); - if (debuggerCore()->boolSetting(LogTimeStamps)) { + if (boolSetting(LogTimeStamps)) { showMessage(_("Response time: %1: %2 s") .arg(_(cmd.command)) .arg(cmd.postTime.msecsTo(QTime::currentTime()) / 1000.), @@ -1412,7 +1412,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data) //qDebug() << "BP " << rid << data.toString(); // Quickly set the location marker. - if (lineNumber && !debuggerCore()->boolSetting(OperateByInstruction) + if (lineNumber && !boolSetting(OperateByInstruction) && QFileInfo(fullName).exists() && !isQmlStepBreakpoint(rid) && !isQFatalBreakpoint(rid)) @@ -1500,7 +1500,7 @@ void GdbEngine::handleStop1(const GdbMi &data) // Jump over well-known frames. static int stepCounter = 0; - if (debuggerCore()->boolSetting(SkipKnownFrames)) { + if (boolSetting(SkipKnownFrames)) { if (reason == "end-stepping-range" || reason == "function-finished") { //showMessage(frame.toString()); QString funcName = _(frame["func"].data()); @@ -1537,7 +1537,7 @@ void GdbEngine::handleStop1(const GdbMi &data) if (!m_systemDumpersLoaded) { m_systemDumpersLoaded = true; - if (m_gdbVersion >= 70400 && debuggerCore()->boolSetting(LoadGdbDumpers)) + if (m_gdbVersion >= 70400 && boolSetting(LoadGdbDumpers)) postCommand("importPlainDumpers"); } @@ -1653,8 +1653,7 @@ void GdbEngine::handleStop2(const GdbMi &data) showMessage(_(name + " CONSIDERED HARMLESS. CONTINUING.")); } else { showMessage(_("HANDLING SIGNAL " + name)); - if (debuggerCore()->boolSetting(UseMessageBoxForSignals) - && !isStopperThread) + if (boolSetting(UseMessageBoxForSignals) && !isStopperThread) showStoppedBySignalMessageBox(_(meaning), _(name)); if (!name.isEmpty() && !meaning.isEmpty()) reasontr = msgStoppedBySignal(_(meaning), _(name)); @@ -1737,7 +1736,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response) if (response.resultClass == GdbResultDone) { bool needSetup = false; - const QString path = debuggerCore()->stringSetting(ExtraDumperFile); + const QString path = stringSetting(ExtraDumperFile); if (!path.isEmpty()) { QFileInfo fi(path); postCommand("python sys.path.insert(1, '" + fi.absolutePath().toUtf8() + "')"); @@ -1745,7 +1744,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response) needSetup = true; } - const QString commands = debuggerCore()->stringSetting(ExtraDumperCommands); + const QString commands = stringSetting(ExtraDumperCommands); if (!commands.isEmpty()) { postCommand(commands.toLocal8Bit()); needSetup = true; @@ -1856,7 +1855,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName) startParameters().localMountDir); } - if (!debuggerCore()->boolSetting(AutoEnrichParameters)) + if (!boolSetting(AutoEnrichParameters)) return cleanFilePath; const QString sysroot = startParameters().sysRoot; @@ -2318,7 +2317,7 @@ void GdbEngine::setTokenBarrier() QTC_ASSERT(good, return); PENDING_DEBUG("\n--- token barrier ---\n"); showMessage(_("--- token barrier ---"), LogMiscInput); - if (debuggerCore()->boolSetting(LogTimeStamps)) + if (boolSetting(LogTimeStamps)) showMessage(LogWindow::logTimeStamp(), LogMiscInput); m_oldestAcceptableToken = currentToken(); m_stackNeeded = false; @@ -3318,7 +3317,7 @@ void GdbEngine::reloadStack(bool forceGotoLocation) { PENDING_DEBUG("RELOAD STACK"); QByteArray cmd = "-stack-list-frames"; - int stackDepth = debuggerCore()->action(MaximalStackDepth)->value().toInt(); + int stackDepth = action(MaximalStackDepth)->value().toInt(); if (stackDepth) cmd += " 0 " + QByteArray::number(stackDepth); postCommand(cmd, Discardable, CB(handleStackListFrames), @@ -3379,8 +3378,8 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response) } bool canExpand = !cookie.isFull - && (n >= debuggerCore()->action(MaximalStackDepth)->value().toInt()); - debuggerCore()->action(ExpandStack)->setEnabled(canExpand); + && (n >= action(MaximalStackDepth)->value().toInt()); + action(ExpandStack)->setEnabled(canExpand); stackHandler()->setFrames(stackFrames, canExpand); // We can't jump to any file if we don't have any frames. @@ -3392,7 +3391,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response) // a few exceptions: // Always jump to frame #0 when stepping by instruction. - if (debuggerCore()->boolSetting(OperateByInstruction)) + if (boolSetting(OperateByInstruction)) targetFrame = 0; // If there is no frame with source, jump to frame #0. @@ -3453,9 +3452,9 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response) selectThread(other); } updateViews(); // Adjust Threads combobox. - if (debuggerCore()->boolSetting(ShowThreadNames)) { + if (boolSetting(ShowThreadNames)) { postCommand("threadnames " + - debuggerCore()->action(MaximalStackDepth)->value().toByteArray(), + action(MaximalStackDepth)->value().toByteArray(), Discardable, CB(handleThreadNames)); } reloadStack(false); // Will trigger register reload. @@ -3636,7 +3635,7 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response) // qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext.iname << m_toolTipContext; // if (m_toolTipContext.iname.startsWith("tooltip") -// && (!debuggerCore()->boolSetting(UseToolTipsInMainEditor) +// && (!boolSetting(UseToolTipsInMainEditor) // || !watchHandler()->isValidToolTip(m_toolTipContext.iname))) { // watchHandler()->removeData(m_toolTipContext.iname); // return; @@ -3728,7 +3727,7 @@ void GdbEngine::rebuildWatchModel() static int count = 0; ++count; PENDING_DEBUG("REBUILDING MODEL" << count); - if (debuggerCore()->boolSetting(LogTimeStamps)) + if (boolSetting(LogTimeStamps)) showMessage(LogWindow::logTimeStamp(), LogMiscInput); showMessage(_("").arg(count), LogMiscInput); showStatusMessage(tr("Finished retrieving data"), 400); @@ -3939,7 +3938,7 @@ public: void GdbEngine::fetchDisassembler(DisassemblerAgent *agent) { - if (debuggerCore()->boolSetting(IntelFlavor)) + if (boolSetting(IntelFlavor)) postCommand("set disassembly-flavor intel"); else postCommand("set disassembly-flavor att"); @@ -4144,7 +4143,7 @@ void GdbEngine::startGdb(const QStringList &args) QStringList gdbArgs; gdbArgs << _("-i"); gdbArgs << _("mi"); - if (!debuggerCore()->boolSetting(LoadGdbInit)) + if (!boolSetting(LoadGdbInit)) gdbArgs << _("-n"); gdbArgs += args; @@ -4286,7 +4285,7 @@ void GdbEngine::startGdb(const QStringList &args) postCommand("set auto-solib-add on", ConsoleCommand); } - if (debuggerCore()->boolSetting(MultiInferior)) { + if (boolSetting(MultiInferior)) { //postCommand("set follow-exec-mode new"); postCommand("set detach-on-fork off"); } @@ -4328,7 +4327,7 @@ void GdbEngine::loadInitScript() ).arg(script)); } } else { - const QString commands = debuggerCore()->stringSetting(GdbStartupCommands); + const QString commands = stringSetting(GdbStartupCommands); if (!commands.isEmpty()) postCommand(commands.toLocal8Bit()); } @@ -4494,13 +4493,13 @@ void GdbEngine::finishInferiorSetup() if (startParameters().startMode == AttachCore) { notifyInferiorSetupOk(); // No breakpoints in core files. } else { - if (debuggerCore()->boolSetting(BreakOnAbort)) + if (boolSetting(BreakOnAbort)) postCommand("-break-insert -f abort"); - if (debuggerCore()->boolSetting(BreakOnWarning)) { + if (boolSetting(BreakOnWarning)) { postCommand("-break-insert -f '" + qtNamespace() + "qWarning'"); postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::warning'"); } - if (debuggerCore()->boolSetting(BreakOnFatal)) { + if (boolSetting(BreakOnFatal)) { postCommand("-break-insert -f '" + qtNamespace() + "qFatal'", CB(handleBreakOnQFatal), QVariant(false)); postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::fatal'", @@ -4666,10 +4665,9 @@ bool GdbEngine::isHiddenBreakpoint(const BreakpointResponseId &id) const bool GdbEngine::usesExecInterrupt() const { - // debuggerCore()->boolSetting(TargetAsync) DebuggerStartMode mode = startParameters().startMode; return (mode == AttachToRemoteServer || mode == AttachToRemoteProcess) - && debuggerCore()->boolSetting(TargetAsync); + && boolSetting(TargetAsync); } void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response) @@ -4691,7 +4689,7 @@ void GdbEngine::requestDebugInformation(const DebugInfoTask &task) bool GdbEngine::attemptQuickStart() const { // Don't try if the user does not ask for it. - if (!debuggerCore()->boolSetting(AttemptQuickStart)) + if (!boolSetting(AttemptQuickStart)) return false; // Don't try if there are breakpoints we might be able to handle. @@ -4827,9 +4825,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) expanded += "formats:" + handler->individualFormatRequests(); QByteArray cutOff = " stringcutoff:" - + debuggerCore()->action(MaximalStringLength)->value().toByteArray() + + action(MaximalStringLength)->value().toByteArray() + " displaystringlimit:" - + debuggerCore()->action(DisplayStringLimit)->value().toByteArray(); + + action(DisplayStringLimit)->value().toByteArray(); QByteArray watchers; @@ -4882,11 +4880,11 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) QByteArray options; if (alwaysVerbose) options += "pe,"; - if (debuggerCore()->boolSetting(UseDebuggingHelpers)) + if (boolSetting(UseDebuggingHelpers)) options += "fancy,"; - if (debuggerCore()->boolSetting(AutoDerefPointers)) + if (boolSetting(AutoDerefPointers)) options += "autoderef,"; - if (debuggerCore()->boolSetting(UseDynamicType)) + if (boolSetting(UseDynamicType)) options += "dyntype,"; if (options.isEmpty()) options += "defaults,"; diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 34965c77b06..7a913b64229 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -268,23 +268,22 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1); gridLayout->addWidget(groupBoxCustomDumperCommands, 4, 1, 2, 1); - DebuggerCore *dc = debuggerCore(); - group.insert(dc->action(GdbStartupCommands), textEditStartupCommands); - group.insert(dc->action(ExtraDumperFile), pathChooserExtraDumperFile); - group.insert(dc->action(ExtraDumperCommands), textEditCustomDumperCommands); - group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands); - group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit); - group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers); - group.insert(dc->action(UseDynamicType), checkBoxUseDynamicType); - group.insert(dc->action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations); - group.insert(dc->action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout); - group.insert(dc->action(IntelFlavor), checkBoxIntelFlavor); - group.insert(dc->action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages); - group.insert(dc->action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals); - group.insert(dc->action(SkipKnownFrames), checkBoxSkipKnownFrames); + group.insert(action(GdbStartupCommands), textEditStartupCommands); + group.insert(action(ExtraDumperFile), pathChooserExtraDumperFile); + group.insert(action(ExtraDumperCommands), textEditCustomDumperCommands); + group.insert(action(GdbPostAttachCommands), textEditPostAttachCommands); + group.insert(action(LoadGdbInit), checkBoxLoadGdbInit); + group.insert(action(LoadGdbDumpers), checkBoxLoadGdbDumpers); + group.insert(action(UseDynamicType), checkBoxUseDynamicType); + group.insert(action(AdjustBreakpointLocations), checkBoxAdjustBreakpointLocations); + group.insert(action(GdbWatchdogTimeout), spinBoxGdbWatchdogTimeout); + group.insert(action(IntelFlavor), checkBoxIntelFlavor); + group.insert(action(IdentifyDebugInfoPackages), checkBoxIdentifyDebugInfoPackages); + group.insert(action(UseMessageBoxForSignals), checkBoxUseMessageBoxForSignals); + group.insert(action(SkipKnownFrames), checkBoxSkipKnownFrames); //lineEditSelectedPluginBreakpointsPattern-> - // setEnabled(dc->action(SelectedPluginBreakpoints)->value().toBool()); + // setEnabled(action(SelectedPluginBreakpoints)->value().toBool()); //connect(radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)), // lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool))); } @@ -425,15 +424,14 @@ GdbOptionsPageWidget2::GdbOptionsPageWidget2(QWidget *parent) QGridLayout *gridLayout = new QGridLayout(this); gridLayout->addWidget(groupBoxDangerous, 0, 0, 2, 1); - DebuggerCore *dc = debuggerCore(); - group.insert(dc->action(AutoEnrichParameters), checkBoxAutoEnrichParameters); - group.insert(dc->action(TargetAsync), checkBoxTargetAsync); - group.insert(dc->action(BreakOnWarning), checkBoxBreakOnWarning); - group.insert(dc->action(BreakOnFatal), checkBoxBreakOnFatal); - group.insert(dc->action(BreakOnAbort), checkBoxBreakOnAbort); - group.insert(dc->action(AttemptQuickStart), checkBoxAttemptQuickStart); - group.insert(dc->action(MultiInferior), checkBoxMultiInferior); - group.insert(dc->action(EnableReverseDebugging), checkBoxEnableReverseDebugging); + group.insert(action(AutoEnrichParameters), checkBoxAutoEnrichParameters); + group.insert(action(TargetAsync), checkBoxTargetAsync); + group.insert(action(BreakOnWarning), checkBoxBreakOnWarning); + group.insert(action(BreakOnFatal), checkBoxBreakOnFatal); + group.insert(action(BreakOnAbort), checkBoxBreakOnAbort); + group.insert(action(AttemptQuickStart), checkBoxAttemptQuickStart); + group.insert(action(MultiInferior), checkBoxMultiInferior); + group.insert(action(EnableReverseDebugging), checkBoxEnableReverseDebugging); } GdbOptionsPage2::GdbOptionsPage2() diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp index 366395db645..3a6ba6ba660 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.cpp +++ b/src/plugins/debugger/gdb/gdbplainengine.cpp @@ -101,7 +101,7 @@ void GdbPlainEngine::handleExecRun(const GdbResponse &response) showMessage(_("INFERIOR STARTED")); showMessage(msgInferiorSetupOk(), StatusBar); // FIXME: That's the wrong place for it. - if (debuggerCore()->boolSetting(EnableReverseDebugging)) + if (boolSetting(EnableReverseDebugging)) postCommand("target record"); } else { QString msg = fromLocalEncoding(response.data["msg"].data()); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index ca6e95771d7..71aeaea7326 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -202,7 +202,7 @@ void GdbRemoteServerEngine::setupInferior() // gdb/mi/mi-main.c:1958: internal-error: // mi_execute_async_cli_command: Assertion `is_running (inferior_ptid)' // failed.\nA problem internal to GDB has been detected,[...] - if (debuggerCore()->boolSetting(TargetAsync)) + if (boolSetting(TargetAsync)) postCommand("set target-async on", CB(handleSetTargetAsync)); if (executableFileName.isEmpty()) { @@ -277,7 +277,7 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &response) // gdb server will stop the remote application itself. showMessage(_("INFERIOR STARTED")); showMessage(msgAttachedToStoppedInferior(), StatusBar); - QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands); + QString postAttachCommands = stringSetting(GdbPostAttachCommands); if (!postAttachCommands.isEmpty()) { foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n'))) postCommand(cmd.toLatin1()); @@ -297,7 +297,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon if (response.resultClass == GdbResultDone) { showMessage(_("ATTACHED TO GDB SERVER STARTED")); showMessage(msgAttachedToStoppedInferior(), StatusBar); - QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands); + QString postAttachCommands = stringSetting(GdbPostAttachCommands); if (!postAttachCommands.isEmpty()) { foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n'))) postCommand(cmd.toLatin1()); @@ -432,7 +432,7 @@ void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response) void GdbRemoteServerEngine::interruptInferior2() { QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state()); - if (debuggerCore()->boolSetting(TargetAsync)) { + if (boolSetting(TargetAsync)) { postCommand("-exec-interrupt", GdbEngine::Immediate, CB(handleInterruptInferior)); } else if (m_isQnxGdb && Utils::HostOsInfo::isWindowsHost()) { diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index dfd9d40acdd..ac4c09ef461 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -105,15 +105,15 @@ LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters) #endif } - connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), + connect(action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), SLOT(updateLocals())); - connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()), + connect(action(CreateFullBacktrace), SIGNAL(triggered()), SLOT(createFullBacktrace())); - connect(debuggerCore()->action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + connect(action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), SLOT(updateLocals())); - connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)), + connect(action(UseDynamicType), SIGNAL(valueChanged(QVariant)), SLOT(updateLocals())); - connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)), + connect(action(IntelFlavor), SIGNAL(valueChanged(QVariant)), SLOT(updateAll())); } @@ -275,7 +275,7 @@ void LldbEngine::setupInferior() { const DebuggerStartParameters &sp = startParameters(); - const QString path = debuggerCore()->stringSetting(ExtraDumperFile); + const QString path = stringSetting(ExtraDumperFile); if (!path.isEmpty()) { QFileInfo fi(path); @@ -288,7 +288,7 @@ void LldbEngine::setupInferior() runCommand(cmd2); } - const QString commands = debuggerCore()->stringSetting(ExtraDumperCommands); + const QString commands = stringSetting(ExtraDumperCommands); if (!commands.isEmpty()) { Command cmd("executeDebuggerCommand"); cmd.arg(commands.toUtf8()); @@ -873,7 +873,7 @@ void LldbEngine::reloadFullStack() void LldbEngine::updateStack() { Command cmd("reportStack"); - cmd.arg("stacklimit", debuggerCore()->action(MaximalStackDepth)->value().toInt()); + cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt()); runCommand(cmd); } @@ -917,9 +917,9 @@ void LldbEngine::doUpdateLocals(UpdateParameters params) const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); cmd.arg("passexceptions", alwaysVerbose); - cmd.arg("fancy", debuggerCore()->boolSetting(UseDebuggingHelpers)); - cmd.arg("autoderef", debuggerCore()->boolSetting(AutoDerefPointers)); - cmd.arg("dyntype", debuggerCore()->boolSetting(UseDynamicType)); + cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); + cmd.arg("autoderef", boolSetting(AutoDerefPointers)); + cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("partial", params.tryPartial); cmd.arg("tooltiponly", params.tooltipOnly); @@ -1102,7 +1102,7 @@ void LldbEngine::refreshStack(const GdbMi &stack) frames.append(frame); } bool canExpand = stack["hasmore"].toInt(); - debuggerCore()->action(ExpandStack)->setEnabled(canExpand); + action(ExpandStack)->setEnabled(canExpand); handler->setFrames(frames, canExpand); } @@ -1219,7 +1219,7 @@ void LldbEngine::refreshState(const GdbMi &reportedState) void LldbEngine::refreshLocation(const GdbMi &reportedLocation) { - if (debuggerCore()->boolSetting(OperateByInstruction)) { + if (boolSetting(OperateByInstruction)) { Location loc(reportedLocation["addr"].toAddress()); loc.setNeedsMarker(true); gotoLocation(loc); @@ -1249,7 +1249,7 @@ void LldbEngine::fetchDisassembler(DisassemblerAgent *agent) cmd.arg("cookie", id); cmd.arg("address", loc.address()); cmd.arg("function", loc.functionName()); - cmd.arg("flavor", debuggerCore()->boolSetting(IntelFlavor) ? "intel" : "att"); + cmd.arg("flavor", boolSetting(IntelFlavor) ? "intel" : "att"); runCommand(cmd); } diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 74a3f3f525c..0311ab4c88a 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -172,11 +172,11 @@ public: QMenu *menu = createStandardContextMenu(); menu->addAction(m_clearContentsAction); menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts - menu->addAction(debuggerCore()->action(LogTimeStamps)); - menu->addAction(debuggerCore()->action(VerboseLog)); + menu->addAction(action(LogTimeStamps)); + menu->addAction(action(VerboseLog)); menu->addAction(m_reloadDebuggingHelpersAction); menu->addSeparator(); - menu->addAction(debuggerCore()->action(SettingsDialog)); + menu->addAction(action(SettingsDialog)); menu->exec(ev->globalPos()); delete menu; } @@ -225,7 +225,7 @@ void DebuggerPane::saveContents() void DebuggerPane::reloadDebuggingHelpers() { - debuggerCore()->currentEngine()->reloadDebuggingHelpers(); + currentEngine()->reloadDebuggingHelpers(); } ///////////////////////////////////////////////////////////////////// @@ -433,18 +433,18 @@ LogWindow::LogWindow(QWidget *parent) void LogWindow::executeLine() { m_ignoreNextInputEcho = true; - debuggerCore()->currentEngine()-> + currentEngine()-> executeDebuggerCommand(m_inputText->textCursor().block().text(), CppLanguage); } void LogWindow::repeatLastCommand() { - debuggerCore()->currentEngine()->debugLastCommand(); + currentEngine()->debugLastCommand(); } void LogWindow::sendCommand() { - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); if (engine->acceptsDebuggerCommands()) engine->executeDebuggerCommand(m_commandEdit->text(), CppLanguage); else @@ -462,7 +462,7 @@ void LogWindow::showOutput(int channel, const QString &output) QString out; out.reserve(output.size() + 1000); - if (output.at(0) != QLatin1Char('~') && debuggerCore()->boolSetting(LogTimeStamps)) { + if (output.at(0) != QLatin1Char('~') && boolSetting(LogTimeStamps)) { out.append(charForChannel(LogTime)); out.append(logTimeStamp()); out.append(nchar); @@ -521,7 +521,7 @@ void LogWindow::showInput(int channel, const QString &input) m_inputText->setTextCursor(cursor); return; } - if (debuggerCore()->boolSetting(LogTimeStamps)) + if (boolSetting(LogTimeStamps)) m_inputText->append(logTimeStamp()); m_inputText->append(input); QTextCursor cursor = m_inputText->textCursor(); diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp index 546f639ba6e..b87a40d6254 100644 --- a/src/plugins/debugger/moduleswindow.cpp +++ b/src/plugins/debugger/moduleswindow.cpp @@ -38,9 +38,8 @@ #include #include -#include - #include +#include #include @@ -63,7 +62,7 @@ ModulesTreeView::ModulesTreeView() void ModulesTreeView::moduleActivated(const QModelIndex &index) { - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); QTC_ASSERT(engine, return); if (index.isValid()) engine->gotoLocation(index.sibling(index.row(), 1).data().toString()); @@ -81,7 +80,7 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev) fileName = index.sibling(index.row(), 1).data().toString(); } - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); QTC_ASSERT(engine, return); const bool enabled = engine->debuggerActionsEnabled(); const bool canReload = engine->hasCapability(ReloadModuleCapability); @@ -150,7 +149,7 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(actShowModuleSymbols); menu.addAction(actShowModuleSections); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 7cd72dd46c0..60ef9dcb09b 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -730,9 +730,9 @@ void PdbEngine::updateLocals() } QByteArray options; - if (debuggerCore()->boolSetting(UseDebuggingHelpers)) + if (boolSetting(UseDebuggingHelpers)) options += "fancy,"; - if (debuggerCore()->boolSetting(AutoDerefPointers)) + if (boolSetting(AutoDerefPointers)) options += "autoderef,"; if (options.isEmpty()) options += "defaults,"; diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 8356d48c362..73b10d98afe 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -1058,7 +1058,7 @@ QmlJS::ConsoleItem *constructLogItemTree(QmlJS::ConsoleItem *parent, const QString &key = QString()) { using namespace QmlJS; - bool sorted = debuggerCore()->boolSetting(SortStructMembers); + bool sorted = boolSetting(SortStructMembers); if (!result.isValid()) return 0; diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index 914b7b388f2..e5ae7b8214b 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -76,8 +76,8 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter, , m_inspectorToolsContext("Debugger.QmlInspector") , m_selectAction(new QAction(this)) , m_zoomAction(new QAction(this)) - , m_showAppOnTopAction(debuggerCore()->action(ShowAppOnTop)) - , m_updateOnSaveAction(debuggerCore()->action(QmlUpdateOnSave)) + , m_showAppOnTopAction(action(ShowAppOnTop)) + , m_updateOnSaveAction(action(QmlUpdateOnSave)) , m_engineClientConnected(false) { if (!m_engine->isMasterEngine()) @@ -325,8 +325,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor) QmlLiveTextPreview *preview = new QmlLiveTextPreview(doc, initdoc, this, this); - preview->setApplyChangesToQmlInspector( - debuggerCore()->action(QmlUpdateOnSave)->isChecked()); + preview->setApplyChangesToQmlInspector(action(QmlUpdateOnSave)->isChecked()); connect(preview, SIGNAL(reloadRequest()), this, SLOT(onReload())); diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp index af890178044..a3310fb583d 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.cpp +++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp @@ -62,7 +62,7 @@ QmlInspectorAgent::QmlInspectorAgent(DebuggerEngine *engine, QObject *parent) , m_objectToSelect(-1) { m_debugIdToIname.insert(-1, QByteArray("inspect")); - connect(debuggerCore()->action(ShowQmlObjectTree), + connect(action(ShowQmlObjectTree), SIGNAL(valueChanged(QVariant)), SLOT(updateState())); m_delayQueryTimer.setSingleShot(true); m_delayQueryTimer.setInterval(100); @@ -177,8 +177,7 @@ quint32 QmlInspectorAgent::setBindingForObject(int objectDebugId, if (propertyName == QLatin1String("id")) return 0; // Crashes the QMLViewer. - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return 0; log(LogSend, QString::fromLatin1("SET_BINDING %1 %2 %3 %4").arg( @@ -206,8 +205,7 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId, if (objectDebugId == -1) return 0; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return 0; log(LogSend, QString::fromLatin1("SET_METHOD_BODY %1 %2 %3").arg( @@ -232,8 +230,7 @@ quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId, if (objectDebugId == -1) return 0; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return 0; log(LogSend, QString::fromLatin1("RESET_BINDING %1 %2").arg( @@ -331,8 +328,7 @@ bool QmlInspectorAgent::addObjectWatch(int objectDebugId) if (objectDebugId == -1) return false; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return false; // already set @@ -412,8 +408,7 @@ void QmlInspectorAgent::setEngineClient(BaseEngineDebugClient *client) QString QmlInspectorAgent::displayName(int objectDebugId) const { - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return QString(); if (m_debugIdToIname.contains(objectDebugId)) { @@ -429,7 +424,7 @@ void QmlInspectorAgent::updateState() { if (m_engineClient && (m_engineClient->state() == QmlDebugClient::Enabled) - && debuggerCore()->boolSetting(ShowQmlObjectTree)) { + && boolSetting(ShowQmlObjectTree)) { reloadEngines(); } else { clearObjectTree(); @@ -550,8 +545,7 @@ void QmlInspectorAgent::queryEngineContext() { qCDebug(qmlInspectorLog) << __FUNCTION__; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return; log(LogSend, QLatin1String("LIST_OBJECTS")); @@ -564,8 +558,7 @@ void QmlInspectorAgent::fetchObject(int debugId) { qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')'; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return; log(LogSend, QLatin1String("FETCH_OBJECT ") + QString::number(debugId)); @@ -583,8 +576,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file, qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber << ':' << columnNumber << ')'; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return; log(LogSend, QString::fromLatin1("FETCH_OBJECTS_FOR_LOCATION %1:%2:%3").arg(file) @@ -601,8 +593,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context) { qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')'; - if (!isConnected() - || !debuggerCore()->boolSetting(ShowQmlObjectTree)) + if (!isConnected() || !boolSetting(ShowQmlObjectTree)) return; foreach (const ObjectReference & obj, context.objects()) diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 13167932171..650911b395c 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -1591,7 +1591,7 @@ QmlJS::ConsoleItem *constructLogItemTree(QmlJS::ConsoleItem *parent, const QVariant &refsVal) { using namespace QmlJS; - bool sorted = debuggerCore()->boolSetting(SortStructMembers); + bool sorted = boolSetting(SortStructMembers); if (!objectData.value.isValid()) return 0; diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp index c641469a238..9c437af96d1 100644 --- a/src/plugins/debugger/registerwindow.cpp +++ b/src/plugins/debugger/registerwindow.cpp @@ -50,11 +50,6 @@ namespace Debugger { namespace Internal { -static DebuggerEngine *currentEngine() -{ - return debuggerCore()->currentEngine(); -} - static RegisterHandler *currentHandler() { DebuggerEngine *engine = currentEngine(); @@ -226,7 +221,7 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev) act2->setChecked(base == 2); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); const QPoint position = ev->globalPos(); QAction *act = menu.exec(position); diff --git a/src/plugins/debugger/snapshotwindow.cpp b/src/plugins/debugger/snapshotwindow.cpp index 86de243705f..4469055cd36 100644 --- a/src/plugins/debugger/snapshotwindow.cpp +++ b/src/plugins/debugger/snapshotwindow.cpp @@ -93,7 +93,7 @@ void SnapshotTreeView::contextMenuEvent(QContextMenuEvent *ev) actRemove->setEnabled(idx.isValid()); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp index b8849f1666a..e91bd96d818 100644 --- a/src/plugins/debugger/sourcefileswindow.cpp +++ b/src/plugins/debugger/sourcefileswindow.cpp @@ -58,14 +58,14 @@ SourceFilesTreeView::SourceFilesTreeView() void SourceFilesTreeView::rowActivated(const QModelIndex &index) { - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); QTC_ASSERT(engine, return); engine->gotoLocation(index.data().toString()); } void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev) { - DebuggerEngine *engine = debuggerCore()->currentEngine(); + DebuggerEngine *engine = currentEngine(); QTC_ASSERT(engine, return); QModelIndex index = indexAt(ev->pos()); index = index.sibling(index.row(), 0); @@ -89,7 +89,7 @@ void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(act1); menu.addAction(act2); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index e13c7577a03..073e4c8c1f2 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -63,7 +63,7 @@ StackHandler::StackHandler() m_contentsValid = false; m_currentIndex = -1; m_canExpand = false; - connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered()), + connect(action(OperateByInstruction), SIGNAL(triggered()), this, SLOT(resetModel())); } @@ -123,7 +123,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const ? m_positionIcon : m_emptyIcon; } - if (role == Qt::ToolTipRole && debuggerCore()->boolSetting(UseToolTipsInStackView)) + if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInStackView)) return frame.toToolTip(); return QVariant(); @@ -151,8 +151,7 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const if (index.row() == m_stackFrames.size()) return QAbstractTableModel::flags(index); const StackFrame &frame = m_stackFrames.at(index.row()); - const bool isValid = frame.isUsable() - || debuggerCore()->boolSetting(OperateByInstruction); + const bool isValid = frame.isUsable() || boolSetting(OperateByInstruction); return isValid && m_contentsValid ? QAbstractTableModel::flags(index) : Qt::ItemFlags(); } @@ -222,7 +221,7 @@ void StackHandler::prependFrames(const StackFrames &frames) int StackHandler::firstUsableIndex() const { - if (!debuggerCore()->boolSetting(OperateByInstruction)) { + if (!boolSetting(OperateByInstruction)) { for (int i = 0, n = m_stackFrames.size(); i != n; ++i) if (m_stackFrames.at(i).isUsable()) return i; diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index 99ef7af26e7..1fac02b4ea8 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -55,20 +55,15 @@ namespace Debugger { namespace Internal { -static DebuggerEngine *currentEngine() -{ - return debuggerCore()->currentEngine(); -} - StackTreeView::StackTreeView() { setWindowTitle(tr("Stack")); - connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)), + connect(action(UseAddressInStackView), SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool))); - connect(debuggerCore()->action(ExpandStack), SIGNAL(triggered()), + connect(action(ExpandStack), SIGNAL(triggered()), SLOT(reloadFullStack())); - connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()), + connect(action(MaximalStackDepth), SIGNAL(triggered()), SLOT(reloadFullStack())); showAddressColumn(false); } @@ -88,7 +83,7 @@ void StackTreeView::setModel(QAbstractItemModel *model) BaseTreeView::setModel(model); resizeColumnToContents(0); resizeColumnToContents(3); - showAddressColumn(debuggerCore()->action(UseAddressInStackView)->isChecked()); + showAddressColumn(action(UseAddressInStackView)->isChecked()); } // Input a function to be disassembled. Accept CDB syntax @@ -155,7 +150,7 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev) const quint64 address = frame.address; QMenu menu; - menu.addAction(debuggerCore()->action(ExpandStack)); + menu.addAction(action(ExpandStack)); QAction *actCopyContents = menu.addAction(tr("Copy Contents to Clipboard")); actCopyContents->setEnabled(model() != 0); @@ -164,7 +159,7 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev) actSaveTaskFile->setEnabled(model() != 0); if (engine->hasCapability(CreateFullBacktraceCapability)) - menu.addAction(debuggerCore()->action(CreateFullBacktrace)); + menu.addAction(action(CreateFullBacktrace)); QAction *additionalQmlStackAction = 0; if (engine->hasCapability(AdditionalQmlStackCapability)) @@ -204,12 +199,12 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev) actLoadSymbols = menu.addAction(tr("Try to Load Unknown Symbols")); if (engine->hasCapability(MemoryAddressCapability)) - menu.addAction(debuggerCore()->action(UseAddressInStackView)); + menu.addAction(action(UseAddressInStackView)); menu.addSeparator(); - menu.addAction(debuggerCore()->action(UseToolTipsInStackView)); + menu.addAction(action(UseToolTipsInStackView)); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); if (!act) diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp index ba867b8477d..cf9d861f5f8 100644 --- a/src/plugins/debugger/threadswindow.cpp +++ b/src/plugins/debugger/threadswindow.cpp @@ -50,13 +50,13 @@ ThreadsTreeView::ThreadsTreeView() void ThreadsTreeView::rowActivated(const QModelIndex &index) { ThreadId id = ThreadId(index.data(ThreadData::IdRole).toLongLong()); - debuggerCore()->currentEngine()->selectThread(id); + currentEngine()->selectThread(id); } void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); menu.exec(ev->globalPos()); } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index ef16e42bd8f..f2478d036f4 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -155,14 +155,14 @@ public: setWindowFlags(windowFlags() | Qt::Window); setWindowTitle(WatchHandler::tr("Debugger - Qt Creator")); - QVariant geometry = DebuggerCore::sessionValue("DebuggerSeparateWidgetGeometry"); + QVariant geometry = sessionValue("DebuggerSeparateWidgetGeometry"); if (geometry.isValid()) setGeometry(geometry.toRect()); } ~SeparatedView() { - DebuggerCore::setSessionValue("DebuggerSeparateWidgetGeometry", geometry()); + setSessionValue("DebuggerSeparateWidgetGeometry", geometry()); } void removeObject(const QByteArray &key) @@ -348,11 +348,11 @@ WatchModel::WatchModel(WatchHandler *handler) m_returnRoot = createItem("return", tr("Return Value"), m_root); m_tooltipRoot = createItem("tooltip", tr("Tooltip"), m_root); - connect(debuggerCore()->action(SortStructMembers), SIGNAL(valueChanged(QVariant)), + connect(action(SortStructMembers), SIGNAL(valueChanged(QVariant)), SLOT(reinsertAllData())); - connect(debuggerCore()->action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)), + connect(action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)), SLOT(reinsertAllData())); - connect(debuggerCore()->action(ShowQtNamespace), SIGNAL(valueChanged(QVariant)), + connect(action(ShowQtNamespace), SIGNAL(valueChanged(QVariant)), SLOT(reinsertAllData())); } @@ -560,9 +560,9 @@ static QString niceTypeHelper(const QByteArray &typeIn) QString WatchModel::removeNamespaces(QString str) const { - if (!debuggerCore()->boolSetting(ShowStdNamespace)) + if (!boolSetting(ShowStdNamespace)) str.remove(QLatin1String("std::")); - if (!debuggerCore()->boolSetting(ShowQtNamespace)) { + if (!boolSetting(ShowQtNamespace)) { const QString qtNamespace = QString::fromLatin1(engine()->qtNamespace()); if (!qtNamespace.isEmpty()) str.remove(qtNamespace); @@ -1151,7 +1151,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const } case Qt::ToolTipRole: - return debuggerCore()->boolSetting(UseToolTipsInLocalsView) + return boolSetting(UseToolTipsInLocalsView) ? data.toToolTip() : QVariant(); case Qt::ForegroundRole: { @@ -1491,7 +1491,7 @@ bool watchItemSorter(const WatchItem *item1, const WatchItem *item2) static int findInsertPosition(const QList &list, const WatchItem *item) { - sortWatchDataAlphabetically = debuggerCore()->boolSetting(SortStructMembers); + sortWatchDataAlphabetically = boolSetting(SortStructMembers); const QList::const_iterator it = qLowerBound(list.begin(), list.end(), item, watchItemSorter); return it - list.begin(); @@ -1639,7 +1639,7 @@ void WatchModel::setCurrentItem(const QByteArray &iname) WatchHandler::WatchHandler(DebuggerEngine *engine) { m_engine = engine; - m_watcherCounter = DebuggerCore::sessionValue("Watchers").toStringList().count(); + m_watcherCounter = sessionValue("Watchers").toStringList().count(); m_model = new WatchModel(this); m_contentsValid = false; m_contentsValid = true; // FIXME @@ -1918,12 +1918,12 @@ QStringList WatchHandler::watchedExpressions() void WatchHandler::saveWatchers() { - DebuggerCore::setSessionValue("Watchers", watchedExpressions()); + setSessionValue("Watchers", watchedExpressions()); } void WatchHandler::loadFormats() { - QVariant value = DebuggerCore::sessionValue("DefaultFormats"); + QVariant value = sessionValue("DefaultFormats"); QMapIterator it(value.toMap()); while (it.hasNext()) { it.next(); @@ -1931,7 +1931,7 @@ void WatchHandler::loadFormats() theTypeFormats.insert(it.key().toUtf8(), it.value().toInt()); } - value = DebuggerCore::sessionValue("IndividualFormats"); + value = sessionValue("IndividualFormats"); it = QMapIterator(value.toMap()); while (it.hasNext()) { it.next(); @@ -1953,7 +1953,7 @@ void WatchHandler::saveFormats() formats.insert(QString::fromLatin1(key), format); } } - DebuggerCore::setSessionValue("DefaultFormats", formats); + setSessionValue("DefaultFormats", formats); formats.clear(); it = QHashIterator(theIndividualFormats); @@ -1964,7 +1964,7 @@ void WatchHandler::saveFormats() if (!key.isEmpty()) formats.insert(QString::fromLatin1(key), format); } - DebuggerCore::setSessionValue("IndividualFormats", formats); + setSessionValue("IndividualFormats", formats); } void WatchHandler::saveSessionData() @@ -1978,7 +1978,7 @@ void WatchHandler::loadSessionData() loadFormats(); theWatcherNames.clear(); m_watcherCounter = 0; - QVariant value = DebuggerCore::sessionValue("Watchers"); + QVariant value = sessionValue("Watchers"); m_model->destroyChildren(m_model->m_watchRoot); foreach (const QString &exp, value.toStringList()) watchExpression(exp); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 9d1097d3bd7..b926297a7cb 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -86,11 +86,6 @@ namespace Internal { const char CurrentIndex[] = "CurrentIndex"; -static DebuggerEngine *currentEngine() -{ - return debuggerCore()->currentEngine(); -} - class WatchDelegate : public QItemDelegate { public: @@ -912,15 +907,15 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(&actShowInEditor); menu.addSeparator(); - menu.addAction(debuggerCore()->action(UseDebuggingHelpers)); - menu.addAction(debuggerCore()->action(UseToolTipsInLocalsView)); - menu.addAction(debuggerCore()->action(AutoDerefPointers)); - menu.addAction(debuggerCore()->action(SortStructMembers)); - menu.addAction(debuggerCore()->action(UseDynamicType)); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(UseDebuggingHelpers)); + menu.addAction(action(UseToolTipsInLocalsView)); + menu.addAction(action(AutoDerefPointers)); + menu.addAction(action(SortStructMembers)); + menu.addAction(action(UseDynamicType)); + menu.addAction(action(SettingsDialog)); menu.addSeparator(); - menu.addAction(debuggerCore()->action(SettingsDialog)); + menu.addAction(action(SettingsDialog)); QAction *act = menu.exec(ev->globalPos());