debugger: simplify combined state handling

This commit is contained in:
hjk
2011-01-14 19:32:47 +01:00
parent 13caaabaff
commit 331ebd5be1
3 changed files with 12 additions and 31 deletions

View File

@@ -1074,10 +1074,9 @@ void DebuggerEngine::notifyInferiorExited()
showMessage(_("NOTE: INFERIOR EXITED")); showMessage(_("NOTE: INFERIOR EXITED"));
d->resetLocation(); d->resetLocation();
setState(InferiorExitOk); setState(InferiorExitOk);
if (isMasterEngine()) { setState(InferiorShutdownOk);
setState(InferiorShutdownOk); if (isMasterEngine())
d->queueShutdownEngine(); d->queueShutdownEngine();
}
} }
void DebuggerEngine::slaveEngineStateChanged(DebuggerEngine *slaveEngine, void DebuggerEngine::slaveEngineStateChanged(DebuggerEngine *slaveEngine,
@@ -1125,18 +1124,6 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
masterEngine()->slaveEngineStateChanged(this, state); masterEngine()->slaveEngineStateChanged(this, state);
} }
void DebuggerEngine::setSilentState(DebuggerState state)
{
qDebug() << "SILENT STATUS CHANGE: " << this
<< " FROM " << stateName(d->m_state) << " TO " << stateName(state)
<< isMasterEngine();
DebuggerState oldState = d->m_state;
d->m_state = state;
if (!isAllowedTransition(oldState, state))
qDebug() << "*** SILENT UNEXPECTED STATE TRANSITION " << this;
}
void DebuggerEngine::updateViews() void DebuggerEngine::updateViews()
{ {
// The slave engines are not entitled to change the view. Their wishes // The slave engines are not entitled to change the view. Their wishes

View File

@@ -356,7 +356,6 @@ private:
friend class Internal::DebuggerPluginPrivate; friend class Internal::DebuggerPluginPrivate;
virtual void setState(DebuggerState state, bool forced = false); virtual void setState(DebuggerState state, bool forced = false);
virtual void setSilentState(DebuggerState state);
virtual void slaveEngineStateChanged(DebuggerEngine *engine, virtual void slaveEngineStateChanged(DebuggerEngine *engine,
DebuggerState state); DebuggerState state);

View File

@@ -389,9 +389,8 @@ void QmlCppEngine::setState(DebuggerState newState, bool forced)
void QmlCppEngine::slaveEngineStateChanged void QmlCppEngine::slaveEngineStateChanged
(DebuggerEngine *slaveEngine, const DebuggerState newState) (DebuggerEngine *slaveEngine, const DebuggerState newState)
{ {
const bool isCpp = slaveEngine == d->m_cppEngine; DebuggerEngine *otherEngine = slaveEngine == d->m_cppEngine
//const bool isQml = slaveEngine == d->m_qmlEngine; ? d->m_qmlEngine : d->m_cppEngine;
DebuggerEngine *otherEngine = isCpp ? d->m_qmlEngine : d->m_cppEngine;
qDebug() << "GOT SLAVE STATE: " << slaveEngine << newState; qDebug() << "GOT SLAVE STATE: " << slaveEngine << newState;
qDebug() << " OTHER ENGINE: " << otherEngine << otherEngine->state(); qDebug() << " OTHER ENGINE: " << otherEngine << otherEngine->state();
@@ -498,14 +497,6 @@ void QmlCppEngine::slaveEngineStateChanged
case InferiorExitOk: case InferiorExitOk:
slaveEngine->setSilentState(InferiorShutdownOk);
if (otherEngine->state() == InferiorShutdownOk) {
notifyInferiorExited();
} else {
if (state() == InferiorRunOk)
notifyInferiorSpontaneousStop();
otherEngine->notifyInferiorExited();
}
break; break;
case InferiorShutdownRequested: case InferiorShutdownRequested:
@@ -516,12 +507,16 @@ void QmlCppEngine::slaveEngineStateChanged
break; break;
case InferiorShutdownOk: case InferiorShutdownOk:
if (otherEngine->state() == InferiorShutdownOk) if (otherEngine->state() == InferiorShutdownOk) {
notifyInferiorShutdownOk(); if (state() == InferiorRunOk)
else if (otherEngine->state() == InferiorRunOk) notifyInferiorExited();
else
notifyInferiorShutdownOk();
} else if (otherEngine->state() == InferiorRunOk) {
otherEngine->quitDebugger(); otherEngine->quitDebugger();
else if (otherEngine->state() == InferiorStopOk) } else if (otherEngine->state() == InferiorStopOk) {
otherEngine->quitDebugger(); otherEngine->quitDebugger();
}
break; break;