RemoteLinux: Get rid of redundant construction of command prefix.

Also remove unused function.

Change-Id: If3c1d7b61bb44bf8f40cf9443fe5bc93b2a9dc14
Reviewed-on: http://codereview.qt.nokia.com/268
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-05-31 14:40:00 +02:00
parent fad03acbd0
commit f516fc55fe
7 changed files with 21 additions and 37 deletions

View File

@@ -75,11 +75,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(RemoteLinuxRunConfiguration
if (runConfig->useRemoteGdb()) {
params.startMode = StartRemoteGdb;
params.executable = runConfig->remoteExecutableFilePath();
params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->deviceConfig()->osVersion(),
runConfig->deviceConfig()->sshParameters().userName,
runConfig->remoteExecutableFilePath())
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges())
+ QLatin1String(" /usr/bin/gdb");
params.debuggerCommand = runConfig->commandPrefix() + QLatin1String(" /usr/bin/gdb");
params.connParams = devConf->sshParameters();
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
params.remoteMountPoint
@@ -127,7 +123,6 @@ MaemoDebugSupport::MaemoDebugSupport(RemoteLinuxRunConfiguration *runConfig,
m_deviceConfig(m_runConfig->deviceConfig()),
m_runner(new MaemoSshRunner(this, runConfig, true)),
m_debuggingType(runConfig->debuggingType()),
m_userEnvChanges(runConfig->userEnvironmentChanges()),
m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1),
m_useGdb(useGdb)
{
@@ -205,9 +200,6 @@ void MaemoDebugSupport::startExecution()
SLOT(handleRemoteProcessStarted()));
}
const QString &remoteExe = m_runner->remoteExecutable();
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(m_deviceConfig->osVersion(),
m_deviceConfig->sshParameters().userName, remoteExe);
const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges);
QString args = m_runner->arguments();
if (m_debuggingType != RemoteLinuxRunConfiguration::DebugCppOnly) {
args += QString(QLatin1String(" -qmljsdebugger=port:%1,block"))
@@ -215,11 +207,9 @@ void MaemoDebugSupport::startExecution()
}
const QString remoteCommandLine = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly
? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env)
.arg(remoteExe).arg(args)
: QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5")
.arg(cmdPrefix).arg(env).arg(m_gdbServerPort)
.arg(remoteExe).arg(args);
? QString::fromLocal8Bit("%1 %2 %3").arg(m_runner->commandPrefix()).arg(remoteExe).arg(args)
: QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4").arg(m_runner->commandPrefix())
.arg(m_gdbServerPort).arg(remoteExe).arg(args);
connect(m_runner, SIGNAL(remoteProcessFinished(qint64)),
SLOT(handleRemoteProcessFinished(qint64)));
m_runner->startExecution(remoteCommandLine.toUtf8());

View File

@@ -34,8 +34,6 @@
#include "remotelinuxrunconfiguration.h"
#include <utils/environment.h>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QSharedPointer>
@@ -90,7 +88,6 @@ private:
const QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfig;
MaemoSshRunner * const m_runner;
const RemoteLinuxRunConfiguration::DebuggingType m_debuggingType;
const QList<Utils::EnvironmentItem> m_userEnvChanges;
QByteArray m_gdbserverOutput;
State m_state;

View File

@@ -96,11 +96,8 @@ void MaemoRunControl::handleSshError(const QString &error)
void MaemoRunControl::startExecution()
{
appendMessage(tr("Starting remote process ...\n"), Utils::NormalMessageFormat);
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(),
m_runner->connection()->connectionParameters().userName,
m_runner->remoteExecutable()))
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3")
.arg(m_runner->commandPrefix())
.arg(m_runner->remoteExecutable())
.arg(m_runner->arguments()).toUtf8());
}

View File

@@ -62,7 +62,7 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent,
m_devConfig(runConfig->deviceConfig()),
m_remoteExecutable(runConfig->remoteExecutableFilePath()),
m_appArguments(runConfig->arguments()),
m_userEnvChanges(runConfig->userEnvironmentChanges()),
m_commandPrefix(runConfig->commandPrefix()),
m_initialFreePorts(runConfig->freePorts()),
m_mountSpecs(runConfig->remoteMounts()->mountSpecs()),
m_state(Inactive)

View File

@@ -35,8 +35,6 @@
#include "linuxdeviceconfiguration.h"
#include "maemomountspecification.h"
#include <utils/environment.h>
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QStringList>
@@ -71,7 +69,7 @@ public:
PortList *freePorts() { return &m_freePorts; }
QString remoteExecutable() const { return m_remoteExecutable; }
QString arguments() const { return m_appArguments; }
QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; }
QString commandPrefix() const { return m_commandPrefix; }
const QSharedPointer<const LinuxDeviceConfiguration> devConfig() const { return m_devConfig; }
static const qint64 InvalidExitCode;
@@ -116,7 +114,7 @@ private:
const QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
const QString m_remoteExecutable;
const QString m_appArguments;
const QList<Utils::EnvironmentItem> m_userEnvChanges;
const QString m_commandPrefix;
const PortList m_initialFreePorts;
QList<MaemoMountSpecification> m_mountSpecs;

View File

@@ -292,20 +292,22 @@ AbstractLinuxDeviceDeployStep *RemoteLinuxRunConfiguration::deployStep() const
return MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(deployConfig(), 0);
}
QString RemoteLinuxRunConfiguration::targetRoot() const
{
QTC_ASSERT(activeQt4BuildConfiguration(), return QString());
QtSupport::BaseQtVersion *v = activeQt4BuildConfiguration()->qtVersion();
if (!v)
return QString();
return MaemoGlobal::targetRoot(v->qmakeCommand());
}
QString RemoteLinuxRunConfiguration::arguments() const
{
return m_d->arguments;
}
QString RemoteLinuxRunConfiguration::commandPrefix() const
{
if (!deviceConfig())
return QString();
return QString::fromLocal8Bit("%1 %2")
.arg(MaemoGlobal::remoteCommandPrefix(deviceConfig()->osVersion(),
deviceConfig()->sshParameters().userName, remoteExecutableFilePath()))
.arg(MaemoGlobal::remoteEnvironment(userEnvironmentChanges()));
}
QString RemoteLinuxRunConfiguration::localDirToMountForRemoteGdb() const
{
const QString projectDir

View File

@@ -96,8 +96,8 @@ public:
QString localExecutableFilePath() const;
QString remoteExecutableFilePath() const;
QString targetRoot() const;
QString arguments() const;
QString commandPrefix() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const;
PortList freePorts() const;
bool useRemoteGdb() const;