Commit c2165718 authored by hjk's avatar hjk

Debugger: Move master engine checks around

From several places in DebuggerEngine::* to one place in
DebuggerEnginePrivate.

Change-Id: Ic87110a11087e338cc9a6b66ea30ea2259861d9e
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent b6697e79
...@@ -695,8 +695,7 @@ void DebuggerEngine::notifyEngineRunFailed() ...@@ -695,8 +695,7 @@ void DebuggerEngine::notifyEngineRunFailed()
d->m_progress.reportFinished(); d->m_progress.reportFinished();
showStatusMessage(tr("Run failed.")); showStatusMessage(tr("Run failed."));
setState(EngineRunFailed); setState(EngineRunFailed);
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
} }
void DebuggerEngine::notifyEngineRunAndInferiorRunOk() void DebuggerEngine::notifyEngineRunAndInferiorRunOk()
...@@ -790,8 +789,7 @@ void DebuggerEngine::notifyInferiorStopFailed() ...@@ -790,8 +789,7 @@ void DebuggerEngine::notifyInferiorStopFailed()
showMessage("NOTE: INFERIOR STOP FAILED"); showMessage("NOTE: INFERIOR STOP FAILED");
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << this << state()); QTC_ASSERT(state() == InferiorStopRequested, qDebug() << this << state());
setState(InferiorStopFailed); setState(InferiorStopFailed);
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
} }
void DebuggerEnginePrivate::doShutdownInferior() void DebuggerEnginePrivate::doShutdownInferior()
...@@ -808,8 +806,7 @@ void DebuggerEngine::notifyInferiorShutdownFinished() ...@@ -808,8 +806,7 @@ void DebuggerEngine::notifyInferiorShutdownFinished()
showMessage("INFERIOR FINISHED SHUT DOWN"); showMessage("INFERIOR FINISHED SHUT DOWN");
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << this << state()); QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << this << state());
setState(InferiorShutdownFinished); setState(InferiorShutdownFinished);
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
} }
void DebuggerEngine::notifyInferiorIll() void DebuggerEngine::notifyInferiorIll()
...@@ -837,8 +834,10 @@ void DebuggerEngine::shutdownSlaveEngine() ...@@ -837,8 +834,10 @@ void DebuggerEngine::shutdownSlaveEngine()
void DebuggerEnginePrivate::doShutdownEngine() void DebuggerEnginePrivate::doShutdownEngine()
{ {
// Slaves do not proceed by themselves.
if (!isMasterEngine())
return;
m_engine->setState(EngineShutdownRequested); m_engine->setState(EngineShutdownRequested);
QTC_ASSERT(isMasterEngine(), qDebug() << m_engine; return);
QTC_ASSERT(m_runTool, return); QTC_ASSERT(m_runTool, return);
m_runTool->startDying(); m_runTool->startDying();
m_engine->showMessage("CALL: SHUTDOWN ENGINE"); m_engine->showMessage("CALL: SHUTDOWN ENGINE");
...@@ -877,12 +876,10 @@ void DebuggerEngine::notifyEngineIll() ...@@ -877,12 +876,10 @@ void DebuggerEngine::notifyEngineIll()
case InferiorStopOk: case InferiorStopOk:
showMessage("FORWARDING STATE TO InferiorShutdownFinished"); showMessage("FORWARDING STATE TO InferiorShutdownFinished");
setState(InferiorShutdownFinished, true); setState(InferiorShutdownFinished, true);
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
break; break;
default: default:
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
break; break;
} }
} }
...@@ -908,8 +905,7 @@ void DebuggerEngine::notifyInferiorExited() ...@@ -908,8 +905,7 @@ void DebuggerEngine::notifyInferiorExited()
showMessage("NOTE: INFERIOR EXITED"); showMessage("NOTE: INFERIOR EXITED");
d->resetLocation(); d->resetLocation();
setState(InferiorShutdownFinished); setState(InferiorShutdownFinished);
if (isMasterEngine()) d->doShutdownEngine();
d->doShutdownEngine();
} }
void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode, void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode,
......
Markdown is supported
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