From 90a69474d97b5a51c90694a8ef04088c3abb1ce7 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 9 Apr 2010 12:49:21 +0200
Subject: [PATCH] Debugger[gdb/MinGW]: Ignore spurious 'running' warnings when
 attaching. Reviewed-by: hjk Task-number: QTCREATORBUG-1020

---
 src/plugins/debugger/gdb/gdbengine.cpp | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 7a005ec5f5e..3fe00adf56e 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -961,10 +961,19 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
         response->resultClass != ((cmd.flags & RunRequest) ? GdbResultRunning :
                                   (cmd.flags & ExitRequest) ? GdbResultExit :
                                   GdbResultDone)) {
-        QByteArray rsp = GdbResponse::stringFromResultClass(response->resultClass);
-        rsp = "UNEXPECTED RESPONSE " + rsp + " TO COMMAND" + cmd.command;
-        qWarning() << rsp << " AT " __FILE__ ":" STRINGIFY(__LINE__);
-        debugMessage(_(rsp));
+#ifdef Q_OS_WIN
+        // Ignore spurious 'running' responses to 'attach'
+        const bool warning = !(m_startParameters->startMode == AttachExternal
+                               && cmd.command.startsWith("attach"));
+#else
+        const bool warning = true;
+#endif
+        if (warning) {
+            QByteArray rsp = GdbResponse::stringFromResultClass(response->resultClass);
+            rsp = "UNEXPECTED RESPONSE '" + rsp + "' TO COMMAND '" + cmd.command + "'";
+            qWarning() << rsp << " AT " __FILE__ ":" STRINGIFY(__LINE__);
+            debugMessage(_(rsp));
+        }
     } else {
         if (cmd.callback)
             (this->*cmd.callback)(*response);
-- 
GitLab