From 6a05f778aff93b047f097b39fde1e4ab7c1884b8 Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Thu, 28 Jan 2010 18:26:06 +0100
Subject: [PATCH] Fix setting breakpoints in running application.

It's a hack. More proper solution to come.

Done-with: hjk
---
 src/plugins/debugger/gdb/gdbengine.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 81e463e16d4..9ea8aaf6739 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -2201,7 +2201,24 @@ void GdbEngine::attemptBreakpointSynchronization()
     // For best results, we rely on an up-to-date fullname mapping.
     // The listing completion will retrigger us, so no futher action is needed.
     if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints)) {
-        reloadSourceFilesInternal();
+        if (state() == InferiorRunning) {
+            // FIXME: this is a hack
+            // The hack solves the problem that we want both commands
+            // (reloadSourceFiles and reloadBreakList) to be executed
+            // within the same stop-executecommand-continue cycle.
+            // Just calling reloadSourceFiles and reloadBreakList doesn't work
+            // in this case, because a) stopping the executable is asyncronous,
+            // b) we wouldn't want to stop-exec-continue twice
+            m_sourcesListUpdating = true;
+            GdbCommand cmd;
+            cmd.command = "-file-list-exec-source-files";
+            cmd.flags = NoFlags;
+            cmd.callback = &GdbEngine::handleQuerySources;
+            cmd.callbackName = "";
+            m_commandsToRunOnTemporaryBreak.append(cmd);
+        } else {
+            reloadSourceFilesInternal();
+        }
         reloadBreakListInternal();
         return;
     }
-- 
GitLab