From f9b6ee54d84b031915491aab1634b5caf7a45a0c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 8 Mar 2023 18:14:41 +0200 Subject: 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 87c00b86dbf75a9204041b0b8e836415b97dc125. 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 --- src/plugins/debugger/gdb/gdbengine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/debugger/gdb/gdbengine.cpp') diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 3fd126a4b0..5156d2e447 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1715,6 +1715,8 @@ void GdbEngine::handleThreadGroupExited(const GdbMi &result) notifyExitCode(exitCode); if (m_rerunPending) m_rerunPending = false; + else if (state() == EngineShutdownRequested) + notifyEngineShutdownFinished(); else notifyInferiorExited(); } -- cgit v1.2.1