aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-05-06 16:26:55 +0200
committerhjk <hjk@qt.io>2022-05-09 13:24:12 +0000
commit0a875d40ba9a518a2bbc81f5c30075f25566e0fa (patch)
tree00b98ea355af84f170747fb4cf6656425a226747
parent026126eed04443d427b297787e6cd6036d03a3a9 (diff)
ProjectExplorer: Always compile WinDebugInterface
Makes it easier to re-shuffle calling code on non-Windows. Change-Id: Ia6d7e313e9eb42fc7b19a469c1a6f33d226d1e88 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/projectexplorer/CMakeLists.txt2
-rw-r--r--src/plugins/projectexplorer/applicationlauncher.cpp56
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp6
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs3
-rw-r--r--src/plugins/projectexplorer/windebuginterface.cpp14
-rw-r--r--src/plugins/projectexplorer/windebuginterface.h3
6 files changed, 39 insertions, 45 deletions
diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt
index 07c0fa0679..f24aba8244 100644
--- a/src/plugins/projectexplorer/CMakeLists.txt
+++ b/src/plugins/projectexplorer/CMakeLists.txt
@@ -180,6 +180,7 @@ add_qtc_plugin(ProjectExplorer
userfileaccessor.cpp userfileaccessor.h
vcsannotatetaskhandler.cpp vcsannotatetaskhandler.h
waitforstopdialog.cpp waitforstopdialog.h
+ windebuginterface.cpp windebuginterface.h
xcodebuildparser.cpp xcodebuildparser.h
)
@@ -197,7 +198,6 @@ extend_qtc_plugin(ProjectExplorer
extend_qtc_plugin(ProjectExplorer
CONDITION WIN32
- SOURCES windebuginterface.cpp windebuginterface.h
DEFINES UNICODE _UNICODE
)
diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp
index 9226274c65..09ff09332c 100644
--- a/src/plugins/projectexplorer/applicationlauncher.cpp
+++ b/src/plugins/projectexplorer/applicationlauncher.cpp
@@ -24,10 +24,12 @@
****************************************************************************/
#include "applicationlauncher.h"
-#ifdef Q_OS_WIN
+
+#include "devicesupport/desktopdevice.h"
+#include "projectexplorer.h"
+#include "projectexplorersettings.h"
+#include "runcontrol.h"
#include "windebuginterface.h"
-#include <qt_windows.h>
-#endif
#include <coreplugin/icore.h>
@@ -36,11 +38,6 @@
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
-#include "devicesupport/desktopdevice.h"
-#include "projectexplorer.h"
-#include "projectexplorersettings.h"
-#include "runcontrol.h"
-
#include <QTextCodec>
#include <QTimer>
@@ -83,8 +80,6 @@ public:
void handleDone();
// Local
- void cannotRetrieveLocalDebugOutput();
- void checkLocalDebugOutput(qint64 pid, const QString &message);
qint64 applicationPID() const;
bool isRunning() const;
@@ -131,12 +126,20 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare
connect(&m_process, &QtcProcess::readyReadStandardOutput,
this, &ApplicationLauncherPrivate::handleStandardOutput);
-#ifdef Q_OS_WIN
- connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput,
- this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput);
- connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput,
- this, &ApplicationLauncherPrivate::checkLocalDebugOutput);
-#endif
+ if (WinDebugInterface::instance()) {
+ connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput,
+ this, [this] {
+ disconnect(WinDebugInterface::instance(), nullptr, this, nullptr);
+ emit q->appendMessage(ApplicationLauncher::tr("Cannot retrieve debugging output.")
+ + QLatin1Char('\n'), ErrorMessageFormat);
+ });
+
+ connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput,
+ this, [this](qint64 pid, const QString &message) {
+ if (applicationPID() == pid)
+ emit q->appendMessage(message, DebugFormat);
+ });
+ }
}
ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent),
@@ -282,21 +285,6 @@ void ApplicationLauncherPrivate::handleStandardError()
emit q->appendMessage(msg, StdErrFormat, false);
}
-void ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput()
-{
-#ifdef Q_OS_WIN
- disconnect(WinDebugInterface::instance(), nullptr, this, nullptr);
- emit q->appendMessage(ApplicationLauncher::tr("Cannot retrieve debugging output.")
- + QLatin1Char('\n'), ErrorMessageFormat);
-#endif
-}
-
-void ApplicationLauncherPrivate::checkLocalDebugOutput(qint64 pid, const QString &message)
-{
- if (applicationPID() == pid)
- emit q->appendMessage(message, DebugFormat);
-}
-
int ApplicationLauncher::exitCode() const
{
return d->m_resultData.m_exitCode;
@@ -335,10 +323,8 @@ void ApplicationLauncherPrivate::start()
m_process.setEnvironment(env);
m_processRunning = true;
- #ifdef Q_OS_WIN
- if (!WinDebugInterface::instance()->isRunning())
- WinDebugInterface::instance()->start(); // Try to start listener again...
- #endif
+
+ WinDebugInterface::startIfNeeded();
CommandLine cmdLine = m_runnable.command;
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp
index d7bba925f1..380ec9f071 100644
--- a/src/plugins/projectexplorer/appoutputpane.cpp
+++ b/src/plugins/projectexplorer/appoutputpane.cpp
@@ -794,14 +794,12 @@ void AppOutputPane::slotRunControlFinished2(RunControl *sender)
ProjectExplorerPlugin::updateRunActions();
-#ifdef Q_OS_WIN
const bool isRunning = Utils::anyOf(m_runControlTabs, [](const RunControlTab &rt) {
return rt.runControl && rt.runControl->isRunning();
});
- if (!isRunning)
- WinDebugInterface::instance()->stop();
-#endif
+ if (!isRunning)
+ WinDebugInterface::stop();
}
bool AppOutputPane::canNext() const
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 2a75a32738..a9a865a3ec 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -159,6 +159,7 @@ Project {
"userfileaccessor.cpp", "userfileaccessor.h",
"vcsannotatetaskhandler.cpp", "vcsannotatetaskhandler.h",
"waitforstopdialog.cpp", "waitforstopdialog.h",
+ "windebuginterface.cpp", "windebuginterface.h",
"xcodebuildparser.cpp", "xcodebuildparser.h"
]
}
@@ -242,8 +243,6 @@ Project {
files: [
"msvctoolchain.cpp",
"msvctoolchain.h",
- "windebuginterface.cpp",
- "windebuginterface.h",
]
}
diff --git a/src/plugins/projectexplorer/windebuginterface.cpp b/src/plugins/projectexplorer/windebuginterface.cpp
index e9fdb939a5..59091e8ebc 100644
--- a/src/plugins/projectexplorer/windebuginterface.cpp
+++ b/src/plugins/projectexplorer/windebuginterface.cpp
@@ -56,9 +56,9 @@ WinDebugInterface *WinDebugInterface::instance()
bool WinDebugInterface::stop()
{
- if (!m_waitHandles[TerminateEventHandle])
+ if (!m_instance->m_waitHandles[TerminateEventHandle])
return false;
- SetEvent(m_waitHandles[TerminateEventHandle]);
+ SetEvent(m_instance->m_waitHandles[TerminateEventHandle]);
return true;
}
@@ -198,6 +198,12 @@ void WinDebugInterface::dispatchDebugOutput()
emit _q_debugOutputReady();
}
+void WinDebugInterface::startIfNeeded()
+{
+ if (!m_instance->isRunning())
+ m_instance->start();
+}
+
} // namespace Internal
} // namespace ProjectExplorer
@@ -222,6 +228,10 @@ void WinDebugInterface::emitReadySignal() { }
void WinDebugInterface::dispatchDebugOutput() { }
+bool WinDebugInterface::stop() { return false; }
+
+void WinDebugInterface::startIfNeeded() { }
+
} // namespace Internal
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/windebuginterface.h b/src/plugins/projectexplorer/windebuginterface.h
index e459394038..61bd049821 100644
--- a/src/plugins/projectexplorer/windebuginterface.h
+++ b/src/plugins/projectexplorer/windebuginterface.h
@@ -45,7 +45,8 @@ public:
static WinDebugInterface *instance();
- bool stop();
+ static bool stop();
+ static void startIfNeeded();
signals:
void debugOutput(qint64 pid, const QString &message);