diff options
author | hjk <hjk121@nokiamail.com> | 2014-12-12 15:33:16 +0100 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-12-15 17:23:48 +0100 |
commit | aff13fdf27b50dff9919fb45ac7703fc851174b1 (patch) | |
tree | 94de1406c69330abda1413a29c377812bc9dd333 /src/plugins/debugger | |
parent | 8f7bd19600a03427cac095d9f7937a103a158bb9 (diff) | |
download | qt-creator-aff13fdf27b50dff9919fb45ac7703fc851174b1.tar.gz |
Debugger: Make DebuggerEngine internal
Expose less of debugger internals to the device plugins.
Change-Id: Ie78756b033fae3fe02bff92eadf26b7319990605
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/debugger')
25 files changed, 112 insertions, 95 deletions
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index e737eda6a4..2ac1ff93c5 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -42,12 +42,10 @@ ////////////////////////////////////////////////////////////////// namespace Debugger { - -class DebuggerEngine; - namespace Internal { class BreakpointMarker; +class DebuggerEngine; class BreakHandler : public QAbstractItemModel { diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 37ed92c68b..d259544b75 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -52,7 +52,7 @@ struct MemoryViewCookie; class ByteArrayInputStream; class GdbMi; -class CdbEngine : public Debugger::DebuggerEngine +class CdbEngine : public DebuggerEngine { Q_OBJECT diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index cd8867a381..65923be5ef 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -50,12 +50,10 @@ namespace CPlusPlus { class Snapshot; } namespace Utils { class SavedAction; } namespace Debugger { - -class DebuggerEngine; - namespace Internal { class BreakHandler; +class DebuggerEngine; class Symbol; class Section; class GlobalDebuggerOptions; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index a89eb6e837..e89a20a3a8 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -99,18 +99,6 @@ const char PrefixDebugExecutable[] = "DebuggedExecutable"; namespace Debugger { -Internal::Location::Location(const StackFrame &frame, bool marker) -{ - init(); - m_fileName = frame.file; - m_lineNumber = frame.line; - m_needsMarker = marker; - m_functionName = frame.function; - m_hasDebugInfo = frame.isUsable(); - m_address = frame.address; - m_from = frame.from; -} - QDebug operator<<(QDebug d, DebuggerState state) { //return d << DebuggerEngine::stateName(state) << '(' << int(state) << ')'; @@ -133,6 +121,20 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &sp) return str; } +namespace Internal { + +Location::Location(const StackFrame &frame, bool marker) +{ + init(); + m_fileName = frame.file; + m_lineNumber = frame.line; + m_needsMarker = marker; + m_functionName = frame.function; + m_hasDebugInfo = frame.isUsable(); + m_address = frame.address; + m_from = frame.from; +} + ////////////////////////////////////////////////////////////////////// // @@ -781,6 +783,7 @@ void DebuggerEngine::notifyInferiorSetupOk() #ifdef WITH_BENCHMARK CALLGRIND_START_INSTRUMENTATION; #endif + aboutToNotifyInferiorSetupOk(); showMessage(_("NOTE: INFERIOR SETUP OK")); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << this << state()); setState(InferiorSetupOk); @@ -1903,6 +1906,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp) } } +} // namespace Internal } // namespace Debugger #include "debuggerengine.moc" diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 72ebf538f2..8584a40150 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -50,7 +50,6 @@ namespace Core { class IOptionsPage; } namespace Debugger { -class DebuggerEnginePrivate; class DebuggerRunControl; class DebuggerStartParameters; @@ -59,6 +58,7 @@ DEBUGGER_EXPORT QDebug operator<<(QDebug str, DebuggerState state); namespace Internal { +class DebuggerEnginePrivate; class DebuggerPluginPrivate; class DisassemblerAgent; class MemoryAgent; @@ -129,11 +129,7 @@ public: quint64 address; }; -} // namespace Internal - - -// FIXME: DEBUGGER_EXPORT? -class DEBUGGER_EXPORT DebuggerEngine : public QObject +class DebuggerEngine : public QObject { Q_OBJECT @@ -282,6 +278,7 @@ signals: * a server start script should be used, but none is given. */ void requestRemoteSetup(); + void aboutToNotifyInferiorSetupOk(); protected: // The base notify*() function implementation should be sufficient @@ -315,7 +312,9 @@ protected: virtual void notifyInferiorStopOk(); virtual void notifyInferiorSpontaneousStop(); virtual void notifyInferiorStopFailed(); - Q_SLOT virtual void notifyInferiorExited(); + + public: + virtual void notifyInferiorExited(); protected: virtual void notifyInferiorShutdownOk(); @@ -392,9 +391,9 @@ protected: private: // Wrapper engine needs access to state of its subengines. - friend class Internal::QmlCppEngine; - friend class Internal::DebuggerPluginPrivate; - friend class Internal::QmlAdapter; + friend class QmlCppEngine; + friend class DebuggerPluginPrivate; + friend class QmlAdapter; virtual void setState(DebuggerState state, bool forced = false); @@ -402,6 +401,7 @@ private: DebuggerEnginePrivate *d; }; +} // namespace Internal } // namespace Debugger Q_DECLARE_METATYPE(Debugger::Internal::ContextData) diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index d1c8493348..b73089f207 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -36,16 +36,11 @@ #include <utils/fancymainwindow.h> -namespace Core { -class Context; -class IMode; -} +namespace Core { class IMode; } namespace Debugger { - -class DebuggerEngine; - namespace Internal { + class DebuggerMainWindowPrivate; // DebuggerMainWindow dock widget names diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 3a2e4fb768..d6d1b8081c 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -108,6 +108,13 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, Debug { setIcon(QLatin1String(ProjectExplorer::Constants::ICON_DEBUG_SMALL)); connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished); + + connect(engine, &DebuggerEngine::requestRemoteSetup, + this, &DebuggerRunControl::requestRemoteSetup); + connect(engine, &DebuggerEngine::stateChanged, + this, &DebuggerRunControl::stateChanged); + connect(engine, &DebuggerEngine::aboutToNotifyInferiorSetupOk, + this, &DebuggerRunControl::aboutToNotifyInferiorSetupOk); } DebuggerRunControl::~DebuggerRunControl() @@ -186,6 +193,16 @@ void DebuggerRunControl::startFailed() m_engine->handleStartFailed(); } +void DebuggerRunControl::notifyEngineRemoteServerRunning(const QByteArray &msg, int pid) +{ + m_engine->notifyEngineRemoteServerRunning(msg, pid); +} + +void DebuggerRunControl::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result) +{ + m_engine->notifyEngineRemoteSetupFinished(result); +} + void DebuggerRunControl::handleFinished() { appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat); @@ -222,15 +239,39 @@ void DebuggerRunControl::debuggingFinished() emit finished(); } +void DebuggerRunControl::showMessage(const QString &msg, int channel) +{ + m_engine->showMessage(msg, channel); +} + bool DebuggerRunControl::isRunning() const { return m_running; } -DebuggerEngine *DebuggerRunControl::engine() +DebuggerStartParameters &DebuggerRunControl::startParameters() +{ + return m_engine->startParameters(); +} + +void DebuggerRunControl::notifyInferiorIll() +{ + m_engine->notifyInferiorIll(); +} + +void DebuggerRunControl::notifyInferiorExited() +{ + m_engine->notifyInferiorExited(); +} + +void DebuggerRunControl::quitDebugger() +{ + m_engine->quitDebugger(); +} + +void DebuggerRunControl::abortDebugger() { - QTC_CHECK(m_engine); - return m_engine; + m_engine->abortDebugger(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 32e45c22a7..47978fd976 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -40,7 +40,10 @@ namespace ProjectExplorer { class Kit; } namespace Debugger { -class DebuggerEngine; +class RemoteSetupResult; + +namespace Internal { class DebuggerEngine; } + class DebuggerStartParameters; class DEBUGGER_EXPORT DebuggerRunControl @@ -59,20 +62,32 @@ public: QString displayName() const; void startFailed(); + void notifyEngineRemoteServerRunning(const QByteArray &msg, int pid); + void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result); + void notifyInferiorIll(); + Q_SLOT void notifyInferiorExited(); + void quitDebugger(); + void abortDebugger(); void debuggingFinished(); - DebuggerEngine *engine(); + + void showMessage(const QString &msg, int channel = LogDebug); + + DebuggerStartParameters &startParameters(); signals: - void engineRequestSetup(); + void requestRemoteSetup(); + void aboutToNotifyInferiorSetupOk(); + void stateChanged(Debugger::DebuggerState state); private slots: void handleFinished(); private: friend class DebuggerRunControlFactory; - DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, DebuggerEngine *engine); + DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, + Internal::DebuggerEngine *engine); - DebuggerEngine *m_engine; + Internal::DebuggerEngine *m_engine; bool m_running; }; @@ -91,7 +106,7 @@ public: bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const; - static DebuggerEngine *createEngine(DebuggerEngineType et, + static Internal::DebuggerEngine *createEngine(DebuggerEngineType et, const DebuggerStartParameters &sp, QString *errorMessage); diff --git a/src/plugins/debugger/debuggertooltipmanager.h b/src/plugins/debugger/debuggertooltipmanager.h index 2ff2f591d6..f1e8ed69e2 100644 --- a/src/plugins/debugger/debuggertooltipmanager.h +++ b/src/plugins/debugger/debuggertooltipmanager.h @@ -42,11 +42,9 @@ class QAbstractItemModel; QT_END_NAMESPACE namespace Debugger { - -class DebuggerEngine; - namespace Internal { +class DebuggerEngine; class StackFrame; class DebuggerToolTipContext diff --git a/src/plugins/debugger/disassembleragent.h b/src/plugins/debugger/disassembleragent.h index e7c3a62177..65c3ac975a 100644 --- a/src/plugins/debugger/disassembleragent.h +++ b/src/plugins/debugger/disassembleragent.h @@ -34,13 +34,12 @@ #include <QObject> namespace Debugger { +namespace Internal { class DebuggerEngine; - -namespace Internal { +class DisassemblerAgentPrivate; class DisassemblerLines; class Location; -class DisassemblerAgentPrivate; class DisassemblerAgent : public QObject { diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 7760d49f77..2072092f21 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -60,7 +60,7 @@ class WatchData; class DisassemblerAgentCookie; class DisassemblerLines; -class GdbEngine : public Debugger::DebuggerEngine +class GdbEngine : public DebuggerEngine { Q_OBJECT diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 4232c13f79..9a3f0075e8 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -333,12 +333,6 @@ void GdbRemoteServerEngine::handleTargetExtendedAttach(const GdbResponse &respon } } -void GdbRemoteServerEngine::notifyInferiorSetupOk() -{ - emit aboutToNotifyInferiorSetupOk(); - GdbEngine::notifyInferiorSetupOk(); -} - void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response) { QTC_ASSERT(m_isQnxGdb, qDebug() << m_isQnxGdb); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.h b/src/plugins/debugger/gdb/remotegdbserveradapter.h index 521c202eec..c19c1f85a1 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.h +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.h @@ -66,7 +66,6 @@ signals: * a server start script should be used, but none is given. */ void requestSetup(); - void aboutToNotifyInferiorSetupOk(); private: Q_SLOT void readUploadStandardOutput(); @@ -77,7 +76,6 @@ private: void notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int inferiorPid); void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result); - void notifyInferiorSetupOk(); void handleSetTargetAsync(const GdbResponse &response); void handleFileExecAndSymbols(const GdbResponse &response); diff --git a/src/plugins/debugger/memoryagent.h b/src/plugins/debugger/memoryagent.h index 00111fc623..77098e9aed 100644 --- a/src/plugins/debugger/memoryagent.h +++ b/src/plugins/debugger/memoryagent.h @@ -44,11 +44,11 @@ namespace Core { class IEditor; } namespace ProjectExplorer { class Abi; } namespace Debugger { +namespace Internal { class DebuggerEngine; - -namespace Internal { class MemoryView; + class MemoryMarkup { public: diff --git a/src/plugins/debugger/moduleshandler.h b/src/plugins/debugger/moduleshandler.h index 6dcafef277..6897542954 100644 --- a/src/plugins/debugger/moduleshandler.h +++ b/src/plugins/debugger/moduleshandler.h @@ -39,11 +39,9 @@ class QSortFilterProxyModel; QT_END_NAMESPACE namespace Debugger { - -class DebuggerEngine; - namespace Internal { +class DebuggerEngine; class ModulesModel; ////////////////////////////////////////////////////////////////// diff --git a/src/plugins/debugger/qml/qmladapter.h b/src/plugins/debugger/qml/qmladapter.h index 0f72370943..107dbfd73e 100644 --- a/src/plugins/debugger/qml/qmladapter.h +++ b/src/plugins/debugger/qml/qmladapter.h @@ -43,11 +43,10 @@ class QDebugMessageClient; } namespace Debugger { - -class DebuggerEngine; - namespace Internal { + class BaseQmlDebuggerClient; +class DebuggerEngine; class QmlAdapterPrivate; class QmlAdapter : public QObject diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index 8e15956efe..0ccbf07b8f 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -408,7 +408,6 @@ void QmlCppEngine::notifyInferiorShutdownOk() void QmlCppEngine::notifyInferiorSetupOk() { EDEBUG("\nMASTER INFERIOR SETUP OK"); - emit aboutToNotifyInferiorSetupOk(); DebuggerEngine::notifyInferiorSetupOk(); } diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h index a3d795ede8..4657dd7fe4 100644 --- a/src/plugins/debugger/qml/qmlcppengine.h +++ b/src/plugins/debugger/qml/qmlcppengine.h @@ -130,9 +130,6 @@ protected: void notifyInferiorSetupOk(); void notifyEngineRemoteServerRunning(const QByteArray &, int pid); -signals: - void aboutToNotifyInferiorSetupOk(); - private: void engineStateChanged(DebuggerState newState); void setState(DebuggerState newState, bool forced = false); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 7efd0ace73..188686195a 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -351,12 +351,6 @@ QmlEngine::~QmlEngine() Core::EditorManager::closeDocuments(documentsToClose.toList()); } -void QmlEngine::notifyInferiorSetupOk() -{ - emit aboutToNotifyInferiorSetupOk(); - DebuggerEngine::notifyInferiorSetupOk(); -} - void QmlEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 90c6f4fb11..b5f296f5e3 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -60,7 +60,6 @@ public: DebuggerEngine *masterEngine = 0); ~QmlEngine(); - void notifyInferiorSetupOk(); void notifyEngineRemoteServerRunning(const QByteArray &, int pid); void notifyEngineRemoteSetupFinished(const RemoteSetupResult &result); @@ -90,7 +89,6 @@ public: signals: void tooltipRequested(const QPoint &mousePos, TextEditor::TextEditorWidget *editorWidget, int cursorPos); - void aboutToNotifyInferiorSetupOk(); private slots: void disconnected(); diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.h b/src/plugins/debugger/qml/qmlinspectoradapter.h index 457969e430..f40f38da12 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.h +++ b/src/plugins/debugger/qml/qmlinspectoradapter.h @@ -47,11 +47,9 @@ class FileReference; } namespace Debugger { - -class DebuggerEngine; - namespace Internal { +class DebuggerEngine; class WatchTreeView; class QmlAdapter; class QmlInspectorAgent; diff --git a/src/plugins/debugger/qml/qmlinspectoragent.h b/src/plugins/debugger/qml/qmlinspectoragent.h index 5b39d8eaac..2d17b6a53f 100644 --- a/src/plugins/debugger/qml/qmlinspectoragent.h +++ b/src/plugins/debugger/qml/qmlinspectoragent.h @@ -37,11 +37,9 @@ #include <qmldebug/baseenginedebugclient.h> namespace Debugger { - -class DebuggerEngine; - namespace Internal { +class DebuggerEngine; class WatchData; //map <filename, editorRevision> -> <lineNumber, columnNumber> -> debugId diff --git a/src/plugins/debugger/snapshothandler.h b/src/plugins/debugger/snapshothandler.h index 5a07499d10..a76db83153 100644 --- a/src/plugins/debugger/snapshothandler.h +++ b/src/plugins/debugger/snapshothandler.h @@ -35,18 +35,16 @@ #include <QPointer> namespace Debugger { +namespace Internal { class DebuggerEngine; -namespace Internal { - //////////////////////////////////////////////////////////////////////// // // SnapshotModel // //////////////////////////////////////////////////////////////////////// - class SnapshotHandler : public QAbstractTableModel { Q_OBJECT diff --git a/src/plugins/debugger/sourceagent.h b/src/plugins/debugger/sourceagent.h index 90d18f1264..c8b4300a1b 100644 --- a/src/plugins/debugger/sourceagent.h +++ b/src/plugins/debugger/sourceagent.h @@ -34,16 +34,15 @@ #include <QString> namespace Debugger { - -class DebuggerEngine; - namespace Internal { +class DebuggerEngine; class SourceAgentPrivate; + class SourceAgent { public: - explicit SourceAgent(Debugger::DebuggerEngine *engine); + explicit SourceAgent(DebuggerEngine *engine); ~SourceAgent(); void setSourceProducerName(const QString &name); void resetLocation(); diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 987095c375..14b066174c 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -108,11 +108,10 @@ public: Q_DECLARE_METATYPE(Debugger::Internal::TypeFormatList) namespace Debugger { +namespace Internal { class DebuggerEngine; -namespace Internal { - class UpdateParameters { public: |