diff options
author | hjk <[email protected]> | 2010-07-09 17:07:59 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2010-07-14 17:49:16 +0200 |
commit | e760700f0fea2f9a25cdbbbc1af52a446be4b183 (patch) | |
tree | 7a5ac650129e16119e1f076c27262311e4f22982 /src/plugins/debugger/tcf | |
parent | 6089bc1b9e046b9b1b36dc64ed7920467909ebe8 (diff) |
debugger: overhaul "state machine"
This mainly allows for more precise shutdown and tightens the set
of allowed transitions.
Diffstat (limited to 'src/plugins/debugger/tcf')
-rw-r--r-- | src/plugins/debugger/tcf/tcfengine.cpp | 54 | ||||
-rw-r--r-- | src/plugins/debugger/tcf/tcfengine.h | 12 |
2 files changed, 42 insertions, 24 deletions
diff --git a/src/plugins/debugger/tcf/tcfengine.cpp b/src/plugins/debugger/tcf/tcfengine.cpp index 29589ad4442..f534d000fdd 100644 --- a/src/plugins/debugger/tcf/tcfengine.cpp +++ b/src/plugins/debugger/tcf/tcfengine.cpp @@ -155,14 +155,11 @@ void TcfEngine::socketReadyRead() void TcfEngine::socketConnected() { showStatusMessage("Socket connected."); - if (m_socket->waitForConnected(2000)) - notifyEngineSetupOk(); - else - notifyEngineSetupFailed(); } void TcfEngine::socketDisconnected() { + showStatusMessage("Socket disconnected."); XSDEBUG("FIXME: TcfEngine::socketDisconnected()"); } @@ -171,7 +168,7 @@ void TcfEngine::socketError(QAbstractSocket::SocketError) QString msg = tr("%1.").arg(m_socket->errorString()); //QMessageBox::critical(q->mainWindow(), tr("Error"), msg); showStatusMessage(msg); - exitDebugger(); + notifyEngineIll(); } void TcfEngine::executeDebuggerCommand(const QString &command) @@ -189,29 +186,46 @@ void TcfEngine::executeDebuggerCommand(const QString &command) enqueueCommand(tcf); } -void TcfEngine::shutdown() -{ - m_congestion = 0; - m_inAir = 0; - m_services.clear(); - exitDebugger(); -} - -void TcfEngine::exitDebugger() -{ - SDEBUG("TcfEngine::exitDebugger()"); -} - void TcfEngine::setupEngine() { - QTC_ASSERT(state() == EngineSettingUp, qDebug() << state()); - setState(InferiorRunningRequested); + QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showStatusMessage(tr("Running requested..."), 5000); const DebuggerStartParameters &sp = startParameters(); const int pos = sp.remoteChannel.indexOf(QLatin1Char(':')); const QString host = sp.remoteChannel.left(pos); const quint16 port = sp.remoteChannel.mid(pos + 1).toInt(); m_socket->connectToHost(host, port); + if (m_socket->waitForConnected()) + notifyEngineSetupOk(); + else + notifyEngineSetupFailed(); +} + +void TcfEngine::setupInferior() +{ + QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); + notifyInferiorSetupOk(); +} + +void TcfEngine::runEngine() +{ + QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); + //notifyEngineRunOk(); +} + +void TcfEngine::shutdownInferior() +{ + QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state()); + notifyInferiorShutdownOk(); +} + +void TcfEngine::shutdownEngine() +{ + QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state()); + m_congestion = 0; + m_inAir = 0; + m_services.clear(); + notifyEngineShutdownOk(); } void TcfEngine::continueInferior() diff --git a/src/plugins/debugger/tcf/tcfengine.h b/src/plugins/debugger/tcf/tcfengine.h index 570255f39c7..583a28734b0 100644 --- a/src/plugins/debugger/tcf/tcfengine.h +++ b/src/plugins/debugger/tcf/tcfengine.h @@ -72,10 +72,14 @@ private: void executeStepI(); void executeNextI(); - void shutdown(); - void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setupEngine(); - void exitDebugger(); + void setupInferior(); + void runEngine(); + void shutdownInferior(); + void shutdownEngine(); + + void setToolTipExpression(const QPoint &mousePos, + TextEditor::ITextEditor *editor, int cursorPos); void continueInferior(); void interruptInferior(); @@ -90,7 +94,7 @@ private: void attemptBreakpointSynchronization(); void assignValueInDebugger(const QString &expr, const QString &value); - void executeDebuggerCommand(const QString & command); + void executeDebuggerCommand(const QString &command); void loadSymbols(const QString &moduleName); void loadAllSymbols(); |