diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index e27ee38940c68e9be836929a1c5326ceb30d04d4..984531ed11610e64762f4d787e1b672be4158dd5 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1153,6 +1153,33 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
     }
     setState(InferiorStopped);
 
+    // Due to LD_PRELOADing the dumpers, these events can occur even before
+    // reaching the entry point. So handle it before the entry point hacks below.
+    if (reason.isEmpty() && m_gdbVersion < 70000 && !m_isMacGdb) {
+        // On Linux it reports "Stopped due to shared library event\n", but
+        // on Windows it simply forgets about it. Thus, we identify the response
+        // based on it having no frame information.
+        if (!data.findChild("frame").isValid()) {
+            m_modulesListOutdated = m_sourcesListOutdated = true;
+            // Each stop causes a roundtrip and button flicker, so prevent
+            // a flood of useless stops. Will be automatically re-enabled.
+            postCommand(_("set stop-on-solib-events 0"));
+#if 0
+            // The related code (handleAqcuiredInferior()) is disabled as well.
+            if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) {
+                QString dataStr = _(data.toString());
+                debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
+                QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern);
+                debugMessage(_("PATTERN: ") + pat);
+                postCommand(_("sharedlibrary ") + pat);
+                showStatusMessage(tr("Loading %1...").arg(dataStr));
+            }
+#endif
+            continueInferiorInternal();
+            return;
+        }
+    }
+
 #ifdef Q_OS_LINUX
     if (!m_entryPoint.isEmpty()) {
         GdbMi frameData = data.findChild("frame");
@@ -1178,27 +1205,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
     }
 #endif
 
-#if 0
-    // The related code (handleAqcuiredInferior()) is disabled as well.
-    // When re-enabling, try something to avoid spurious source list updates
-    // due to unrelated no-reason stops.
-    const QByteArray &msg = data.findChild("consolestreamoutput").data();
-    if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
-        m_modulesListOutdated = m_sourcesListOutdated = true;
-        if (theDebuggerBoolSetting(SelectedPluginBreakpoints)) {
-            QString dataStr = _(data.toString());
-            debugMessage(_("SHARED LIBRARY EVENT: ") + dataStr);
-            QString pat = theDebuggerStringSetting(SelectedPluginBreakpointsPattern);
-            debugMessage(_("PATTERN: ") + pat);
-            postCommand(_("sharedlibrary ") + pat);
-            continueInferiorInternal();
-            showStatusMessage(tr("Loading %1...").arg(dataStr));
-            return;
-        }
-        // fall through
-    }
-#endif
-
     // seen on XP after removing a breakpoint while running
     //  >945*stopped,reason="signal-received",signal-name="SIGTRAP",
     //  signal-meaning="Trace/breakpoint trap",thread-id="2",
@@ -1269,11 +1275,6 @@ void GdbEngine::handleStop1(const GdbMi &data)
     if (m_sourcesListOutdated)
         reloadSourceFilesInternal(); // This needs to be done before fullName() may need it
 
-    // Older gdb versions do not produce "library loaded" messages
-    // so the breakpoint update is not triggered.
-    if (m_gdbVersion < 70000 && !m_isMacGdb)
-        postCommand(_("-break-list"), CB(handleBreakList));
-
     QByteArray reason = data.findChild("reason").data();
     if (reason == "breakpoint-hit") {
         showStatusMessage(tr("Stopped at breakpoint."));
@@ -2249,6 +2250,8 @@ void GdbEngine::reloadModulesInternal()
 {
     m_modulesListOutdated = false;
     postCommand(_("info shared"), NeedsStop, CB(handleModulesList));
+    if (m_gdbVersion < 70000 && !m_isMacGdb)
+        postCommand(_("set stop-on-solib-events 1"));
 }
 
 void GdbEngine::handleModulesList(const GdbResponse &response)
@@ -2317,6 +2320,8 @@ void GdbEngine::reloadSourceFilesInternal()
     m_sourcesListOutdated = false;
     postCommand(_("-file-list-exec-source-files"), NeedsStop, CB(handleQuerySources));
     postCommand(_("-break-list"), CB(handleBreakList));
+    if (m_gdbVersion < 70000 && !m_isMacGdb)
+        postCommand(_("set stop-on-solib-events 1"));
 }