Debugger: Fix write error on terminated GDB process

Stopping/Aborting the debugger in core dump mode popped an error message
saying "An error occurred when attempting to write to the process."

Take 2 of 87c00b86db.

The flow is:
InferiorUnrunnable -> InferiorShutdownRequested.

For AttachToCore, there is a no-op transition to
InferiorShutdownFinished, and then EngineShutdownRequested is triggered.
This calls exitGdb, and when the thread group is clear, the engine calls
notifyInferiorExited, which retriggered EngineShutdownRequested. Now the
flow looks like this:
EngineShutdownRequested -> InferiorShutdownFinished
InferiorShutdownFinished -> EngineShutdownRequested

And exitGdb is called again.

Fix this by changing the Finished type to match the Requested.

Change-Id: I45332d3ee1a1e9421ed516cd513542b310198c93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Orgad Shaneh
2023-03-08 18:14:41 +02:00
committed by Orgad Shaneh
parent 13b5254df6
commit f9b6ee54d8

View File

@@ -1715,6 +1715,8 @@ void GdbEngine::handleThreadGroupExited(const GdbMi &result)
notifyExitCode(exitCode); notifyExitCode(exitCode);
if (m_rerunPending) if (m_rerunPending)
m_rerunPending = false; m_rerunPending = false;
else if (state() == EngineShutdownRequested)
notifyEngineShutdownFinished();
else else
notifyInferiorExited(); notifyInferiorExited();
} }