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