From 0ea0977ca8144e4032cfa77f7c8a56f1e8223395 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Fri, 9 Apr 2010 14:53:45 +0200
Subject: [PATCH] debugger: introduce a new category for commands that are
 always immediately executed

used for -exec-interrupt right now
---
 src/plugins/debugger/gdb/gdbengine.cpp        | 7 ++++++-
 src/plugins/debugger/gdb/gdbengine.h          | 2 ++
 src/plugins/debugger/gdb/remotegdbadapter.cpp | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 0d81d8eeba7..ae66cde0853 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -759,7 +759,12 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
                       << "LEAVES PENDING BREAKPOINT AT" << m_pendingBreakpointRequests);
     }
 
-    if ((cmd.flags & NeedsStop) || !m_commandsToRunOnTemporaryBreak.isEmpty()) {
+    // FIXME: clean up logic below
+    if (cmd.flags & Immediate) {
+        // This should always be sent.
+        flushCommand(cmd);
+    } else if ((cmd.flags & NeedsStop)
+            || !m_commandsToRunOnTemporaryBreak.isEmpty()) {
         if (state() == InferiorStopped || state() == InferiorUnrunnable
             || state() == InferiorStarting || state() == AdapterStarted) {
             // Can be safely sent now.
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index f145002caf8..9d6760d31f1 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -193,6 +193,8 @@ private: ////////// Gdb Command Management //////////
         LosesChild = 64,
         // Trigger breakpoint model rebuild when no such commands are pending anymore.
         RebuildBreakpointModel = 128,
+        // This command needs to be send immediately.
+        Immediate = 256,
     };
     Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag)
     private:
diff --git a/src/plugins/debugger/gdb/remotegdbadapter.cpp b/src/plugins/debugger/gdb/remotegdbadapter.cpp
index 664ed9c5312..a4e24791aa5 100644
--- a/src/plugins/debugger/gdb/remotegdbadapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbadapter.cpp
@@ -227,7 +227,7 @@ void RemoteGdbAdapter::startInferiorPhase2()
 
 void RemoteGdbAdapter::interruptInferior()
 {
-    m_engine->postCommand("-exec-interrupt");
+    m_engine->postCommand("-exec-interrupt", GdbEngine::Immediate);
 }
 
 void RemoteGdbAdapter::shutdown()
-- 
GitLab