From 1610c14d22b2954569b5761a2e658bec4a678cb5 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Fri, 9 Oct 2009 10:59:56 +0200
Subject: [PATCH] make direct call of handleStop1() more elegant

---
 src/plugins/debugger/gdb/gdbengine.cpp | 13 +++++++------
 src/plugins/debugger/gdb/gdbengine.h   |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 0007d9db9e3..7ad671eddae 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1110,8 +1110,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
     }
 
     if (isStoppedReason(reason) || reason.isEmpty()) {
-        QVariant var = QVariant::fromValue<GdbMi>(data);
-
         // Don't load helpers on stops triggered by signals unless it's
         // an intentional trap.
         bool initHelpers = m_debuggingHelperState == DebuggingHelperUninitialized;
@@ -1121,11 +1119,10 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
             
         if (initHelpers) {
             tryLoadDebuggingHelpers();
+            QVariant var = QVariant::fromValue<GdbMi>(data);
             postCommand(_("p 4"), CB(handleStop1), var);  // dummy
         } else {
-            GdbResponse response;
-            response.cookie = var;
-            handleStop1(response);
+            handleStop1(data);
         }
         return;
     }
@@ -1153,7 +1150,11 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
 
 void GdbEngine::handleStop1(const GdbResponse &response)
 {
-    GdbMi data = response.cookie.value<GdbMi>();
+    handleStop1(response.cookie.value<GdbMi>());
+}
+
+void GdbEngine::handleStop1(const GdbMi &data)
+{
     QByteArray reason = data.findChild("reason").data();
     if (m_modulesListOutdated) {
         reloadModules();
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index a0b74f199e4..eb16b9fd8c4 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -259,6 +259,7 @@ private:
     void handleStart(const GdbResponse &response);
     void handleStopResponse(const GdbMi &data);
     void handleStop1(const GdbResponse &response);
+    void handleStop1(const GdbMi &data);
     void handleStop2(const GdbResponse &response);
     void handleStop2(const GdbMi &data);
     void handleResultRecord(const GdbResponse &response);
-- 
GitLab