forked from qt-creator/qt-creator
Debugger: Remove the InferiorExited state
There are now several possible orders of events between sending a 'kill' and receiving something that indicated a properly shut down inferior. Coordinating the InferiorExited state during engine ramp down is not worthwhile as that state had only a forced transition to InferiorShutdownOk anyway. For the user (and user code), only the fact that ramp down is finished is interesting. Change-Id: Ic22131d5a1066dc62bd069f532c28b773f231088 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -102,8 +102,6 @@ enum DebuggerState
|
|||||||
InferiorStopOk, // Debuggee stopped
|
InferiorStopOk, // Debuggee stopped
|
||||||
InferiorStopFailed, // Debuggee not stopped, will kill debugger
|
InferiorStopFailed, // Debuggee not stopped, will kill debugger
|
||||||
|
|
||||||
InferiorExitOk,
|
|
||||||
|
|
||||||
InferiorShutdownRequested,
|
InferiorShutdownRequested,
|
||||||
InferiorShutdownFailed,
|
InferiorShutdownFailed,
|
||||||
InferiorShutdownOk,
|
InferiorShutdownOk,
|
||||||
|
|||||||
@@ -382,7 +382,6 @@ const char *DebuggerEngine::stateName(int s)
|
|||||||
SN(InferiorStopRequested)
|
SN(InferiorStopRequested)
|
||||||
SN(InferiorStopOk)
|
SN(InferiorStopOk)
|
||||||
SN(InferiorStopFailed)
|
SN(InferiorStopFailed)
|
||||||
SN(InferiorExitOk)
|
|
||||||
SN(InferiorShutdownRequested)
|
SN(InferiorShutdownRequested)
|
||||||
SN(InferiorShutdownOk)
|
SN(InferiorShutdownOk)
|
||||||
SN(InferiorShutdownFailed)
|
SN(InferiorShutdownFailed)
|
||||||
@@ -721,19 +720,16 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
|
|||||||
case InferiorRunOk:
|
case InferiorRunOk:
|
||||||
return to == InferiorStopRequested
|
return to == InferiorStopRequested
|
||||||
|| to == InferiorStopOk // A spontaneous stop.
|
|| to == InferiorStopOk // A spontaneous stop.
|
||||||
|| to == InferiorExitOk;
|
|| to == InferiorShutdownOk; // A spontaneous exit.
|
||||||
|
|
||||||
case InferiorStopRequested:
|
case InferiorStopRequested:
|
||||||
return to == InferiorStopOk || to == InferiorStopFailed;
|
return to == InferiorStopOk || to == InferiorStopFailed;
|
||||||
case InferiorStopOk:
|
case InferiorStopOk:
|
||||||
return to == InferiorRunRequested || to == InferiorShutdownRequested
|
return to == InferiorRunRequested || to == InferiorShutdownRequested
|
||||||
|| to == InferiorStopOk || to == InferiorExitOk;
|
|| to == InferiorStopOk || to == InferiorShutdownOk;
|
||||||
case InferiorStopFailed:
|
case InferiorStopFailed:
|
||||||
return to == EngineShutdownRequested;
|
return to == EngineShutdownRequested;
|
||||||
|
|
||||||
case InferiorExitOk:
|
|
||||||
return to == InferiorShutdownOk;
|
|
||||||
|
|
||||||
case InferiorUnrunnable:
|
case InferiorUnrunnable:
|
||||||
return to == InferiorShutdownRequested;
|
return to == InferiorShutdownRequested;
|
||||||
case InferiorShutdownRequested:
|
case InferiorShutdownRequested:
|
||||||
@@ -1201,7 +1197,6 @@ void DebuggerEngine::notifyInferiorExited()
|
|||||||
#endif
|
#endif
|
||||||
showMessage(_("NOTE: INFERIOR EXITED"));
|
showMessage(_("NOTE: INFERIOR EXITED"));
|
||||||
d->resetLocation();
|
d->resetLocation();
|
||||||
setState(InferiorExitOk);
|
|
||||||
setState(InferiorShutdownOk);
|
setState(InferiorShutdownOk);
|
||||||
if (isMasterEngine())
|
if (isMasterEngine())
|
||||||
d->queueShutdownEngine();
|
d->queueShutdownEngine();
|
||||||
@@ -1364,7 +1359,6 @@ bool DebuggerEngine::debuggerActionsEnabled(DebuggerState state)
|
|||||||
case EngineRunFailed:
|
case EngineRunFailed:
|
||||||
case InferiorSetupFailed:
|
case InferiorSetupFailed:
|
||||||
case InferiorStopFailed:
|
case InferiorStopFailed:
|
||||||
case InferiorExitOk:
|
|
||||||
case InferiorShutdownRequested:
|
case InferiorShutdownRequested:
|
||||||
case InferiorShutdownOk:
|
case InferiorShutdownOk:
|
||||||
case InferiorShutdownFailed:
|
case InferiorShutdownFailed:
|
||||||
@@ -1428,7 +1422,6 @@ void DebuggerEngine::quitDebugger()
|
|||||||
break;
|
break;
|
||||||
case EngineRunFailed:
|
case EngineRunFailed:
|
||||||
case DebuggerFinished:
|
case DebuggerFinished:
|
||||||
case InferiorExitOk:
|
|
||||||
case InferiorShutdownOk:
|
case InferiorShutdownOk:
|
||||||
break;
|
break;
|
||||||
case InferiorSetupRequested:
|
case InferiorSetupRequested:
|
||||||
|
|||||||
@@ -275,7 +275,7 @@
|
|||||||
{notifyInferior- + + +
|
{notifyInferior- + + +
|
||||||
Exited} + + +
|
Exited} + + +
|
||||||
+ + + +
|
+ + + +
|
||||||
InferiorExitOk + + +
|
+ + + +
|
||||||
+ + + +
|
+ + + +
|
||||||
InferiorShutdownOk InferiorShutdownFailed +
|
InferiorShutdownOk InferiorShutdownFailed +
|
||||||
* * +
|
* * +
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ static bool stateAcceptsGdbCommands(DebuggerState state)
|
|||||||
case InferiorStopFailed:
|
case InferiorStopFailed:
|
||||||
case InferiorSetupOk:
|
case InferiorSetupOk:
|
||||||
case EngineRunFailed:
|
case EngineRunFailed:
|
||||||
case InferiorExitOk:
|
|
||||||
case InferiorRunFailed:
|
case InferiorRunFailed:
|
||||||
case EngineShutdownOk:
|
case EngineShutdownOk:
|
||||||
case EngineShutdownFailed:
|
case EngineShutdownFailed:
|
||||||
@@ -1876,11 +1875,14 @@ void GdbEngine::shutdownInferior()
|
|||||||
|
|
||||||
void GdbEngine::handleInferiorShutdown(const DebuggerResponse &response)
|
void GdbEngine::handleInferiorShutdown(const DebuggerResponse &response)
|
||||||
{
|
{
|
||||||
CHECK_STATE(InferiorShutdownRequested);
|
|
||||||
if (response.resultClass == ResultDone) {
|
if (response.resultClass == ResultDone) {
|
||||||
notifyInferiorShutdownOk();
|
// We'll get async thread-group-exited responses to which we react.
|
||||||
|
// Nothing to do here.
|
||||||
|
// notifyInferiorShutdownOk();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// "kill" got stuck, or similar.
|
||||||
|
CHECK_STATE(InferiorShutdownRequested);
|
||||||
QByteArray ba = response.data["msg"].data();
|
QByteArray ba = response.data["msg"].data();
|
||||||
if (ba.contains(": No such file or directory.")) {
|
if (ba.contains(": No such file or directory.")) {
|
||||||
// This happens when someone removed the binary behind our back.
|
// This happens when someone removed the binary behind our back.
|
||||||
|
|||||||
@@ -649,12 +649,6 @@ void QmlCppEngine::slaveEngineStateChanged
|
|||||||
notifyInferiorStopFailed();
|
notifyInferiorStopFailed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case InferiorExitOk: {
|
|
||||||
// InferiorExitOk will be called through notifyInferiorExited
|
|
||||||
// when InferiorShutDownOk is reached
|
|
||||||
qmlEngine()->quitDebugger();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case InferiorShutdownRequested: {
|
case InferiorShutdownRequested: {
|
||||||
if (state() == InferiorStopOk) {
|
if (state() == InferiorStopOk) {
|
||||||
setState(InferiorShutdownRequested);
|
setState(InferiorShutdownRequested);
|
||||||
|
|||||||
Reference in New Issue
Block a user