From 0f4765b8af6507ca52d9cdea7fc9b9afd7005dff Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Tue, 23 Nov 2010 15:54:57 +0100
Subject: [PATCH] debugger: revert the decision to not update the location
 marker early.

---
 src/plugins/debugger/gdb/gdbengine.cpp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 1adfe7d854d..57f962be8ce 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1166,8 +1166,13 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
     const int bkptno = data.findChild("bkptno").data().toInt();
     const GdbMi frame = data.findChild("frame");
 
+    const int lineNumber = frame.findChild("line").data().toInt();
+    QString fullName = QString::fromUtf8(frame.findChild("fullname").data());
+    if (fullName.isEmpty())
+        fullName = QString::fromUtf8(frame.findChild("file").data());
+
     if (bkptno && frame.isValid()) {
-        // Use opportunity to update the marker position.
+        // Use opportunity to update the breakpoint marker position.
         BreakHandler *handler = breakHandler();
         BreakpointId id = handler->findBreakpointByNumber(bkptno);
         const BreakpointResponse &response = handler->response(id);
@@ -1175,15 +1180,15 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
         if (fileName.isEmpty())
             fileName = handler->fileName(id);
         if (fileName.isEmpty())
-            fileName = QString::fromUtf8(frame.findChild("fullname").data());
-        if (fileName.isEmpty())
-            fileName = QString::fromUtf8(frame.findChild("file").data());
-        if (!fileName.isEmpty()) {
-            int lineNumber = frame.findChild("line").data().toInt();
+            fileName = fullName;
+        if (!fileName.isEmpty())
             handler->setMarkerFileAndLine(id, fileName, lineNumber);
-        }
     }
 
+    // Quickly set the location marker.
+    if (lineNumber && QFileInfo(fullName).exists())
+        debuggerCore()->gotoLocation(fullName, lineNumber, true);
+
     if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
         QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state())
         notifyInferiorStopOk();
@@ -1296,7 +1301,6 @@ void GdbEngine::handleStop0(const GdbMi &data)
     static int stepCounter = 0;
     if (debuggerCore()->boolSetting(SkipKnownFrames)) {
         if (reason == "end-stepping-range" || reason == "function-finished") {
-            GdbMi frame = data.findChild("frame");
             //showMessage(frame.toString());
             QString funcName = _(frame.findChild("func").data());
             QString fileName = QString::fromLocal8Bit(frame.findChild("file").data());
-- 
GitLab