aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-03-28 17:19:05 +0200
committerhjk <hjk@qt.io>2017-03-30 06:02:22 +0000
commitc69b6f0ea9793aebd68d9c89d4c6f35d7baa9518 (patch)
treeed0aa3805590fbdd518840891d70de20c2767c3f
parent15867a9518cfa40612dab1c9f373a46945a38a42 (diff)
Qnx: Adapt to recent ToolSupport introduction
Change-Id: I5daa28d3fe24f196195396c674e36e0709e77046 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
-rw-r--r--src/plugins/qnx/qnxabstractrunsupport.cpp6
-rw-r--r--src/plugins/qnx/qnxabstractrunsupport.h9
-rw-r--r--src/plugins/qnx/qnxanalyzesupport.cpp40
-rw-r--r--src/plugins/qnx/qnxanalyzesupport.h13
-rw-r--r--src/plugins/qnx/qnxdebugsupport.cpp78
-rw-r--r--src/plugins/qnx/qnxdebugsupport.h10
-rw-r--r--src/plugins/qnx/qnxruncontrolfactory.cpp6
7 files changed, 72 insertions, 90 deletions
diff --git a/src/plugins/qnx/qnxabstractrunsupport.cpp b/src/plugins/qnx/qnxabstractrunsupport.cpp
index ea968bfcfa..1e59df55bf 100644
--- a/src/plugins/qnx/qnxabstractrunsupport.cpp
+++ b/src/plugins/qnx/qnxabstractrunsupport.cpp
@@ -38,9 +38,9 @@ using namespace RemoteLinux;
namespace Qnx {
namespace Internal {
-QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent)
- : QObject(parent)
- , m_device(DeviceKitInformation::device(runConfig->target()->kit()))
+QnxAbstractRunSupport::QnxAbstractRunSupport(RunControl *runControl)
+ : ToolRunner(runControl)
+ , m_device(DeviceKitInformation::device(runControl->runConfiguration()->target()->kit()))
, m_state(Inactive)
{
m_launcher = new ApplicationLauncher(this);
diff --git a/src/plugins/qnx/qnxabstractrunsupport.h b/src/plugins/qnx/qnxabstractrunsupport.h
index 66f42981aa..2a2eb15602 100644
--- a/src/plugins/qnx/qnxabstractrunsupport.h
+++ b/src/plugins/qnx/qnxabstractrunsupport.h
@@ -26,6 +26,8 @@
#pragma once
#include <projectexplorer/devicesupport/idevice.h>
+#include <projectexplorer/runconfiguration.h>
+
#include <utils/environment.h>
#include <utils/portlist.h>
@@ -40,9 +42,7 @@ class DeviceUsedPortsGatherer;
namespace Qnx {
namespace Internal {
-class QnxRunConfiguration;
-
-class QnxAbstractRunSupport : public QObject
+class QnxAbstractRunSupport : public ProjectExplorer::ToolRunner
{
Q_OBJECT
protected:
@@ -52,8 +52,9 @@ protected:
StartingRemoteProcess,
Running
};
+
public:
- QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent = 0);
+ explicit QnxAbstractRunSupport(ProjectExplorer::RunControl *runControl);
protected:
bool setPort(Utils::Port &port);
diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp
index d328faebae..0ff9df37b4 100644
--- a/src/plugins/qnx/qnxanalyzesupport.cpp
+++ b/src/plugins/qnx/qnxanalyzesupport.cpp
@@ -43,11 +43,9 @@ using namespace Utils;
namespace Qnx {
namespace Internal {
-QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
- Debugger::AnalyzerRunControl *runControl)
- : QnxAbstractRunSupport(runConfig, runControl)
- , m_runnable(runConfig->runnable().as<StandardRunnable>())
- , m_runControl(runControl)
+QnxAnalyzeSupport::QnxAnalyzeSupport(RunControl *runControl)
+ : QnxAbstractRunSupport(runControl)
+ , m_runnable(runControl->runnable().as<StandardRunnable>())
, m_qmlPort(-1)
{
const ApplicationLauncher *runner = appRunner();
@@ -64,15 +62,19 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
connect(runner, &ApplicationLauncher::remoteStderr,
this, &QnxAnalyzeSupport::handleRemoteOutput);
- connect(m_runControl, &Debugger::AnalyzerRunControl::starting,
+ connect(runControl, &RunControl::starting,
this, &QnxAnalyzeSupport::handleAdapterSetupRequested);
+ connect(runControl, &RunControl::finished,
+ this, &QnxAnalyzeSupport::setFinished);
+
connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, &QnxAnalyzeSupport::remoteIsRunning);
- IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
+ IDevice::ConstPtr dev = DeviceKitInformation::device(runControl->runConfiguration()->target()->kit());
QnxDevice::ConstPtr qnxDevice = dev.dynamicCast<const QnxDevice>();
- const QString applicationId = FileName::fromString(runConfig->remoteExecutableFilePath()).fileName();
+ auto qnxRunConfig = qobject_cast<QnxRunConfiguration *>(runControl->runConfiguration());
+ const QString applicationId = FileName::fromString(qnxRunConfig->remoteExecutableFilePath()).fileName();
m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
connect(m_slog2Info, &Slog2InfoRunner::output,
this, &QnxAnalyzeSupport::showMessage);
@@ -109,24 +111,21 @@ void QnxAnalyzeSupport::startExecution()
appRunner()->start(r, device());
}
-void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
+Debugger::AnalyzerRunControl *QnxAnalyzeSupport::runControl()
{
- if (!m_runControl)
- return;
+ return qobject_cast<Debugger::AnalyzerRunControl *>(QnxAbstractRunSupport::runControl());
+}
+void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
+{
if (!success)
showMessage(tr("The %1 process closed unexpectedly.").arg(m_runnable.executable),
NormalMessageFormat);
- m_runControl->notifyRemoteFinished();
+ runControl()->notifyRemoteFinished();
m_slog2Info->stop();
}
-void QnxAnalyzeSupport::handleProfilingFinished()
-{
- setFinished();
-}
-
void QnxAnalyzeSupport::handleProgressReport(const QString &progressOutput)
{
showMessage(progressOutput + QLatin1Char('\n'), NormalMessageFormat);
@@ -151,14 +150,13 @@ void QnxAnalyzeSupport::handleError(const QString &error)
void QnxAnalyzeSupport::remoteIsRunning()
{
- if (m_runControl)
- m_runControl->notifyRemoteSetupDone(m_qmlPort);
+ runControl()->notifyRemoteSetupDone(m_qmlPort);
}
void QnxAnalyzeSupport::showMessage(const QString &msg, OutputFormat format)
{
- if (state() != Inactive && m_runControl)
- m_runControl->appendMessage(msg, format);
+ if (state() != Inactive)
+ runControl()->appendMessage(msg, format);
m_outputParser.processOutput(msg);
}
diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h
index 19165a1686..1667727ce7 100644
--- a/src/plugins/qnx/qnxanalyzesupport.h
+++ b/src/plugins/qnx/qnxanalyzesupport.h
@@ -36,19 +36,16 @@ namespace Debugger { class AnalyzerRunControl; }
namespace Qnx {
namespace Internal {
-class QnxRunConfiguration;
class Slog2InfoRunner;
class QnxAnalyzeSupport : public QnxAbstractRunSupport
{
Q_OBJECT
-public:
- QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Debugger::AnalyzerRunControl *engine);
-public slots:
- void handleProfilingFinished();
+public:
+ explicit QnxAnalyzeSupport(ProjectExplorer::RunControl *runControl);
-private slots:
+private:
void handleAdapterSetupRequested() override;
void handleRemoteProcessFinished(bool success) override;
@@ -60,12 +57,10 @@ private slots:
void printMissingWarning();
void remoteIsRunning();
-
-private:
void startExecution() override;
+ Debugger::AnalyzerRunControl *runControl();
ProjectExplorer::StandardRunnable m_runnable;
- Debugger::AnalyzerRunControl *m_runControl;
QmlDebug::QmlOutputParser m_outputParser;
Utils::Port m_qmlPort;
diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp
index 58df145212..4243adfb5d 100644
--- a/src/plugins/qnx/qnxdebugsupport.cpp
+++ b/src/plugins/qnx/qnxdebugsupport.cpp
@@ -41,20 +41,18 @@
#include <qmldebug/qmldebugcommandlinearguments.h>
using namespace ProjectExplorer;
-using namespace RemoteLinux;
namespace Qnx {
namespace Internal {
-QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl)
- : QnxAbstractRunSupport(runConfig, runControl)
- , m_runnable(runConfig->runnable().as<StandardRunnable>())
- , m_runControl(runControl)
- , m_pdebugPort(-1)
- , m_qmlPort(-1)
- , m_useCppDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
- , m_useQmlDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger())
+QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
+ : QnxAbstractRunSupport(runControl)
{
+ auto runConfig = runControl->runConfiguration();
+ m_useCppDebugger = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger();
+ m_useQmlDebugger = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger();
+ m_runnable = runConfig->runnable().as<StandardRunnable>();
+
const ApplicationLauncher *runner = appRunner();
connect(runner, &ApplicationLauncher::reportError, this, &QnxDebugSupport::handleError);
connect(runner, &ApplicationLauncher::remoteProcessStarted, this, &QnxDebugSupport::handleRemoteProcessStarted);
@@ -63,10 +61,13 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
connect(runner, &ApplicationLauncher::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
connect(runner, &ApplicationLauncher::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
- connect(m_runControl, &Debugger::DebuggerRunControl::requestRemoteSetup,
+ connect(this->runControl(), &Debugger::DebuggerRunControl::requestRemoteSetup,
this, &QnxDebugSupport::handleAdapterSetupRequested);
+ connect(runControl, &RunControl::finished,
+ this, &QnxDebugSupport::handleDebuggingFinished);
- const QString applicationId = Utils::FileName::fromString(runConfig->remoteExecutableFilePath()).fileName();
+ auto qnxRunConfig = qobject_cast<QnxRunConfiguration *>(runControl->runConfiguration());
+ const QString applicationId = Utils::FileName::fromString(qnxRunConfig->remoteExecutableFilePath()).fileName();
IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
QnxDevice::ConstPtr qnxDevice = dev.dynamicCast<const QnxDevice>();
@@ -81,8 +82,7 @@ void QnxDebugSupport::handleAdapterSetupRequested()
{
QTC_ASSERT(state() == Inactive, return);
- if (m_runControl)
- m_runControl->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff);
+ runControl()->showMessage(tr("Preparing remote side...") + QLatin1Char('\n'), Debugger::AppStuff);
QnxAbstractRunSupport::handleAdapterSetupRequested();
}
@@ -120,29 +120,27 @@ void QnxDebugSupport::startExecution()
void QnxDebugSupport::handleRemoteProcessStarted()
{
QnxAbstractRunSupport::handleRemoteProcessStarted();
- if (m_runControl) {
- Debugger::RemoteSetupResult result;
- result.success = true;
- result.gdbServerPort = m_pdebugPort;
- result.qmlServerPort = m_qmlPort;
- m_runControl->notifyEngineRemoteSetupFinished(result);
- }
+ Debugger::RemoteSetupResult result;
+ result.success = true;
+ result.gdbServerPort = m_pdebugPort;
+ result.qmlServerPort = m_qmlPort;
+ runControl()->notifyEngineRemoteSetupFinished(result);
}
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
{
- if (!m_runControl || state() == Inactive)
+ if (state() == Inactive)
return;
if (state() == Running) {
if (!success)
- m_runControl->notifyInferiorIll();
+ runControl()->notifyInferiorIll();
} else {
Debugger::RemoteSetupResult result;
result.success = false;
result.reason = tr("The %1 process closed unexpectedly.").arg(processExecutable());
- m_runControl->notifyEngineRemoteSetupFinished(result);
+ runControl()->notifyEngineRemoteSetupFinished(result);
}
}
@@ -168,47 +166,43 @@ void QnxDebugSupport::killInferiorProcess()
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
{
- if (m_runControl)
- m_runControl->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
+ runControl()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff);
}
void QnxDebugSupport::handleRemoteOutput(const QByteArray &output)
{
QTC_ASSERT(state() == Inactive || state() == Running, return);
-
- if (m_runControl)
- m_runControl->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
+ runControl()->showMessage(QString::fromUtf8(output), Debugger::AppOutput);
}
void QnxDebugSupport::handleError(const QString &error)
{
if (state() == Running) {
- if (m_runControl) {
- m_runControl->showMessage(error, Debugger::AppError);
- m_runControl->notifyInferiorIll();
- }
+ runControl()->showMessage(error, Debugger::AppError);
+ runControl()->notifyInferiorIll();
} else if (state() != Inactive) {
setFinished();
- if (m_runControl) {
- Debugger::RemoteSetupResult result;
- result.success = false;
- result.reason = tr("Initial setup failed: %1").arg(error);
- m_runControl->notifyEngineRemoteSetupFinished(result);
- }
+ Debugger::RemoteSetupResult result;
+ result.success = false;
+ result.reason = tr("Initial setup failed: %1").arg(error);
+ runControl()->notifyEngineRemoteSetupFinished(result);
}
}
void QnxDebugSupport::printMissingWarning()
{
- if (m_runControl)
- m_runControl->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Debugger::AppError);
+ runControl()->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available."), Debugger::AppError);
}
void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat)
{
Q_UNUSED(outputFormat);
- if (m_runControl)
- m_runControl->showMessage(msg, Debugger::AppOutput);
+ runControl()->showMessage(msg, Debugger::AppOutput);
+}
+
+Debugger::DebuggerRunControl *QnxDebugSupport::runControl()
+{
+ return qobject_cast<Debugger::DebuggerRunControl *>(QnxAbstractRunSupport::runControl());
}
} // namespace Internal
diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h
index f389c3ee49..04349b069e 100644
--- a/src/plugins/qnx/qnxdebugsupport.h
+++ b/src/plugins/qnx/qnxdebugsupport.h
@@ -36,7 +36,6 @@ namespace Debugger { class DebuggerRunControl; }
namespace Qnx {
namespace Internal {
-class QnxRunConfiguration;
class Slog2InfoRunner;
class QnxDebugSupport : public QnxAbstractRunSupport
@@ -44,13 +43,11 @@ class QnxDebugSupport : public QnxAbstractRunSupport
Q_OBJECT
public:
- QnxDebugSupport(QnxRunConfiguration *runConfig,
- Debugger::DebuggerRunControl *runControl);
+ explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl);
-public slots:
void handleDebuggingFinished();
-private slots:
+private:
void handleAdapterSetupRequested() override;
void handleRemoteProcessStarted() override;
@@ -62,9 +59,9 @@ private slots:
void printMissingWarning();
void handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat);
-private:
void startExecution() override;
+ Debugger::DebuggerRunControl *runControl();
QString processExecutable() const;
void killInferiorProcess();
@@ -72,7 +69,6 @@ private:
ProjectExplorer::StandardRunnable m_runnable;
Slog2InfoRunner *m_slog2Info;
- Debugger::DebuggerRunControl *m_runControl;
Utils::Port m_pdebugPort;
Utils::Port m_qmlPort;
diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp
index 068db38d0f..c5c53dec60 100644
--- a/src/plugins/qnx/qnxruncontrolfactory.cpp
+++ b/src/plugins/qnx/qnxruncontrolfactory.cpp
@@ -132,8 +132,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
const DebuggerStartParameters params = createDebuggerStartParameters(rc);
DebuggerRunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
QTC_ASSERT(runControl, return 0);
- auto debugSupport = new QnxDebugSupport(rc, runControl);
- connect(runControl, &RunControl::finished, debugSupport, &QnxDebugSupport::handleDebuggingFinished);
+ (void) new QnxDebugSupport(runControl);
return runControl;
}
@@ -150,8 +149,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
connection.analyzerHost = connection.connParams.host;
connection.analyzerPort = Utils::Port(connection.connParams.port);
runControl->setConnection(connection);
- auto analyzeSupport = new QnxAnalyzeSupport(rc, runControl);
- connect(runControl, &RunControl::finished, analyzeSupport, &QnxAnalyzeSupport::handleProfilingFinished);
+ (void) new QnxAnalyzeSupport(runControl);
return runControl;
}