forked from qt-creator/qt-creator
ProjectExplorer: Merge ApplicationLauncher and DeviceApplicationRunner
Treat ApplicationLauncher as a special case of a DeviceApplicationRunner with an implicit desktop device. As a first step, lump the two implementations together. Change-Id: Ifa3ea3f38d320023050378555e2d256e762b6683 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -45,7 +44,7 @@ namespace Internal {
|
||||
|
||||
BareMetalDebugSupport::BareMetalDebugSupport(Debugger::DebuggerRunControl *runControl)
|
||||
: QObject(runControl)
|
||||
, m_appRunner(new ProjectExplorer::DeviceApplicationRunner(this))
|
||||
, m_appLauncher(new ProjectExplorer::ApplicationLauncher(this))
|
||||
, m_runControl(runControl)
|
||||
, m_state(BareMetalDebugSupport::Inactive)
|
||||
{
|
||||
@@ -156,17 +155,17 @@ void BareMetalDebugSupport::startExecution()
|
||||
m_state = StartingRunner;
|
||||
showMessage(tr("Starting GDB server...") + QLatin1Char('\n'), Debugger::LogStatus);
|
||||
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::remoteStderr,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStderr,
|
||||
this, &BareMetalDebugSupport::remoteErrorOutputMessage);
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::remoteStdout,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStdout,
|
||||
this, &BareMetalDebugSupport::remoteOutputMessage);
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteProcessStarted,
|
||||
this, &BareMetalDebugSupport::remoteProcessStarted);
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::finished,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::finished,
|
||||
this, &BareMetalDebugSupport::appRunnerFinished);
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::reportProgress,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportProgress,
|
||||
this, &BareMetalDebugSupport::progressReport);
|
||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::reportError,
|
||||
connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportError,
|
||||
this, &BareMetalDebugSupport::appRunnerError);
|
||||
|
||||
StandardRunnable r;
|
||||
@@ -175,7 +174,7 @@ void BareMetalDebugSupport::startExecution()
|
||||
// as the bare metal's GDB servers are launched on a host,
|
||||
// but not on a target.
|
||||
r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::HostOsInfo::hostOs());
|
||||
m_appRunner->start(r, dev);
|
||||
m_appLauncher->start(r, dev);
|
||||
}
|
||||
|
||||
void BareMetalDebugSupport::setFinished()
|
||||
@@ -183,13 +182,13 @@ void BareMetalDebugSupport::setFinished()
|
||||
if (m_state == Inactive)
|
||||
return;
|
||||
if (m_state == Running)
|
||||
m_appRunner->stop();
|
||||
m_appLauncher->stop();
|
||||
m_state = Inactive;
|
||||
}
|
||||
|
||||
void BareMetalDebugSupport::reset()
|
||||
{
|
||||
m_appRunner->disconnect(this);
|
||||
m_appLauncher->disconnect(this);
|
||||
m_state = Inactive;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace Debugger { class DebuggerRunControl; }
|
||||
|
||||
namespace ProjectExplorer { class DeviceApplicationRunner; }
|
||||
namespace ProjectExplorer { class ApplicationLauncher; }
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
void reset();
|
||||
void showMessage(const QString &msg, int channel);
|
||||
|
||||
ProjectExplorer::DeviceApplicationRunner *m_appRunner;
|
||||
ProjectExplorer::ApplicationLauncher *m_appLauncher;
|
||||
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
||||
BareMetalDebugSupport::State m_state;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "iossimulator.h"
|
||||
#include "iosconstants.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
@@ -26,25 +26,24 @@
|
||||
#include "applicationlauncher.h"
|
||||
#ifdef Q_OS_WIN
|
||||
#include "windebuginterface.h"
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/consoleprocess.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "devicesupport/deviceprocess.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "runnables.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QTimer>
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::ApplicationLauncher
|
||||
|
||||
@@ -63,11 +62,18 @@ using namespace ProjectExplorer::Internal;
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
enum State { Inactive, Run };
|
||||
|
||||
class ApplicationLauncherPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
explicit ApplicationLauncherPrivate(ApplicationLauncher *parent);
|
||||
~ApplicationLauncherPrivate() { setFinished(); }
|
||||
|
||||
void start(const Runnable &runnable, const IDevice::ConstPtr &device, bool local);
|
||||
void stop();
|
||||
|
||||
// Local
|
||||
void handleProcessStarted();
|
||||
void localGuiProcessError();
|
||||
void localConsoleProcessError(const QString &error);
|
||||
@@ -77,14 +83,23 @@ public:
|
||||
void checkLocalDebugOutput(qint64 pid, const QString &message);
|
||||
void localProcessDone(int, QProcess::ExitStatus);
|
||||
void bringToForeground();
|
||||
void localStop();
|
||||
void localStart(const StandardRunnable &runnable);
|
||||
qint64 applicationPID() const;
|
||||
bool isRunning() const;
|
||||
|
||||
// Remote
|
||||
void doReportError(const QString &message);
|
||||
void handleRemoteStderr();
|
||||
void handleRemoteStdout();
|
||||
void handleApplicationFinished();
|
||||
void setFinished();
|
||||
void handleApplicationError(QProcess::ProcessError error);
|
||||
|
||||
public:
|
||||
ApplicationLauncher *q;
|
||||
|
||||
bool m_isLocal = true;
|
||||
|
||||
// Local
|
||||
QtcProcess m_guiProcess;
|
||||
ConsoleProcess m_consoleProcess;
|
||||
ApplicationLauncher::Mode m_currentMode = ApplicationLauncher::Gui;
|
||||
@@ -96,6 +111,12 @@ public:
|
||||
QTextCodec::ConverterState m_errorCodecState;
|
||||
|
||||
qint64 m_listeningPid = 0;
|
||||
|
||||
// Remote
|
||||
DeviceProcess *m_deviceProcess = nullptr;
|
||||
State m_state = Inactive;
|
||||
bool m_stopRequested = false;
|
||||
bool m_success = false;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
@@ -156,53 +177,39 @@ void ApplicationLauncher::setProcessChannelMode(QProcess::ProcessChannelMode mod
|
||||
d->m_guiProcess.setProcessChannelMode(mode);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start(const Runnable &runnable)
|
||||
{
|
||||
d->localStart(runnable.as<StandardRunnable>());
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::localStart(const StandardRunnable &runnable)
|
||||
{
|
||||
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
|
||||
const QString fixedPath = FileUtils::normalizePathName(runnable.workingDirectory);
|
||||
m_guiProcess.setWorkingDirectory(fixedPath);
|
||||
m_consoleProcess.setWorkingDirectory(fixedPath);
|
||||
m_guiProcess.setEnvironment(runnable.environment);
|
||||
m_consoleProcess.setEnvironment(runnable.environment);
|
||||
|
||||
m_processRunning = true;
|
||||
#ifdef Q_OS_WIN
|
||||
if (!WinDebugInterface::instance()->isRunning())
|
||||
WinDebugInterface::instance()->start(); // Try to start listener again...
|
||||
#endif
|
||||
|
||||
m_currentMode = runnable.runMode;
|
||||
if (m_currentMode == ApplicationLauncher::Gui) {
|
||||
m_guiProcess.setCommand(runnable.executable, runnable.commandLineArguments);
|
||||
m_guiProcess.start();
|
||||
} else {
|
||||
m_consoleProcess.start(runnable.executable, runnable.commandLineArguments);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationLauncher::stop()
|
||||
{
|
||||
d->localStop();
|
||||
d->stop();
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::localStop()
|
||||
void ApplicationLauncherPrivate::stop()
|
||||
{
|
||||
if (!isRunning())
|
||||
return;
|
||||
if (m_currentMode == ApplicationLauncher::Gui) {
|
||||
m_guiProcess.terminate();
|
||||
if (!m_guiProcess.waitForFinished(1000) && m_guiProcess.state() == QProcess::Running) { // This is blocking, so be fast.
|
||||
m_guiProcess.kill();
|
||||
m_guiProcess.waitForFinished();
|
||||
if (m_isLocal) {
|
||||
if (!isRunning())
|
||||
return;
|
||||
if (m_currentMode == ApplicationLauncher::Gui) {
|
||||
m_guiProcess.terminate();
|
||||
if (!m_guiProcess.waitForFinished(1000) && m_guiProcess.state() == QProcess::Running) { // This is blocking, so be fast.
|
||||
m_guiProcess.kill();
|
||||
m_guiProcess.waitForFinished();
|
||||
}
|
||||
} else {
|
||||
m_consoleProcess.stop();
|
||||
localProcessDone(0, QProcess::CrashExit);
|
||||
}
|
||||
} else {
|
||||
m_consoleProcess.stop();
|
||||
localProcessDone(0, QProcess::CrashExit);
|
||||
if (m_stopRequested)
|
||||
return;
|
||||
m_stopRequested = true;
|
||||
m_success = false;
|
||||
emit q->reportProgress(ApplicationLauncher::tr("User requested stop. Shutting down..."));
|
||||
switch (m_state) {
|
||||
case Run:
|
||||
m_deviceProcess->terminate();
|
||||
break;
|
||||
case Inactive:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,14 +263,14 @@ void ApplicationLauncherPrivate::localGuiProcessError()
|
||||
QProcess::ExitStatus status = QProcess::NormalExit;
|
||||
switch (m_guiProcess.error()) {
|
||||
case QProcess::FailedToStart:
|
||||
error = tr("Failed to start program. Path or permissions wrong?");
|
||||
error = ApplicationLauncher::tr("Failed to start program. Path or permissions wrong?");
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
error = tr("The program has unexpectedly finished.");
|
||||
error = ApplicationLauncher::tr("The program has unexpectedly finished.");
|
||||
status = QProcess::CrashExit;
|
||||
break;
|
||||
default:
|
||||
error = tr("Some error has occurred while running the program.");
|
||||
error = ApplicationLauncher::tr("Some error has occurred while running the program.");
|
||||
}
|
||||
emit q->appendMessage(error + QLatin1Char('\n'), ErrorMessageFormat);
|
||||
if (m_processRunning && !isRunning()) {
|
||||
@@ -330,4 +337,141 @@ void ApplicationLauncherPrivate::handleProcessStarted()
|
||||
emit q->processStarted();
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start(const Runnable &runnable)
|
||||
{
|
||||
d->start(runnable, IDevice::ConstPtr(), true);
|
||||
}
|
||||
|
||||
void ApplicationLauncher::start(const Runnable &runnable, const IDevice::ConstPtr &device)
|
||||
{
|
||||
d->start(runnable, device, false);
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice::ConstPtr &device, bool local)
|
||||
{
|
||||
m_isLocal = local;
|
||||
|
||||
if (m_isLocal) {
|
||||
QTC_ASSERT(runnable.is<StandardRunnable>(), return);
|
||||
StandardRunnable stdRunnable = runnable.as<StandardRunnable>();
|
||||
|
||||
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
|
||||
const QString fixedPath = FileUtils::normalizePathName(stdRunnable.workingDirectory);
|
||||
m_guiProcess.setWorkingDirectory(fixedPath);
|
||||
m_consoleProcess.setWorkingDirectory(fixedPath);
|
||||
m_guiProcess.setEnvironment(stdRunnable.environment);
|
||||
m_consoleProcess.setEnvironment(stdRunnable.environment);
|
||||
|
||||
m_processRunning = true;
|
||||
#ifdef Q_OS_WIN
|
||||
if (!WinDebugInterface::instance()->isRunning())
|
||||
WinDebugInterface::instance()->start(); // Try to start listener again...
|
||||
#endif
|
||||
|
||||
m_currentMode = stdRunnable.runMode;
|
||||
if (m_currentMode == ApplicationLauncher::Gui) {
|
||||
m_guiProcess.setCommand(stdRunnable.executable, stdRunnable.commandLineArguments);
|
||||
m_guiProcess.start();
|
||||
} else {
|
||||
m_consoleProcess.start(stdRunnable.executable, stdRunnable.commandLineArguments);
|
||||
}
|
||||
} else {
|
||||
QTC_ASSERT(m_state == Inactive, return);
|
||||
|
||||
m_state = Run;
|
||||
if (!device) {
|
||||
doReportError(ApplicationLauncher::tr("Cannot run: No device."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!device->canCreateProcess()) {
|
||||
doReportError(ApplicationLauncher::tr("Cannot run: Device is not able to create processes."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (runnable.is<StandardRunnable>() && runnable.as<StandardRunnable>().executable.isEmpty()) {
|
||||
doReportError(ApplicationLauncher::tr("Cannot run: No command given."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
m_stopRequested = false;
|
||||
m_success = true;
|
||||
|
||||
m_deviceProcess = device->createProcess(this);
|
||||
connect(m_deviceProcess, &DeviceProcess::started,
|
||||
q, &ApplicationLauncher::remoteProcessStarted);
|
||||
connect(m_deviceProcess, &DeviceProcess::readyReadStandardOutput,
|
||||
this, &ApplicationLauncherPrivate::handleRemoteStdout);
|
||||
connect(m_deviceProcess, &DeviceProcess::readyReadStandardError,
|
||||
this, &ApplicationLauncherPrivate::handleRemoteStderr);
|
||||
connect(m_deviceProcess, &DeviceProcess::error,
|
||||
this, &ApplicationLauncherPrivate::handleApplicationError);
|
||||
connect(m_deviceProcess, &DeviceProcess::finished,
|
||||
this, &ApplicationLauncherPrivate::handleApplicationFinished);
|
||||
m_deviceProcess->start(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::handleApplicationError(QProcess::ProcessError error)
|
||||
{
|
||||
if (error == QProcess::FailedToStart) {
|
||||
doReportError(ApplicationLauncher::tr("Application failed to start: %1")
|
||||
.arg(m_deviceProcess->errorString()));
|
||||
setFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::setFinished()
|
||||
{
|
||||
if (m_state == Inactive)
|
||||
return;
|
||||
|
||||
if (m_deviceProcess) {
|
||||
m_deviceProcess->disconnect(this);
|
||||
m_deviceProcess->deleteLater();
|
||||
m_deviceProcess = 0;
|
||||
}
|
||||
|
||||
m_state = Inactive;
|
||||
emit q->finished(m_success);
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::handleApplicationFinished()
|
||||
{
|
||||
QTC_ASSERT(m_state == Run, return);
|
||||
|
||||
if (m_deviceProcess->exitStatus() == QProcess::CrashExit) {
|
||||
doReportError(m_deviceProcess->errorString());
|
||||
} else {
|
||||
const int exitCode = m_deviceProcess->exitCode();
|
||||
if (exitCode != 0) {
|
||||
doReportError(ApplicationLauncher::tr("Application finished with exit code %1.").arg(exitCode));
|
||||
} else {
|
||||
emit q->reportProgress(ApplicationLauncher::tr("Application finished with exit code 0."));
|
||||
}
|
||||
}
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::handleRemoteStdout()
|
||||
{
|
||||
QTC_ASSERT(m_state == Run, return);
|
||||
emit q->remoteStdout(m_deviceProcess->readAllStandardOutput());
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::handleRemoteStderr()
|
||||
{
|
||||
QTC_ASSERT(m_state == Run, return);
|
||||
emit q->remoteStderr(m_deviceProcess->readAllStandardError());
|
||||
}
|
||||
|
||||
void ApplicationLauncherPrivate::doReportError(const QString &message)
|
||||
{
|
||||
m_success = false;
|
||||
emit q->reportError(message);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include "devicesupport/idevice.h"
|
||||
|
||||
#include <utils/outputformat.h>
|
||||
|
||||
#include <QProcess>
|
||||
@@ -54,6 +56,7 @@ public:
|
||||
|
||||
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
|
||||
void start(const Runnable &runnable);
|
||||
void start(const Runnable &runnable, const IDevice::ConstPtr &device);
|
||||
void stop();
|
||||
bool isRunning() const;
|
||||
qint64 applicationPID() const;
|
||||
@@ -70,6 +73,13 @@ signals:
|
||||
void processExited(int exitCode, QProcess::ExitStatus);
|
||||
void error(QProcess::ProcessError error);
|
||||
|
||||
void remoteStdout(const QByteArray &output);
|
||||
void remoteStderr(const QByteArray &output);
|
||||
void reportProgress(const QString &progressOutput);
|
||||
void reportError(const QString &errorOutput);
|
||||
void remoteProcessStarted();
|
||||
void finished(bool success);
|
||||
|
||||
private:
|
||||
Internal::ApplicationLauncherPrivate *d;
|
||||
};
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "deviceapplicationrunner.h"
|
||||
|
||||
#include "deviceprocess.h"
|
||||
#include "../runnables.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace {
|
||||
enum State { Inactive, Run };
|
||||
} // anonymous namespace
|
||||
|
||||
class DeviceApplicationRunner::DeviceApplicationRunnerPrivate
|
||||
{
|
||||
public:
|
||||
DeviceProcess *deviceProcess;
|
||||
State state;
|
||||
bool stopRequested;
|
||||
bool success;
|
||||
};
|
||||
|
||||
|
||||
DeviceApplicationRunner::DeviceApplicationRunner(QObject *parent) :
|
||||
QObject(parent), d(new DeviceApplicationRunnerPrivate)
|
||||
{
|
||||
d->deviceProcess = 0;
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
DeviceApplicationRunner::~DeviceApplicationRunner()
|
||||
{
|
||||
setFinished();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::start(const Runnable &runnable, const IDevice::ConstPtr &device)
|
||||
{
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
d->state = Run;
|
||||
if (!device) {
|
||||
doReportError(tr("Cannot run: No device."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!device->canCreateProcess()) {
|
||||
doReportError(tr("Cannot run: Device is not able to create processes."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (runnable.is<StandardRunnable>() && runnable.as<StandardRunnable>().executable.isEmpty()) {
|
||||
doReportError(tr("Cannot run: No command given."));
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
d->stopRequested = false;
|
||||
d->success = true;
|
||||
|
||||
d->deviceProcess = device->createProcess(this);
|
||||
connect(d->deviceProcess, &DeviceProcess::started,
|
||||
this, &DeviceApplicationRunner::remoteProcessStarted);
|
||||
connect(d->deviceProcess, &DeviceProcess::readyReadStandardOutput,
|
||||
this, &DeviceApplicationRunner::handleRemoteStdout);
|
||||
connect(d->deviceProcess, &DeviceProcess::readyReadStandardError,
|
||||
this, &DeviceApplicationRunner::handleRemoteStderr);
|
||||
connect(d->deviceProcess, &DeviceProcess::error,
|
||||
this, &DeviceApplicationRunner::handleApplicationError);
|
||||
connect(d->deviceProcess, &DeviceProcess::finished,
|
||||
this, &DeviceApplicationRunner::handleApplicationFinished);
|
||||
d->deviceProcess->start(runnable);
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::stop()
|
||||
{
|
||||
if (d->stopRequested)
|
||||
return;
|
||||
d->stopRequested = true;
|
||||
d->success = false;
|
||||
emit reportProgress(tr("User requested stop. Shutting down..."));
|
||||
switch (d->state) {
|
||||
case Run:
|
||||
d->deviceProcess->terminate();
|
||||
break;
|
||||
case Inactive:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::handleApplicationError(QProcess::ProcessError error)
|
||||
{
|
||||
if (error == QProcess::FailedToStart) {
|
||||
doReportError(tr("Application failed to start: %1")
|
||||
.arg(d->deviceProcess->errorString()));
|
||||
setFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::setFinished()
|
||||
{
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
|
||||
if (d->deviceProcess) {
|
||||
d->deviceProcess->disconnect(this);
|
||||
d->deviceProcess->deleteLater();
|
||||
d->deviceProcess = 0;
|
||||
}
|
||||
|
||||
d->state = Inactive;
|
||||
emit finished(d->success);
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::handleApplicationFinished()
|
||||
{
|
||||
QTC_ASSERT(d->state == Run, return);
|
||||
|
||||
if (d->deviceProcess->exitStatus() == QProcess::CrashExit) {
|
||||
doReportError(d->deviceProcess->errorString());
|
||||
} else {
|
||||
const int exitCode = d->deviceProcess->exitCode();
|
||||
if (exitCode != 0) {
|
||||
doReportError(tr("Application finished with exit code %1.").arg(exitCode));
|
||||
} else {
|
||||
emit reportProgress(tr("Application finished with exit code 0."));
|
||||
}
|
||||
}
|
||||
setFinished();
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::handleRemoteStdout()
|
||||
{
|
||||
QTC_ASSERT(d->state == Run, return);
|
||||
emit remoteStdout(d->deviceProcess->readAllStandardOutput());
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::handleRemoteStderr()
|
||||
{
|
||||
QTC_ASSERT(d->state == Run, return);
|
||||
emit remoteStderr(d->deviceProcess->readAllStandardError());
|
||||
}
|
||||
|
||||
void DeviceApplicationRunner::doReportError(const QString &message)
|
||||
{
|
||||
d->success = false;
|
||||
emit reportError(message);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
@@ -1,71 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "idevice.h"
|
||||
|
||||
#include "../projectexplorer_export.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Runnable;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT DeviceApplicationRunner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceApplicationRunner(QObject *parent = 0);
|
||||
~DeviceApplicationRunner() override;
|
||||
|
||||
void start(const Runnable &runnable, const IDevice::ConstPtr &device);
|
||||
void stop();
|
||||
|
||||
signals:
|
||||
void remoteStdout(const QByteArray &output);
|
||||
void remoteStderr(const QByteArray &output);
|
||||
void reportProgress(const QString &progressOutput);
|
||||
void reportError(const QString &errorOutput);
|
||||
void remoteProcessStarted();
|
||||
void finished(bool success);
|
||||
|
||||
private:
|
||||
void handleApplicationError(QProcess::ProcessError error);
|
||||
void handleApplicationFinished();
|
||||
void handleRemoteStdout();
|
||||
void handleRemoteStderr();
|
||||
|
||||
void doReportError(const QString &message);
|
||||
void setFinished();
|
||||
|
||||
class DeviceApplicationRunnerPrivate;
|
||||
DeviceApplicationRunnerPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
@@ -124,7 +124,6 @@ HEADERS += projectexplorer.h \
|
||||
devicesupport/devicesettingspage.h \
|
||||
devicesupport/devicetestdialog.h \
|
||||
devicesupport/deviceusedportsgatherer.h \
|
||||
devicesupport/deviceapplicationrunner.h \
|
||||
devicesupport/localprocesslist.h \
|
||||
devicesupport/sshdeviceprocess.h \
|
||||
devicesupport/sshdeviceprocesslist.h \
|
||||
@@ -265,7 +264,6 @@ SOURCES += projectexplorer.cpp \
|
||||
devicesupport/devicesettingspage.cpp \
|
||||
devicesupport/devicetestdialog.cpp \
|
||||
devicesupport/deviceusedportsgatherer.cpp \
|
||||
devicesupport/deviceapplicationrunner.cpp \
|
||||
devicesupport/localprocesslist.cpp \
|
||||
devicesupport/sshdeviceprocess.cpp \
|
||||
devicesupport/sshdeviceprocesslist.cpp \
|
||||
|
||||
@@ -201,7 +201,6 @@ Project {
|
||||
files: [
|
||||
"desktopdevice.cpp", "desktopdevice.h",
|
||||
"desktopdevicefactory.cpp", "desktopdevicefactory.h",
|
||||
"deviceapplicationrunner.cpp", "deviceapplicationrunner.h",
|
||||
"devicecheckbuildstep.cpp", "devicecheckbuildstep.h",
|
||||
"devicefactoryselectiondialog.cpp", "devicefactoryselectiondialog.h", "devicefactoryselectiondialog.ui",
|
||||
"devicemanager.cpp", "devicemanager.h",
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "qnxabstractrunsupport.h"
|
||||
#include "qnxrunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -44,7 +43,7 @@ QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QOb
|
||||
, m_device(DeviceKitInformation::device(runConfig->target()->kit()))
|
||||
, m_state(Inactive)
|
||||
{
|
||||
m_runner = new DeviceApplicationRunner(this);
|
||||
m_launcher = new ApplicationLauncher(this);
|
||||
m_portsGatherer = new DeviceUsedPortsGatherer(this);
|
||||
|
||||
connect(m_portsGatherer, &DeviceUsedPortsGatherer::error,
|
||||
@@ -80,7 +79,7 @@ void QnxAbstractRunSupport::handleRemoteProcessFinished(bool)
|
||||
void QnxAbstractRunSupport::setFinished()
|
||||
{
|
||||
if (m_state != GatheringPorts && m_state != Inactive)
|
||||
m_runner->stop();
|
||||
m_launcher->stop();
|
||||
|
||||
m_state = Inactive;
|
||||
}
|
||||
@@ -95,9 +94,9 @@ void QnxAbstractRunSupport::setState(QnxAbstractRunSupport::State state)
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
DeviceApplicationRunner *QnxAbstractRunSupport::appRunner() const
|
||||
ApplicationLauncher *QnxAbstractRunSupport::appRunner() const
|
||||
{
|
||||
return m_runner;
|
||||
return m_launcher;
|
||||
}
|
||||
|
||||
const IDevice::ConstPtr QnxAbstractRunSupport::device() const
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QString>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationRunner;
|
||||
class ApplicationLauncher;
|
||||
class DeviceUsedPortsGatherer;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
State state() const;
|
||||
void setState(State state);
|
||||
|
||||
ProjectExplorer::DeviceApplicationRunner *appRunner() const;
|
||||
ProjectExplorer::ApplicationLauncher *appRunner() const;
|
||||
const ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
|
||||
public slots:
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer;
|
||||
Utils::PortList m_portList;
|
||||
ProjectExplorer::IDevice::ConstPtr m_device;
|
||||
ProjectExplorer::DeviceApplicationRunner *m_runner;
|
||||
ProjectExplorer::ApplicationLauncher *m_launcher;
|
||||
State m_state;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "slog2inforunner.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerruncontrol.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
@@ -51,18 +50,18 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
|
||||
, m_runControl(runControl)
|
||||
, m_qmlPort(-1)
|
||||
{
|
||||
const DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, &DeviceApplicationRunner::reportError,
|
||||
const ApplicationLauncher *runner = appRunner();
|
||||
connect(runner, &ApplicationLauncher::reportError,
|
||||
this, &QnxAnalyzeSupport::handleError);
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(runner, &ApplicationLauncher::remoteProcessStarted,
|
||||
this, &QnxAbstractRunSupport::handleRemoteProcessStarted);
|
||||
connect(runner, &DeviceApplicationRunner::finished,
|
||||
connect(runner, &ApplicationLauncher::finished,
|
||||
this, &QnxAnalyzeSupport::handleRemoteProcessFinished);
|
||||
connect(runner, &DeviceApplicationRunner::reportProgress,
|
||||
connect(runner, &ApplicationLauncher::reportProgress,
|
||||
this, &QnxAnalyzeSupport::handleProgressReport);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(runner, &ApplicationLauncher::remoteStdout,
|
||||
this, &QnxAnalyzeSupport::handleRemoteOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStderr,
|
||||
connect(runner, &ApplicationLauncher::remoteStderr,
|
||||
this, &QnxAnalyzeSupport::handleRemoteOutput);
|
||||
|
||||
connect(m_runControl, &Debugger::AnalyzerRunControl::starting,
|
||||
@@ -77,7 +76,7 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
|
||||
m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
|
||||
connect(m_slog2Info, &Slog2InfoRunner::output,
|
||||
this, &QnxAnalyzeSupport::showMessage);
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(runner, &ApplicationLauncher::remoteProcessStarted,
|
||||
m_slog2Info, &Slog2InfoRunner::start);
|
||||
if (qnxDevice->qnxVersion() > 0x060500)
|
||||
connect(m_slog2Info, &Slog2InfoRunner::commandMissing,
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
||||
@@ -55,22 +54,22 @@ namespace Internal {
|
||||
QnxAttachDebugSupport::QnxAttachDebugSupport(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_runner = new DeviceApplicationRunner(this);
|
||||
m_launcher = new ApplicationLauncher(this);
|
||||
m_portsGatherer = new DeviceUsedPortsGatherer(this);
|
||||
|
||||
connect(m_portsGatherer, &DeviceUsedPortsGatherer::portListReady,
|
||||
this, &QnxAttachDebugSupport::launchPDebug);
|
||||
connect(m_portsGatherer, &DeviceUsedPortsGatherer::error,
|
||||
this, &QnxAttachDebugSupport::handleError);
|
||||
connect(m_runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(m_launcher, &ApplicationLauncher::remoteProcessStarted,
|
||||
this, &QnxAttachDebugSupport::attachToProcess);
|
||||
connect(m_runner, &DeviceApplicationRunner::reportError,
|
||||
connect(m_launcher, &ApplicationLauncher::reportError,
|
||||
this, &QnxAttachDebugSupport::handleError);
|
||||
connect(m_runner, &DeviceApplicationRunner::reportProgress,
|
||||
connect(m_launcher, &ApplicationLauncher::reportProgress,
|
||||
this, &QnxAttachDebugSupport::handleProgressReport);
|
||||
connect(m_runner, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(m_launcher, &ApplicationLauncher::remoteStdout,
|
||||
this, &QnxAttachDebugSupport::handleRemoteOutput);
|
||||
connect(m_runner, &DeviceApplicationRunner::remoteStderr,
|
||||
connect(m_launcher, &ApplicationLauncher::remoteStderr,
|
||||
this, &QnxAttachDebugSupport::handleRemoteOutput);
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ void QnxAttachDebugSupport::launchPDebug()
|
||||
StandardRunnable r;
|
||||
r.executable = QLatin1String("pdebug");
|
||||
r.commandLineArguments = QString::number(m_pdebugPort.number());
|
||||
m_runner->start(r, m_device);
|
||||
m_launcher->start(r, m_device);
|
||||
}
|
||||
|
||||
void QnxAttachDebugSupport::attachToProcess()
|
||||
@@ -177,7 +176,7 @@ void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output)
|
||||
|
||||
void QnxAttachDebugSupport::stopPDebug()
|
||||
{
|
||||
m_runner->stop();
|
||||
m_launcher->stop();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
namespace Debugger { class DebuggerRunControl; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationRunner;
|
||||
class ApplicationLauncher;
|
||||
class DeviceUsedPortsGatherer;
|
||||
class Kit;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
ProjectExplorer::IDevice::ConstPtr m_device;
|
||||
ProjectExplorer::DeviceProcessItem m_process;
|
||||
|
||||
ProjectExplorer::DeviceApplicationRunner *m_runner;
|
||||
ProjectExplorer::ApplicationLauncher *m_launcher;
|
||||
ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer;
|
||||
Debugger::DebuggerRunControl *m_runControl = 0;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <debugger/debuggerruncontrol.h>
|
||||
#include <debugger/debuggerstartparameters.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
@@ -56,13 +55,13 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
|
||||
, m_useCppDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
|
||||
, m_useQmlDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger())
|
||||
{
|
||||
const DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, &DeviceApplicationRunner::reportError, this, &QnxDebugSupport::handleError);
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted, this, &QnxDebugSupport::handleRemoteProcessStarted);
|
||||
connect(runner, &DeviceApplicationRunner::finished, this, &QnxDebugSupport::handleRemoteProcessFinished);
|
||||
connect(runner, &DeviceApplicationRunner::reportProgress, this, &QnxDebugSupport::handleProgressReport);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
|
||||
const ApplicationLauncher *runner = appRunner();
|
||||
connect(runner, &ApplicationLauncher::reportError, this, &QnxDebugSupport::handleError);
|
||||
connect(runner, &ApplicationLauncher::remoteProcessStarted, this, &QnxDebugSupport::handleRemoteProcessStarted);
|
||||
connect(runner, &ApplicationLauncher::finished, this, &QnxDebugSupport::handleRemoteProcessFinished);
|
||||
connect(runner, &ApplicationLauncher::reportProgress, this, &QnxDebugSupport::handleProgressReport);
|
||||
connect(runner, &ApplicationLauncher::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
|
||||
connect(runner, &ApplicationLauncher::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
|
||||
|
||||
connect(m_runControl, &Debugger::DebuggerRunControl::requestRemoteSetup,
|
||||
this, &QnxDebugSupport::handleAdapterSetupRequested);
|
||||
@@ -73,7 +72,7 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
|
||||
|
||||
m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
|
||||
connect(m_slog2Info, &Slog2InfoRunner::output, this, &QnxDebugSupport::handleApplicationOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted, m_slog2Info, &Slog2InfoRunner::start);
|
||||
connect(runner, &ApplicationLauncher::remoteProcessStarted, m_slog2Info, &Slog2InfoRunner::start);
|
||||
if (qnxDevice->qnxVersion() > 0x060500)
|
||||
connect(m_slog2Info, &Slog2InfoRunner::commandMissing, this, &QnxDebugSupport::printMissingWarning);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "abstractremotelinuxrunsupport.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
@@ -51,9 +50,9 @@ public:
|
||||
|
||||
AbstractRemoteLinuxRunSupport::State state;
|
||||
StandardRunnable runnable;
|
||||
DeviceApplicationRunner appRunner;
|
||||
ApplicationLauncher appLauncher;
|
||||
DeviceUsedPortsGatherer portsGatherer;
|
||||
DeviceApplicationRunner fifoCreator;
|
||||
ApplicationLauncher fifoCreator;
|
||||
const IDevice::ConstPtr device;
|
||||
Utils::PortList portList;
|
||||
QString fifo;
|
||||
@@ -115,7 +114,7 @@ void AbstractRemoteLinuxRunSupport::setFinished()
|
||||
if (d->state == Inactive)
|
||||
return;
|
||||
if (d->state == Running)
|
||||
d->appRunner.stop();
|
||||
d->appLauncher.stop();
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
@@ -154,7 +153,7 @@ void AbstractRemoteLinuxRunSupport::createRemoteFifo()
|
||||
QSharedPointer<QByteArray> output(new QByteArray);
|
||||
QSharedPointer<QByteArray> errors(new QByteArray);
|
||||
|
||||
connect(&d->fifoCreator, &DeviceApplicationRunner::finished,
|
||||
connect(&d->fifoCreator, &ApplicationLauncher::finished,
|
||||
this, [this, output, errors](bool success) {
|
||||
if (!success) {
|
||||
handleResourcesError(QString("Failed to create fifo: %1").arg(QLatin1String(*errors)));
|
||||
@@ -164,12 +163,12 @@ void AbstractRemoteLinuxRunSupport::createRemoteFifo()
|
||||
}
|
||||
});
|
||||
|
||||
connect(&d->fifoCreator, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(&d->fifoCreator, &ApplicationLauncher::remoteStdout,
|
||||
this, [output](const QByteArray &data) {
|
||||
output->append(data);
|
||||
});
|
||||
|
||||
connect(&d->fifoCreator, &DeviceApplicationRunner::remoteStderr,
|
||||
connect(&d->fifoCreator, &ApplicationLauncher::remoteStderr,
|
||||
this, [errors](const QByteArray &data) {
|
||||
errors->append(data);
|
||||
});
|
||||
@@ -190,13 +189,13 @@ const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const
|
||||
void AbstractRemoteLinuxRunSupport::reset()
|
||||
{
|
||||
d->portsGatherer.disconnect(this);
|
||||
d->appRunner.disconnect(this);
|
||||
d->appLauncher.disconnect(this);
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
DeviceApplicationRunner *AbstractRemoteLinuxRunSupport::appRunner() const
|
||||
ApplicationLauncher *AbstractRemoteLinuxRunSupport::appRunner() const
|
||||
{
|
||||
return &d->appRunner;
|
||||
return &d->appLauncher;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationRunner;
|
||||
class ApplicationLauncher;
|
||||
class RunConfiguration;
|
||||
class StandardRunnable;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
protected:
|
||||
void setState(State state);
|
||||
State state() const;
|
||||
ProjectExplorer::DeviceApplicationRunner *appRunner() const;
|
||||
ProjectExplorer::ApplicationLauncher *appRunner() const;
|
||||
|
||||
virtual void startExecution() = 0;
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
@@ -77,7 +76,7 @@ public:
|
||||
QString remoteFifo;
|
||||
QString perfRecordArguments;
|
||||
|
||||
DeviceApplicationRunner outputGatherer;
|
||||
ApplicationLauncher outputGatherer;
|
||||
QmlDebug::QmlOutputParser outputParser;
|
||||
};
|
||||
|
||||
@@ -145,18 +144,18 @@ void RemoteLinuxAnalyzeSupport::startExecution()
|
||||
|
||||
setState(StartingRunner);
|
||||
|
||||
DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, &DeviceApplicationRunner::remoteStderr,
|
||||
ApplicationLauncher *runner = appRunner();
|
||||
connect(runner, &ApplicationLauncher::remoteStderr,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleRemoteErrorOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(runner, &ApplicationLauncher::remoteStdout,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleRemoteOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(runner, &ApplicationLauncher::remoteProcessStarted,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleRemoteProcessStarted);
|
||||
connect(runner, &DeviceApplicationRunner::finished,
|
||||
connect(runner, &ApplicationLauncher::finished,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerFinished);
|
||||
connect(runner, &DeviceApplicationRunner::reportProgress,
|
||||
connect(runner, &ApplicationLauncher::reportProgress,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleProgressReport);
|
||||
connect(runner, &DeviceApplicationRunner::reportError,
|
||||
connect(runner, &ApplicationLauncher::reportError,
|
||||
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
|
||||
|
||||
auto r = runnable();
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/runnables.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -128,19 +127,19 @@ void LinuxDeviceDebugSupport::startExecution()
|
||||
setState(StartingRunner);
|
||||
d->gdbserverOutput.clear();
|
||||
|
||||
DeviceApplicationRunner *runner = appRunner();
|
||||
connect(runner, &DeviceApplicationRunner::remoteStderr,
|
||||
ApplicationLauncher *launcher = appRunner();
|
||||
connect(launcher, &ApplicationLauncher::remoteStderr,
|
||||
this, &LinuxDeviceDebugSupport::handleRemoteErrorOutput);
|
||||
connect(runner, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(launcher, &ApplicationLauncher::remoteStdout,
|
||||
this, &LinuxDeviceDebugSupport::handleRemoteOutput);
|
||||
connect(runner, &DeviceApplicationRunner::finished,
|
||||
connect(launcher, &ApplicationLauncher::finished,
|
||||
this, &LinuxDeviceDebugSupport::handleAppRunnerFinished);
|
||||
connect(runner, &DeviceApplicationRunner::reportProgress,
|
||||
connect(launcher, &ApplicationLauncher::reportProgress,
|
||||
this, &LinuxDeviceDebugSupport::handleProgressReport);
|
||||
connect(runner, &DeviceApplicationRunner::reportError,
|
||||
connect(launcher, &ApplicationLauncher::reportError,
|
||||
this, &LinuxDeviceDebugSupport::handleAppRunnerError);
|
||||
if (d->qmlDebugging && !d->cppDebugging)
|
||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||
connect(launcher, &ApplicationLauncher::remoteProcessStarted,
|
||||
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
|
||||
|
||||
StandardRunnable r = runnable();
|
||||
@@ -162,7 +161,7 @@ void LinuxDeviceDebugSupport::startExecution()
|
||||
}
|
||||
r.executable = command;
|
||||
r.commandLineArguments = QtcProcess::joinArgs(args, OsTypeLinux);
|
||||
runner->start(r, device());
|
||||
launcher->start(r, device());
|
||||
}
|
||||
|
||||
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "remotelinuxruncontrol.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/applicationlauncher.h>
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace RemoteLinux {
|
||||
class RemoteLinuxRunControl::RemoteLinuxRunControlPrivate
|
||||
{
|
||||
public:
|
||||
DeviceApplicationRunner runner;
|
||||
ApplicationLauncher launcher;
|
||||
};
|
||||
|
||||
RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
|
||||
@@ -54,23 +54,23 @@ RemoteLinuxRunControl::~RemoteLinuxRunControl()
|
||||
void RemoteLinuxRunControl::start()
|
||||
{
|
||||
reportApplicationStart();
|
||||
d->runner.disconnect(this);
|
||||
connect(&d->runner, &DeviceApplicationRunner::reportError,
|
||||
d->launcher.disconnect(this);
|
||||
connect(&d->launcher, &ApplicationLauncher::reportError,
|
||||
this, &RemoteLinuxRunControl::handleErrorMessage);
|
||||
connect(&d->runner, &DeviceApplicationRunner::remoteStderr,
|
||||
connect(&d->launcher, &ApplicationLauncher::remoteStderr,
|
||||
this, &RemoteLinuxRunControl::handleRemoteErrorOutput);
|
||||
connect(&d->runner, &DeviceApplicationRunner::remoteStdout,
|
||||
connect(&d->launcher, &ApplicationLauncher::remoteStdout,
|
||||
this, &RemoteLinuxRunControl::handleRemoteOutput);
|
||||
connect(&d->runner, &DeviceApplicationRunner::finished,
|
||||
connect(&d->launcher, &ApplicationLauncher::finished,
|
||||
this, &RemoteLinuxRunControl::handleRunnerFinished);
|
||||
connect(&d->runner, &DeviceApplicationRunner::reportProgress,
|
||||
connect(&d->launcher, &ApplicationLauncher::reportProgress,
|
||||
this, &RemoteLinuxRunControl::handleProgressReport);
|
||||
d->runner.start(runnable(), device());
|
||||
d->launcher.start(runnable(), device());
|
||||
}
|
||||
|
||||
RunControl::StopResult RemoteLinuxRunControl::stop()
|
||||
{
|
||||
d->runner.stop();
|
||||
d->launcher.stop();
|
||||
return AsynchronousStop;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void RemoteLinuxRunControl::handleProgressReport(const QString &progressString)
|
||||
|
||||
void RemoteLinuxRunControl::setFinished()
|
||||
{
|
||||
d->runner.disconnect(this);
|
||||
d->launcher.disconnect(this);
|
||||
reportApplicationStop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user