From 4381b9d244bc6b8a035753ebafd276d66edec4f5 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 6 May 2009 10:13:36 +0200 Subject: [PATCH] debugger: introduce a "NoEngine" option --- src/plugins/debugger/cdb/cdbdebugengine.cpp | 8 --- src/plugins/debugger/cdb/cdbdebugengine.h | 3 - src/plugins/debugger/debuggermanager.cpp | 73 ++++++++++----------- src/plugins/debugger/debuggermanager.h | 2 +- src/plugins/debugger/gdbengine.h | 3 - src/plugins/debugger/idebuggerengine.h | 3 - src/plugins/debugger/scriptengine.h | 3 - 7 files changed, 34 insertions(+), 61 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index a7d60ad7fe7..72a60595ca1 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -1186,14 +1186,6 @@ bool CdbDebugEnginePrivate::attemptBreakpointSynchronization(QString *errorMessa errorMessage); } -void CdbDebugEngine::loadSessionData() -{ -} - -void CdbDebugEngine::saveSessionData() -{ -} - void CdbDebugEngine::reloadDisassembler() { enum { ContextLines = 40 }; diff --git a/src/plugins/debugger/cdb/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h index 35fce47f66f..04185c05bb4 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.h +++ b/src/plugins/debugger/cdb/cdbdebugengine.h @@ -85,9 +85,6 @@ public: virtual void attemptBreakpointSynchronization(); - virtual void loadSessionData(); - virtual void saveSessionData(); - virtual void reloadDisassembler(); virtual void reloadModules(); diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index ee7c653f06e..b9879aaacac 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -427,7 +427,7 @@ QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(const QStringList const bool cdbDisabled = arguments.contains(_("-disable-cdb")); winEngine = createWinEngine(this, cdbDisabled, &rc); scriptEngine = createScriptEngine(this, &rc); - setDebuggerType(GdbDebugger); + setDebuggerType(NoDebugger); if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine << rc.size(); return rc; @@ -445,6 +445,8 @@ void DebuggerManager::setDebuggerType(DebuggerType type) case WinDebugger: m_engine = winEngine; break; + case NoDebugger: + m_engine = 0; } } @@ -697,7 +699,6 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << fileName << lineNumber; - QTC_ASSERT(m_engine, return); QTC_ASSERT(m_breakHandler, return); if (status() != DebuggerInferiorRunning && status() != DebuggerInferiorStopped @@ -712,7 +713,8 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) m_breakHandler->setBreakpoint(fileName, lineNumber); else m_breakHandler->removeBreakpoint(index); - m_engine->attemptBreakpointSynchronization(); + + attemptBreakpointSynchronization(); } void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineNumber) @@ -720,7 +722,6 @@ void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineN if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << fileName << lineNumber; - QTC_ASSERT(m_engine, return); QTC_ASSERT(m_breakHandler, return); if (status() != DebuggerInferiorRunning && status() != DebuggerInferiorStopped @@ -731,24 +732,26 @@ void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineN } m_breakHandler->toggleBreakpointEnabled(fileName, lineNumber); - m_engine->attemptBreakpointSynchronization(); + + attemptBreakpointSynchronization(); } void DebuggerManager::attemptBreakpointSynchronization() { - m_engine->attemptBreakpointSynchronization(); + if (m_engine) + m_engine->attemptBreakpointSynchronization(); } void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp) { - QTC_ASSERT(m_engine, return); - m_engine->setToolTipExpression(pos, exp); + if (m_engine) + m_engine->setToolTipExpression(pos, exp); } void DebuggerManager::updateWatchModel() { - QTC_ASSERT(m_engine, return); - m_engine->updateWatchModel(); + if (m_engine) + m_engine->updateWatchModel(); } QVariant DebuggerManager::sessionValue(const QString &name) @@ -946,9 +949,9 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl) DebuggerType type; QString errorMessage; - const bool hasDebugger = startMode() == AttachExternal ? - determineDebuggerType(m_attachedPID, &type, &errorMessage) : - determineDebuggerType(m_executable, &type, &errorMessage); + const bool hasDebugger = startMode() == AttachExternal + ? determineDebuggerType(m_attachedPID, &type, &errorMessage) + : determineDebuggerType(m_executable, &type, &errorMessage); if (!hasDebugger) { QMessageBox::warning(mainWindow(), tr("Warning"), tr("Cannot debug '%1': %2").arg(m_executable, errorMessage)); @@ -1117,18 +1120,14 @@ void DebuggerManager::aboutToSaveSession() void DebuggerManager::loadSessionData() { - QTC_ASSERT(m_engine, return); m_breakHandler->loadSessionData(); m_watchHandler->loadSessionData(); - m_engine->loadSessionData(); } void DebuggerManager::saveSessionData() { - QTC_ASSERT(m_engine, return); m_breakHandler->saveSessionData(); m_watchHandler->saveSessionData(); - m_engine->saveSessionData(); } void DebuggerManager::dumpLog() @@ -1164,17 +1163,15 @@ void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber) qDebug() << Q_FUNC_INFO << fileName << lineNumber; QTC_ASSERT(m_breakHandler, return); - QTC_ASSERT(m_engine, return); m_breakHandler->setBreakpoint(fileName, lineNumber); - m_engine->attemptBreakpointSynchronization(); + attemptBreakpointSynchronization(); } void DebuggerManager::breakByFunction(const QString &functionName) { QTC_ASSERT(m_breakHandler, return); - QTC_ASSERT(m_engine, return); m_breakHandler->breakByFunction(functionName); - m_engine->attemptBreakpointSynchronization(); + attemptBreakpointSynchronization(); } void DebuggerManager::breakByFunction() @@ -1300,14 +1297,16 @@ void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, void DebuggerManager::continueExec() { - m_engine->continueInferior(); + if (m_engine) + m_engine->continueInferior(); } void DebuggerManager::interruptDebuggingRequest() { if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << status(); - QTC_ASSERT(m_engine, return); + if (!m_engine) + return; bool interruptIsExit = (status() != DebuggerInferiorRunning); if (interruptIsExit) exitDebugger(); @@ -1319,11 +1318,10 @@ void DebuggerManager::interruptDebuggingRequest() void DebuggerManager::runToLineExec() { - QTC_ASSERT(m_engine, return); QString fileName; int lineNumber = -1; emit currentTextEditorRequested(&fileName, &lineNumber, 0); - if (!fileName.isEmpty()) { + if (m_engine && !fileName.isEmpty()) { if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << fileName << lineNumber; m_engine->runToLineExec(fileName, lineNumber); @@ -1360,7 +1358,7 @@ void DebuggerManager::runToFunctionExec() if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << functionName; - if (!functionName.isEmpty()) + if (m_engine && !functionName.isEmpty()) m_engine->runToFunctionExec(functionName); } @@ -1369,7 +1367,7 @@ void DebuggerManager::jumpToLineExec() QString fileName; int lineNumber = -1; emit currentTextEditorRequested(&fileName, &lineNumber, 0); - if (!fileName.isEmpty()) { + if (m_engine && !fileName.isEmpty()) { if (Debugger::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << fileName << lineNumber; m_engine->jumpToLineExec(fileName, lineNumber); @@ -1404,10 +1402,8 @@ void DebuggerManager::fileOpen(const QString &fileName) void DebuggerManager::reloadDisassembler() { - QTC_ASSERT(m_engine, return); - if (!m_disassemblerDock || !m_disassemblerDock->isVisible()) - return; - m_engine->reloadDisassembler(); + if (m_engine && m_disassemblerDock && m_disassemblerDock->isVisible()) + m_engine->reloadDisassembler(); } void DebuggerManager::disassemblerDockToggled(bool on) @@ -1425,9 +1421,8 @@ void DebuggerManager::disassemblerDockToggled(bool on) void DebuggerManager::reloadSourceFiles() { - if (!m_sourceFilesDock || !m_sourceFilesDock->isVisible()) - return; - m_engine->reloadSourceFiles(); + if (m_engine && m_sourceFilesDock && m_sourceFilesDock->isVisible()) + m_engine->reloadSourceFiles(); } void DebuggerManager::sourceFilesDockToggled(bool on) @@ -1445,9 +1440,8 @@ void DebuggerManager::sourceFilesDockToggled(bool on) void DebuggerManager::reloadModules() { - if (!m_modulesDock || !m_modulesDock->isVisible()) - return; - m_engine->reloadModules(); + if (m_engine && m_modulesDock && m_modulesDock->isVisible()) + m_engine->reloadModules(); } void DebuggerManager::modulesDockToggled(bool on) @@ -1490,9 +1484,8 @@ void DebuggerManager::registerDockToggled(bool on) void DebuggerManager::reloadRegisters() { - if (!m_registerDock || !m_registerDock->isVisible()) - return; - m_engine->reloadRegisters(); + if (m_engine && m_registerDock && m_registerDock->isVisible()) + m_engine->reloadRegisters(); } ////////////////////////////////////////////////////////////////////// diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index ad92a003f3b..1d9e97d0368 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -202,7 +202,7 @@ public: QMainWindow *mainWindow() const { return m_mainWindow; } QLabel *statusLabel() const { return m_statusLabel; } - enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger }; + enum DebuggerType { NoDebugger, GdbDebugger, ScriptDebugger, WinDebugger }; public slots: void startNewDebugger(DebuggerRunControl *runControl); diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index c053bc1c0ac..87523ae703b 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -112,9 +112,6 @@ private: Q_SLOT void attemptBreakpointSynchronization(); - void loadSessionData() {} - void saveSessionData() {} - void assignValueInDebugger(const QString &expr, const QString &value); void executeDebuggerCommand(const QString & command); diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 0d3863a34e7..cf700c20877 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -74,9 +74,6 @@ public: virtual void attemptBreakpointSynchronization() = 0; - virtual void loadSessionData() = 0; - virtual void saveSessionData() = 0; - virtual void reloadDisassembler() = 0; virtual void reloadModules() = 0; diff --git a/src/plugins/debugger/scriptengine.h b/src/plugins/debugger/scriptengine.h index ee5612d09d8..79568aca88f 100644 --- a/src/plugins/debugger/scriptengine.h +++ b/src/plugins/debugger/scriptengine.h @@ -94,9 +94,6 @@ private: void attemptBreakpointSynchronization(); - void loadSessionData() {} - void saveSessionData() {} - void assignValueInDebugger(const QString &expr, const QString &value); void executeDebuggerCommand(const QString & command); -- GitLab