From 2a1e7cb9f56f728d9bfda85d6a559fc3dc1aa436 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 28 Mar 2017 09:07:29 +0200 Subject: RemoteLinux: Base AbstractLinuxRunSupport on PE::ToolSupport This continues the quest started with eb0b0f944. This also moves the AnalyzerRunControl::starting signal to the base, similar to the already present started and finished signals. Moving emission of the signal to the base is left to a follow-up patch to keep this here small. Change-Id: I12e04823df22e7667a4d0a9ee7412153180c60cc Reviewed-by: Ulf Hermann Reviewed-by: Tobias Hunger --- .../remotelinux/remotelinuxdebugsupport.cpp | 42 +++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/plugins/remotelinux/remotelinuxdebugsupport.cpp') diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index f595b1c2919..296d325858e 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -56,14 +56,12 @@ namespace Internal { class LinuxDeviceDebugSupportPrivate { public: - LinuxDeviceDebugSupportPrivate(const RunConfiguration *runConfig, DebuggerRunControl *runControl) - : runControl(runControl), - qmlDebugging(runConfig->extraAspect()->useQmlDebugger()), + LinuxDeviceDebugSupportPrivate(const RunConfiguration *runConfig) + : qmlDebugging(runConfig->extraAspect()->useQmlDebugger()), cppDebugging(runConfig->extraAspect()->useCppDebugger()) { } - const QPointer runControl; bool qmlDebugging; bool cppDebugging; QByteArray gdbserverOutput; @@ -75,12 +73,11 @@ public: using namespace Internal; -LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunConfiguration *runConfig, - DebuggerRunControl *runControl) - : AbstractRemoteLinuxRunSupport(runConfig, runControl), - d(new LinuxDeviceDebugSupportPrivate(runConfig, runControl)) +LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) + : AbstractRemoteLinuxRunSupport(runControl), + d(new LinuxDeviceDebugSupportPrivate(runControl->runConfiguration())) { - connect(runControl, &DebuggerRunControl::requestRemoteSetup, + connect(this->runControl(), &DebuggerRunControl::requestRemoteSetup, this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested); connect(runControl, &RunControl::finished, this, &LinuxDeviceDebugSupport::handleDebuggingFinished); @@ -103,8 +100,13 @@ bool LinuxDeviceDebugSupport::isQmlDebugging() const void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel) { - if (state() != Inactive && d->runControl) - d->runControl->showMessage(msg, channel); + if (state() != Inactive) + runControl()->showMessage(msg, channel); +} + +DebuggerRunControl *LinuxDeviceDebugSupport::runControl() const +{ + return qobject_cast(AbstractRemoteLinuxRunSupport::runControl()); } void LinuxDeviceDebugSupport::handleRemoteSetupRequested() @@ -183,8 +185,7 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error) { if (state() == Running) { showMessage(error, AppError); - if (d->runControl) - d->runControl->notifyInferiorIll(); + runControl()->notifyInferiorIll(); } else if (state() != Inactive) { handleAdapterSetupFailed(error); } @@ -192,21 +193,21 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error) void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success) { - if (!d->runControl || state() == Inactive) + if (state() == Inactive) return; if (state() == Running) { // The QML engine does not realize on its own that the application has finished. if (d->qmlDebugging && !d->cppDebugging) - d->runControl->quitDebugger(); + runControl()->quitDebugger(); else if (!success) - d->runControl->notifyInferiorIll(); + runControl()->notifyInferiorIll(); } else if (state() == StartingRunner) { RemoteSetupResult result; result.success = false; result.reason = tr("Debugging failed."); - d->runControl->notifyEngineRemoteSetupFinished(result); + runControl()->notifyEngineRemoteSetupFinished(result); } reset(); } @@ -228,9 +229,6 @@ void LinuxDeviceDebugSupport::handleRemoteErrorOutput(const QByteArray &output) { QTC_ASSERT(state() != GatheringResources, return); - if (!d->runControl) - return; - showMessage(QString::fromUtf8(output), AppError); if (state() == StartingRunner && d->cppDebugging) { d->gdbserverOutput += output; @@ -253,7 +251,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error) RemoteSetupResult result; result.success = false; result.reason = tr("Initial setup failed: %1").arg(error); - d->runControl->notifyEngineRemoteSetupFinished(result); + runControl()->notifyEngineRemoteSetupFinished(result); } void LinuxDeviceDebugSupport::handleAdapterSetupDone() @@ -264,7 +262,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupDone() result.success = true; result.gdbServerPort = d->gdbServerPort; result.qmlServerPort = d->qmlPort; - d->runControl->notifyEngineRemoteSetupFinished(result); + runControl()->notifyEngineRemoteSetupFinished(result); } void LinuxDeviceDebugSupport::handleRemoteProcessStarted() -- cgit v1.2.3