From 0e25fb6ec5b2f74918753009f801d14a69e81a32 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Tue, 24 Feb 2009 16:23:50 +0100
Subject: [PATCH] make initial breakpoint finding work on mac

unlike the upstream gdb, the mac one gives an MI response to "info
target" when in MI mode.
---
 src/plugins/debugger/gdbengine.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index 151b269c7e7..d6396563aee 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -1688,6 +1688,17 @@ void GdbEngine::continueInferior()
 void GdbEngine::handleStart(const GdbResultRecord &response)
 {
     if (response.resultClass == GdbResultDone) {
+#ifdef Q_OS_MAC
+        QString addr = response.data.findChild("section-info").findChild("entry-point").data();
+        if (!addr.isEmpty()) {
+            sendCommand("tbreak *" + addr);
+            m_waitingForFirstBreakpointToBeHit = true;
+            qq->notifyInferiorRunningRequested();
+            sendCommand("-exec-run");
+        } else {
+            debugMessage("CANNOT OBTAIN START ADDRESS");
+        }
+#else
         // [some leading stdout here]
         // stdout:&"        Entry point: 0x80831f0  0x08048134 - 0x08048147 is .interp\n"
         // [some trailing stdout here]
@@ -1702,6 +1713,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
         } else {
             debugMessage("PARSING START ADDRESS FAILED: " + msg);
         }
+#endif
     } else if (response.resultClass == GdbResultError) {
         debugMessage("FETCHING START ADDRESS FAILED: " + response.toString());
     }
-- 
GitLab