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>
This commit is contained in:
hjk
2022-05-06 16:26:55 +02:00
parent 026126eed0
commit 0a875d40ba
6 changed files with 39 additions and 45 deletions

View File

@@ -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
)

View File

@@ -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
if (WinDebugInterface::instance()) {
connect(WinDebugInterface::instance(), &WinDebugInterface::cannotRetrieveDebugOutput,
this, &ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput);
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, &ApplicationLauncherPrivate::checkLocalDebugOutput);
#endif
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;

View File

@@ -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

View File

@@ -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",
]
}

View File

@@ -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

View File

@@ -45,7 +45,8 @@ public:
static WinDebugInterface *instance();
bool stop();
static bool stop();
static void startIfNeeded();
signals:
void debugOutput(qint64 pid, const QString &message);