forked from qt-creator/qt-creator
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:
@@ -35,6 +35,7 @@
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class ApplicationLauncher;
|
class ApplicationLauncher;
|
||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
|
class Runnable;
|
||||||
class StandardRunnable;
|
class StandardRunnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,6 +91,16 @@ LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LinuxDeviceDebugSupport::isCppDebugging() const
|
||||||
|
{
|
||||||
|
return d->cppDebugging;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LinuxDeviceDebugSupport::isQmlDebugging() const
|
||||||
|
{
|
||||||
|
return d->qmlDebugging;
|
||||||
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
|
void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
|
||||||
{
|
{
|
||||||
if (state() != Inactive && d->runControl)
|
if (state() != Inactive && d->runControl)
|
||||||
@@ -142,6 +152,11 @@ void LinuxDeviceDebugSupport::startExecution()
|
|||||||
connect(launcher, &ApplicationLauncher::remoteProcessStarted,
|
connect(launcher, &ApplicationLauncher::remoteProcessStarted,
|
||||||
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
|
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
|
||||||
|
|
||||||
|
launcher->start(realRunnable(), device());
|
||||||
|
}
|
||||||
|
|
||||||
|
Runnable LinuxDeviceDebugSupport::realRunnable() const
|
||||||
|
{
|
||||||
StandardRunnable r = runnable();
|
StandardRunnable r = runnable();
|
||||||
QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux);
|
QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux);
|
||||||
QString command;
|
QString command;
|
||||||
@@ -161,7 +176,7 @@ void LinuxDeviceDebugSupport::startExecution()
|
|||||||
}
|
}
|
||||||
r.executable = command;
|
r.executable = command;
|
||||||
r.commandLineArguments = QtcProcess::joinArgs(args, OsTypeLinux);
|
r.commandLineArguments = QtcProcess::joinArgs(args, OsTypeLinux);
|
||||||
launcher->start(r, device());
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
||||||
|
@@ -43,6 +43,10 @@ public:
|
|||||||
~LinuxDeviceDebugSupport() override;
|
~LinuxDeviceDebugSupport() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual ProjectExplorer::Runnable realRunnable() const;
|
||||||
|
bool isCppDebugging() const;
|
||||||
|
bool isQmlDebugging() const;
|
||||||
|
|
||||||
void startExecution() override;
|
void startExecution() override;
|
||||||
void handleAdapterSetupFailed(const QString &error) override;
|
void handleAdapterSetupFailed(const QString &error) override;
|
||||||
void handleAdapterSetupDone() override;
|
void handleAdapterSetupDone() override;
|
||||||
|
Reference in New Issue
Block a user