From 5a73440b187a13bf5aa0b1d6aa77b7afa1f6c2ae Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Fri, 2 Oct 2009 14:31:38 +0200
Subject: [PATCH] debugger: fix gotoLocation() on Mac

Mac's "stopped" message does not come with location data.
---
 src/plugins/debugger/gdb/gdbengine.cpp | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 1ed1a70f34f..74c9b61ef68 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -2296,12 +2296,21 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
         theDebuggerAction(ExpandStack)->setEnabled(canExpand);
         manager()->stackHandler()->setFrames(stackFrames, canExpand);
 
-        if (topFrame != -1 && topFrame != 0
-                && !theDebuggerBoolSetting(OperateByInstruction)) {
-            // For topFrame == -1 there is no frame at all, for topFrame == 0
-            // we already issued a 'gotoLocation' when reading the *stopped
-            // message. Also, when OperateByInstruction we always want to
-            // use frame #0.
+        #ifdef Q_OS_MAC
+        // Mac gdb does not add the location to the "stopped" message,
+        // so the early gotoLocation() was not triggered. Force it here.
+        bool jump = topFrame != -1
+            && !theDebuggerBoolSetting(OperateByInstruction);
+        #else
+        // For topFrame == -1 there is no frame at all, for topFrame == 0
+        // we already issued a 'gotoLocation' when reading the *stopped
+        // message. Also, when OperateByInstruction we always want to
+        // use frame #0.
+        bool jump = topFrame != -1 && topFrame != 0
+            && !theDebuggerBoolSetting(OperateByInstruction);
+        #endif
+        
+        if (jump) {
             const StackFrame &frame = manager()->stackHandler()->currentFrame();
             qDebug() << "GOTO, 2nd try" << frame.toString() << topFrame;
             gotoLocation(frame, true);
-- 
GitLab