From 885df811c44400e5c48fccc3b498d1b6217d94e2 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Mon, 4 Jul 2011 13:37:01 +0200
Subject: [PATCH] debugger: don't duplicated "full name" information in break
 response

Less information to keep in sync.

Change-Id: Icd862bbf8965eefd8ea3ad17b6f574b1f85bb8d2
Reviewed-on: http://codereview.qt.nokia.com/1069
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
---
 src/plugins/debugger/breakhandler.cpp      |  6 +++---
 src/plugins/debugger/breakpoint.cpp        |  3 ---
 src/plugins/debugger/breakpoint.h          |  1 -
 src/plugins/debugger/debuggerstreamops.cpp |  2 --
 src/plugins/debugger/gdb/gdbengine.cpp     | 16 +++++++++++-----
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index ad912ac9d4b..8e73a8fbfd8 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -1269,10 +1269,10 @@ const BreakpointResponse &BreakHandler::response(BreakpointModelId id) const
 {
     static BreakpointResponse dummy;
     ConstIterator it = m_storage.find(id);
-    BREAK_ASSERT(it != m_storage.end(),
-        qDebug() << "NO RESPONSE FOR " << id; return dummy);
-    if (it == m_storage.end())
+    if (it == m_storage.end()) {
+        qDebug() << "NO RESPONSE FOR " << id;
         return dummy;
+    }
     return it->response;
 }
 
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index 4c0983d1ddf..f348cf45c24 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -317,8 +317,6 @@ QString BreakpointResponse::toString() const
     ts << " Number: " << id.toString();
     if (pending)
         ts << " [pending]";
-    if (!fullName.isEmpty())
-        ts << " FullName: " << fullName;
     if (!functionName.isEmpty())
         ts << " Function: " << functionName;
     if (multiple)
@@ -334,7 +332,6 @@ void BreakpointResponse::fromParameters(const BreakpointParameters &p)
 {
     BreakpointParameters::operator=(p);
     id = BreakpointResponseId();
-    fullName.clear();
     multiple = false;
     correctedLineNumber = 0;
     hitCount = 0;
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h
index c1c2c3074e9..82831320369 100644
--- a/src/plugins/debugger/breakpoint.h
+++ b/src/plugins/debugger/breakpoint.h
@@ -246,7 +246,6 @@ public:
     BreakpointResponseId id; //!< Breakpoint number assigned by the debugger engine.
     bool pending;            //!< Breakpoint not fully resolved.
     int hitCount;            //!< Number of times this has been hit.
-    QString fullName;        //!< Full file name acknowledged by the debugger engine.
     bool multiple;           //!< Happens in constructors/gdb.
     int correctedLineNumber; //!< Line number as seen by gdb.
 };
diff --git a/src/plugins/debugger/debuggerstreamops.cpp b/src/plugins/debugger/debuggerstreamops.cpp
index 81cb608b2a0..7aec95d12cd 100644
--- a/src/plugins/debugger/debuggerstreamops.cpp
+++ b/src/plugins/debugger/debuggerstreamops.cpp
@@ -151,7 +151,6 @@ QDataStream &operator<<(QDataStream &stream, const BreakpointResponse &s)
     stream << s.condition;
     stream << s.ignoreCount;
     stream << s.fileName;
-    stream << s.fullName;
     stream << s.lineNumber;
     //stream << s.bpCorrectedLineNumber;
     stream << s.threadSpec;
@@ -169,7 +168,6 @@ QDataStream &operator>>(QDataStream &stream, BreakpointResponse &s)
     stream >> s.condition;
     stream >> s.ignoreCount;
     stream >> s.fileName;
-    stream >> s.fullName;
     stream >> s.lineNumber;
     //stream >> s.bpCorrectedLineNumber;
     stream >> s.threadSpec;
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index e95f4a42770..2227b12ae30 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -2504,13 +2504,19 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
     BreakHandler *handler = breakHandler();
     BreakpointModelId id = response.cookie.value<BreakpointModelId>();
     if (response.resultClass == GdbResultDone) {
-        const GdbMi bkpt = response.data.findChild("bkpt");
-        const BreakpointResponseId rid(bkpt.findChild("number").data());
+        // The result is a list with the first entry marked "bkpt"
+        // and "unmarked" rest. The "bkpt" one seems to always be
+        // the "main" entry. Use the "main" entry to retrieve the
+        // already known data from the BreakpointManager, and then
+        // iterate over all items to update main- and sub-data.
+        const GdbMi mainbkpt = response.data.findChild("bkpt");
+        QByteArray nr = mainbkpt.findChild("number").data();
+        BreakpointResponseId rid(nr);
         if (!isHiddenBreakpoint(rid)) {
             BreakpointResponse br = handler->response(id);
             foreach (const GdbMi bkpt, response.data.children()) {
-                QByteArray nr = bkpt.findChild("number").data();
-                BreakpointResponseId rid(nr);
+                nr = bkpt.findChild("number").data();
+                rid = BreakpointResponseId(nr);
                 if (nr.contains('.')) {
                     // A sub-breakpoint.
                     BreakpointResponse sub;
@@ -2519,7 +2525,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
                     sub.type = br.type;
                     handler->insertSubBreakpoint(id, sub);
                 } else {
-                    // A primary breakpoint.
+                    // A (the?) primary breakpoint.
                     updateResponse(br, bkpt);
                     br.id = rid;
                     handler->setResponse(id, br);
-- 
GitLab