forked from qt-creator/qt-creator
Android: Move gdbserver path determination to androidrunnerworker.cpp
That's the only user, and it's easier to extend to handle LLDB there. Change-Id: I7ce236e2ff509b419d52b10d086a75ff0c2ea14b Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
@@ -888,31 +888,6 @@ FilePath AndroidConfig::defaultNdkLocation() const
|
||||
return sdkLocation().pathAppended(m_defaultSdkDepends.ndkPath);
|
||||
}
|
||||
|
||||
static inline QString gdbServerArch(const QString &androidAbi)
|
||||
{
|
||||
if (androidAbi == "arm64-v8a") {
|
||||
return QString("arm64");
|
||||
} else if (androidAbi == "armeabi-v7a") {
|
||||
return QString("arm");
|
||||
} else if (androidAbi == "x86_64") {
|
||||
return QString("x86_64");
|
||||
} else if (androidAbi == "x86") {
|
||||
return QString("x86");
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
FilePath AndroidConfig::gdbServer(const QString &androidAbi, const BaseQtVersion *qtVersion) const
|
||||
{
|
||||
const FilePath path = AndroidConfigurations::currentConfig().ndkLocation(qtVersion)
|
||||
.pathAppended(QString("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(gdbServerArch(androidAbi)));
|
||||
if (path.exists())
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
QVersionNumber AndroidConfig::ndkVersion(const BaseQtVersion *qtVersion) const
|
||||
{
|
||||
return ndkVersion(ndkLocation(qtVersion));
|
||||
|
@@ -124,7 +124,6 @@ public:
|
||||
|
||||
Utils::FilePath ndkLocation(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
Utils::FilePath defaultNdkLocation() const;
|
||||
Utils::FilePath gdbServer(const QString &androidAbi, const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
QVersionNumber ndkVersion(const QtSupport::BaseQtVersion *qtVersion) const;
|
||||
QVersionNumber ndkVersion(const Utils::FilePath &ndkPath) const;
|
||||
|
||||
|
@@ -156,6 +156,26 @@ static void deleter(QProcess *p)
|
||||
p->deleteLater();
|
||||
}
|
||||
|
||||
static QString gdbServerArch(const QString &androidAbi)
|
||||
{
|
||||
if (androidAbi == "arm64-v8a")
|
||||
return QString("arm64");
|
||||
if (androidAbi == "armeabi-v7a")
|
||||
return QString("arm");
|
||||
// That's correct for "x86_64" and "x86", and best guess at anything that will evolve:
|
||||
return androidAbi;
|
||||
}
|
||||
|
||||
static FilePath gdbServer(const QString &androidAbi, const QtSupport::BaseQtVersion *qtVersion)
|
||||
{
|
||||
const FilePath path = AndroidConfigurations::currentConfig().ndkLocation(qtVersion)
|
||||
.pathAppended(QString("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(gdbServerArch(androidAbi)));
|
||||
if (path.exists())
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packageName)
|
||||
: m_packageName(packageName)
|
||||
, m_adbLogcatProcess(nullptr, deleter)
|
||||
@@ -228,8 +248,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
|
||||
QString preferredAbi = AndroidManager::apkDevicePreferredAbi(target);
|
||||
if (!preferredAbi.isEmpty())
|
||||
m_debugServerPath = AndroidConfigurations::currentConfig()
|
||||
.gdbServer(preferredAbi, version).toString();
|
||||
m_debugServerPath = gdbServer(preferredAbi, version).toString();
|
||||
m_useAppParamsForQmlDebugger = version->qtVersion() >= QtSupport::QtVersionNumber(5, 12);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user