From bf280e215b67347aaf499c4b1155f8191e5b8407 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 Nov 2009 14:40:54 +0100 Subject: [PATCH] synchronize temporary interruption with running-requests Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 45e600e852..8456591f85 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -730,9 +730,15 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd) // Queue the commands that we cannot send at once. debugMessage(_("QUEUING COMMAND ") + cmd.command); m_commandsToRunOnTemporaryBreak.append(cmd); - if (state() != InferiorStopping) { + if (state() == InferiorStopping) { + debugMessage(_("CHILD ALREADY BEING INTERRUPTED")); + } else if (state() == InferiorRunningRequested) { + debugMessage(_("RUNNING REQUESTED; POSTPONING INTERRUPT")); + } else if (state() == InferiorRunning) { showStatusMessage(tr("Stopping temporarily."), 1000); - interruptInferior(); // FIXME: race condition between gdb and kill() + interruptInferior(); + } else { + qDebug() << "ATTEMPTING TO QUEUE COMMAND IN INAPPROPRIATE STATE" << state(); } } } else if (!cmd.command.isEmpty()) { @@ -866,6 +872,13 @@ void GdbEngine::handleResultRecord(GdbResponse *response) << "LEAVES PENDING AT" << m_pendingRequests); } + // Commands were queued, but we were in RunningRequested state, so the interrupt + // was postponed. + // This is done after the command callbacks so the running-requesting commands + // can assert on the right state. + if (state() == InferiorRunning && !m_commandsToRunOnTemporaryBreak.isEmpty()) + interruptInferior(); + // Continue only if there are no commands wire anymore, so this will // be fully synchroneous. // This is somewhat inefficient, as it makes the last command synchronous. -- 2.11.0