From 9250c19007a30a3fee96357c55634afc893eda93 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 24 Mar 2017 11:26:33 +0100 Subject: [PATCH] RemoteLinux: Refactor LinuxDeviceDebugSupport Add a hook to augment a runnable by derived classes in order to remove the code duplication in qdbdevicedebugsupport.cpp. Change-Id: Ia374e45ce1c58f751cec2cd1ff2ee324c010afe3 Reviewed-by: Ulf Hermann --- .../remotelinux/abstractremotelinuxrunsupport.h | 1 + .../remotelinux/remotelinuxdebugsupport.cpp | 17 ++++++++++++++++- .../remotelinux/remotelinuxdebugsupport.h | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h index cfbeaca8987..453f9cdc08f 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h @@ -35,6 +35,7 @@ namespace ProjectExplorer { class ApplicationLauncher; class RunConfiguration; +class Runnable; class StandardRunnable; } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index d4cf2e95f23..f595b1c2919 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -91,6 +91,16 @@ LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport() delete d; } +bool LinuxDeviceDebugSupport::isCppDebugging() const +{ + return d->cppDebugging; +} + +bool LinuxDeviceDebugSupport::isQmlDebugging() const +{ + return d->qmlDebugging; +} + void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel) { if (state() != Inactive && d->runControl) @@ -142,6 +152,11 @@ void LinuxDeviceDebugSupport::startExecution() connect(launcher, &ApplicationLauncher::remoteProcessStarted, this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted); + launcher->start(realRunnable(), device()); +} + +Runnable LinuxDeviceDebugSupport::realRunnable() const +{ StandardRunnable r = runnable(); QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux); QString command; @@ -161,7 +176,7 @@ void LinuxDeviceDebugSupport::startExecution() } r.executable = command; r.commandLineArguments = QtcProcess::joinArgs(args, OsTypeLinux); - launcher->start(r, device()); + return r; } void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error) diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index 7db0806ef5a..33e130ba2b8 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -43,6 +43,10 @@ public: ~LinuxDeviceDebugSupport() override; protected: + virtual ProjectExplorer::Runnable realRunnable() const; + bool isCppDebugging() const; + bool isQmlDebugging() const; + void startExecution() override; void handleAdapterSetupFailed(const QString &error) override; void handleAdapterSetupDone() override;