Commit 331ebd5b authored by hjk's avatar hjk
Browse files

debugger: simplify combined state handling

parent 13caaaba
......@@ -1074,10 +1074,9 @@ void DebuggerEngine::notifyInferiorExited()
showMessage(_("NOTE: INFERIOR EXITED"));
d->resetLocation();
setState(InferiorExitOk);
if (isMasterEngine()) {
setState(InferiorShutdownOk);
setState(InferiorShutdownOk);
if (isMasterEngine())
d->queueShutdownEngine();
}
}
void DebuggerEngine::slaveEngineStateChanged(DebuggerEngine *slaveEngine,
......@@ -1125,18 +1124,6 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
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()
{
// The slave engines are not entitled to change the view. Their wishes
......
......@@ -356,7 +356,6 @@ private:
friend class Internal::DebuggerPluginPrivate;
virtual void setState(DebuggerState state, bool forced = false);
virtual void setSilentState(DebuggerState state);
virtual void slaveEngineStateChanged(DebuggerEngine *engine,
DebuggerState state);
......
......@@ -389,9 +389,8 @@ void QmlCppEngine::setState(DebuggerState newState, bool forced)
void QmlCppEngine::slaveEngineStateChanged
(DebuggerEngine *slaveEngine, const DebuggerState newState)
{
const bool isCpp = slaveEngine == d->m_cppEngine;
//const bool isQml = slaveEngine == d->m_qmlEngine;
DebuggerEngine *otherEngine = isCpp ? d->m_qmlEngine : d->m_cppEngine;
DebuggerEngine *otherEngine = slaveEngine == d->m_cppEngine
? d->m_qmlEngine : d->m_cppEngine;
qDebug() << "GOT SLAVE STATE: " << slaveEngine << newState;
qDebug() << " OTHER ENGINE: " << otherEngine << otherEngine->state();
......@@ -498,14 +497,6 @@ void QmlCppEngine::slaveEngineStateChanged
case InferiorExitOk:
slaveEngine->setSilentState(InferiorShutdownOk);
if (otherEngine->state() == InferiorShutdownOk) {
notifyInferiorExited();
} else {
if (state() == InferiorRunOk)
notifyInferiorSpontaneousStop();
otherEngine->notifyInferiorExited();
}
break;
case InferiorShutdownRequested:
......@@ -516,12 +507,16 @@ void QmlCppEngine::slaveEngineStateChanged
break;
case InferiorShutdownOk:
if (otherEngine->state() == InferiorShutdownOk)
notifyInferiorShutdownOk();
else if (otherEngine->state() == InferiorRunOk)
if (otherEngine->state() == InferiorShutdownOk) {
if (state() == InferiorRunOk)
notifyInferiorExited();
else
notifyInferiorShutdownOk();
} else if (otherEngine->state() == InferiorRunOk) {
otherEngine->quitDebugger();
else if (otherEngine->state() == InferiorStopOk)
} else if (otherEngine->state() == InferiorStopOk) {
otherEngine->quitDebugger();
}
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment