summarylogtreecommitdiffstats
path: root/attach.patch
blob: 4d46bc38a1c478656c58b350c3c45b34f93f18df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index d67c6362..10a1ac57 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -122,6 +122,7 @@
 
 #include <extensionsystem/pluginmanager.h>
 #include <extensionsystem/pluginspec.h>
+#include <extensionsystem/invoker.h>
 
 #include <texteditor/findinfiles.h>
 #include <texteditor/tabsettings.h>
@@ -3012,6 +3013,16 @@ static bool hasDeploySettings(Project *pro)
 
 void ProjectExplorerPlugin::runProject(Project *pro, Id mode, const bool forceSkipDeploy)
 {
+    for (auto *rc : ProjectExplorerPlugin::instance()->allRunControls()) {
+        if (rc->isRunning() && rc->project() == pro &&
+            mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) {
+            ExtensionSystem::Invoker<void>(
+                ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin"),
+                "attachExternalApplication", rc);
+            return;
+        }
+    }
+
     if (RunConfiguration *rc = activeRunConfig(pro))
         runRunConfiguration(rc, mode, forceSkipDeploy);
 }