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 <ulf.hermann@qt.io>
This commit is contained in:
hjk
2017-03-24 11:26:33 +01:00
parent 2360a2d743
commit 9250c19007
3 changed files with 21 additions and 1 deletions

View File

@@ -35,6 +35,7 @@
namespace ProjectExplorer {
class ApplicationLauncher;
class RunConfiguration;
class Runnable;
class StandardRunnable;
}

View File

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

View File

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