Android debugging: Fix pulling of app_process

/system/bin/app_process can be a link to e.g. /system/bin/app_process32,
which we resolve first via "adb shell" before calling "adb pull".

Task-number: QTCREATORBUG-14201
Change-Id: Ic133cf0bcec3234839680584ff4807f443161e6c
Reviewed-by: hjk <hjk@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2015-04-22 14:10:12 +02:00
parent 66fd805809
commit 81c7989301
2 changed files with 17 additions and 6 deletions

View File

@@ -420,17 +420,16 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
emit addOutput(tr("Pulling files necessary for debugging."), MessageOutput);
const QString remoteAppProcessFile = systemAppProcessFilePath();
QString localAppProcessFile = QString::fromLatin1("%1/app_process").arg(m_buildDirectory);
runCommand(m_adbPath,
AndroidDeviceInfo::adbSelector(m_serialNumber)
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
<< QLatin1String("pull") << remoteAppProcessFile
<< localAppProcessFile);
// Workaround for QTCREATORBUG-14201: /system/bin/app_process might be a link to asan/app_process
if (!QFileInfo::exists(localAppProcessFile)) {
runCommand(m_adbPath,
AndroidDeviceInfo::adbSelector(m_serialNumber)
<< QLatin1String("pull") << QLatin1String("/system/bin/asan/app_process")
<< localAppProcessFile);
returnValue = Failure;
emit addOutput(tr("Package deploy: Failed to pull \"%1\" to \"%2\".")
.arg(remoteAppProcessFile).arg(localAppProcessFile), ErrorMessageOutput);
}
runCommand(m_adbPath,
AndroidDeviceInfo::adbSelector(m_serialNumber) << QLatin1String("pull")
@@ -464,6 +463,17 @@ void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &
}
}
QString AndroidDeployQtStep::systemAppProcessFilePath() const
{
QProcess proc;
const QStringList args =
QStringList() << QLatin1String("shell")
<< QLatin1String("readlink -f -s /system/bin/app_process");
proc.start(m_adbPath, args);
proc.waitForFinished();
return QString::fromUtf8(proc.readAll()).trimmed();
}
ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
{
return new AndroidDeployQtWidget(this);

View File

@@ -102,6 +102,7 @@ private:
AndroidDeployQtStep *other);
void ctor();
void runCommand(const QString &program, const QStringList &arguments);
QString systemAppProcessFilePath() const;
bool init();
void run(QFutureInterface<bool> &fi);