Introduce the concept of a "device process".

Provide a QProcess-like abstraction that can be used
to implement processes running locally or on a remote
device. Objects of a concrete class implementing the functionality
are created by IDevice objects.
Current implementations are:
     - Local execution (QProcess-based), provided via the DesktopDevice.
     - Remote execution via SSH.
     - A specialized case of the former for remote Linux systems (provided by
       LinuxDevice).
The latter is already being used in a number of places. As a result, lots of
code dealing with details such as setting the remote environment could be
moved to a central location. These things are no longer the concern of whoever
is wishing to run a remote process.

Change-Id: I919260ee6e77a020ca47226a4a534e7b8398106f
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Christian Kandeler
2013-08-08 14:05:11 +02:00
parent dc07796c23
commit 22599094b0
48 changed files with 1214 additions and 208 deletions

View File

@@ -98,7 +98,7 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const RemoteLin
}
if (aspect->useCppDebugger()) {
params.languages |= CppLanguage;
params.processArgs = runConfig->arguments();
params.processArgs = runConfig->arguments().join(QLatin1String(" "));
params.startMode = AttachToRemoteServer;
params.executable = runConfig->localExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
@@ -162,17 +162,23 @@ void LinuxDeviceDebugSupport::startExecution()
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
if (d->qmlDebugging && !d->cppDebugging)
connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted()));
QString args = arguments();
QString command;
QStringList args = arguments();
if (d->qmlDebugging)
args += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(d->qmlPort);
const QString remoteCommandLine = (d->qmlDebugging && !d->cppDebugging)
? QString::fromLatin1("%1 %2 %3").arg(commandPrefix()).arg(remoteFilePath()).arg(args)
: QString::fromLatin1("%1 gdbserver :%2 %3 %4").arg(commandPrefix())
.arg(d->gdbServerPort).arg(remoteFilePath()).arg(args);
args += QString::fromLocal8Bit("-qmljsdebugger=port:%1,block").arg(d->qmlPort);
if (d->qmlDebugging && !d->cppDebugging) {
command = remoteFilePath();
} else {
command = QLatin1String("gdbserver");
args.prepend(remoteFilePath());
args.prepend(QString::fromLatin1(":%1").arg(d->gdbServerPort));
}
connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool)));
connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString)));
connect(runner, SIGNAL(reportError(QString)), SLOT(handleAppRunnerError(QString)));
runner->start(device(), remoteCommandLine.toUtf8());
runner->setEnvironment(environment());
runner->setWorkingDirectory(workingDirectory());
runner->start(device(), command, args);
}
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)