Commit 585b2c62 authored by hjk's avatar hjk

Debugger: Combine the EngineShutdown{Ok,Failed} states

... into a EngineShutdownFinished. They were never handled differently,
and the only option is to proceed to DebuggerFinished anyway. So
simplify the state machine a bit.

Change-Id: Ied3be86fff6750abca578dc6788e4be1d895692b
Reviewed-by: 's avatarDavid Schulz <david.schulz@qt.io>
parent 01fb309c
......@@ -1521,7 +1521,7 @@ class Dumper(DumperBase):
self.reportResult('', args)
def quit(self, args):
self.reportState('engineshutdownok')
self.reportState('engineshutdownfinished')
self.process.Kill()
self.reportResult('', args)
......
......@@ -722,7 +722,7 @@ void CdbEngine::shutdownEngine()
if (!isCdbProcessRunning()) { // Direct launch: Terminated with process.
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineShutdownOk")
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
return;
}
......
......@@ -99,8 +99,7 @@ enum DebuggerState
InferiorShutdownOk,
EngineShutdownRequested,
EngineShutdownFailed,
EngineShutdownOk,
EngineShutdownFinished,
DebuggerFinished
};
......
......@@ -232,8 +232,7 @@ public:
void doFinishDebugger()
{
QTC_ASSERT(state() == EngineShutdownOk
|| state() == EngineShutdownFailed, qDebug() << state());
QTC_ASSERT(state() == EngineShutdownFinished, qDebug() << state());
m_engine->setState(DebuggerFinished);
resetLocation();
if (isMasterEngine()) {
......@@ -348,8 +347,7 @@ QString DebuggerEngine::stateName(int s)
SN(InferiorShutdownOk)
SN(InferiorShutdownFailed)
SN(EngineShutdownRequested)
SN(EngineShutdownOk)
SN(EngineShutdownFailed)
SN(EngineShutdownFinished)
SN(DebuggerFinished)
}
return QLatin1String("<unknown>");
......@@ -612,10 +610,8 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
return to == EngineShutdownRequested;
case EngineShutdownRequested:
return to == EngineShutdownOk || to == EngineShutdownFailed;
case EngineShutdownOk:
return to == DebuggerFinished;
case EngineShutdownFailed:
return to == EngineShutdownFinished;
case EngineShutdownFinished:
return to == DebuggerFinished;
case DebuggerFinished:
......@@ -862,19 +858,11 @@ void DebuggerEnginePrivate::doShutdownEngine()
m_engine->shutdownEngine();
}
void DebuggerEngine::notifyEngineShutdownOk()
{
showMessage("NOTE: ENGINE SHUTDOWN OK");
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << this << state());
setState(EngineShutdownOk);
d->doFinishDebugger();
}
void DebuggerEngine::notifyEngineShutdownFailed()
void DebuggerEngine::notifyEngineShutdownFinished()
{
showMessage("NOTE: ENGINE SHUTDOWN FAILED");
showMessage("NOTE: ENGINE SHUTDOWN FINISHED");
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << this << state());
setState(EngineShutdownFailed);
setState(EngineShutdownFinished);
d->doFinishDebugger();
}
......@@ -919,7 +907,7 @@ void DebuggerEngine::notifyEngineSpontaneousShutdown()
CALLGRIND_DUMP_STATS;
#endif
showMessage("NOTE: ENGINE SPONTANEOUS SHUTDOWN");
setState(EngineShutdownOk, true);
setState(EngineShutdownFinished, true);
if (isMasterEngine())
d->doFinishDebugger();
}
......@@ -949,7 +937,7 @@ void DebuggerEngine::notifyDebuggerProcessFinished(int exitCode,
break;
case EngineShutdownRequested:
case InferiorShutdownRequested:
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
break;
case InferiorRunOk:
// This could either be a real gdb/lldb crash or a quickly exited inferior
......@@ -1117,8 +1105,7 @@ bool DebuggerEngine::debuggerActionsEnabled(DebuggerState state)
case InferiorShutdownOk:
case InferiorShutdownFailed:
case EngineShutdownRequested:
case EngineShutdownOk:
case EngineShutdownFailed:
case EngineShutdownFinished:
case DebuggerFinished:
return false;
}
......
......@@ -415,8 +415,7 @@ protected:
void notifyInferiorShutdownFailed();
void notifyEngineSpontaneousShutdown();
void notifyEngineShutdownOk();
void notifyEngineShutdownFailed();
void notifyEngineShutdownFinished();
void notifyEngineIll();
......
......@@ -294,14 +294,12 @@
EngineShutdownRequested +
+ +
(calls *Engine->shutdownEngine()) <+-+-+-+-+-+-+-+-+-+-+-+-+-+'
| |
| |
{notify- {notify-
Engine- Engine-
ShutdownOk} ShutdownFailed}
+ +
EngineShutdownOk EngineShutdownFailed
* *
|
|
{notifyEngineShutdownFinished}
+
EngineShutdownFinished
*
DebuggerFinished
\endcode */
......@@ -337,10 +335,8 @@ sg1: InferiorExited -> InferiorExitOk [ label="notifyInferiorExited", style="d
sg1: InferiorExitOk -> InferiorShutdownOk
sg1: InferiorShutdownOk -> EngineShutdownRequested
sg1: InferiorShutdownFailed -> EngineShutdownRequested
sg1: EngineShutdownRequested -> EngineShutdownOk [ label="Engine::shutdownEngine\nnotifyEngineShutdownOk", style="dashed" ];
sg1: EngineShutdownRequested -> EngineShutdownFailed [ label="Engine::shutdownEngine\nnotifyEngineShutdownFailed", style="dashed" ];
sg1: EngineShutdownOk -> DebuggerFinished [ style = "dotted" ];
sg1: EngineShutdownFailed -> DebuggerFinished [ style = "dotted" ];
sg1: EngineShutdownRequested -> EngineShutdownFinished [ label="Engine::shutdownEngine\nnotifyEngineShutdownFinished", style="dashed" ];
sg1: EngineShutdownFinished -> DebuggerFinished [ style = "dotted" ];
sg1: }
* \endcode */
// Additional signalling: {notifyInferiorIll} {notifyEngineIll}
......
......@@ -111,8 +111,7 @@ static bool stateAcceptsGdbCommands(DebuggerState state)
case InferiorStopFailed:
case EngineRunFailed:
case InferiorRunFailed:
case EngineShutdownOk:
case EngineShutdownFailed:
case EngineShutdownFinished:
case DebuggerFinished:
return false;
}
......@@ -919,7 +918,7 @@ void GdbEngine::commandTimeout()
showMessage("KILLING DEBUGGER AS REQUESTED BY USER");
// This is an undefined state, so we just pull the emergency brake.
m_gdbProc.kill();
notifyEngineShutdownFailed();
notifyEngineShutdownFinished();
} else {
showMessage("CONTINUE DEBUGGER AS REQUESTED BY USER");
}
......@@ -1769,7 +1768,7 @@ void GdbEngine::handleGdbExit(const DebuggerResponse &response)
qDebug() << QString("GDB WON'T EXIT (%1); KILLING IT").arg(msg);
showMessage(QString("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
m_gdbProc.kill();
notifyEngineShutdownFailed();
notifyEngineShutdownFinished();
}
}
......@@ -4575,12 +4574,12 @@ void GdbEngine::shutdownEngine()
}
case QProcess::NotRunning:
// Cannot find executable.
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
break;
case QProcess::Starting:
showMessage("GDB NOT REALLY RUNNING; KILLING IT");
m_gdbProc.kill();
notifyEngineShutdownFailed();
notifyEngineShutdownFinished();
break;
}
}
......
......@@ -167,7 +167,7 @@ void LldbEngine::shutdownEngine()
{
QTC_ASSERT(state() == EngineShutdownRequested, qDebug() << state());
m_lldbProc.kill();
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
}
void LldbEngine::abortDebuggerProcess()
......@@ -858,10 +858,8 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState)
notifyInferiorShutdownOk();
else if (newState == "inferiorshutdownfailed")
notifyInferiorShutdownFailed();
else if (newState == "engineshutdownok")
notifyEngineShutdownOk();
else if (newState == "engineshutdownfailed")
notifyEngineShutdownFailed();
else if (newState == "engineshutdownfinished")
notifyEngineShutdownFinished();
else if (newState == "inferiorexited")
notifyInferiorExited();
}
......
......@@ -606,14 +606,9 @@ void QmlCppEngine::slaveEngineStateChanged
CHECK_STATE(EngineShutdownRequested);
break;
}
case EngineShutdownFailed: {
case EngineShutdownFinished: {
CHECK_STATE(EngineShutdownRequested);
notifyEngineShutdownFailed();
break;
}
case EngineShutdownOk: {
CHECK_STATE(EngineShutdownRequested);
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
break;
}
case DebuggerFinished: {
......
......@@ -575,7 +575,7 @@ void QmlEngine::shutdownEngine()
// double check (ill engine?):
stopApplicationLauncher();
notifyEngineShutdownOk();
notifyEngineShutdownFinished();
if (!isSlaveEngine())
showMessage(QString(), StatusBar);
}
......
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