forked from qt-creator/qt-creator
Android: Search LLDB in new SDK location
Amends 3e79c7da48
.
Change-Id: I6db991bc4d82000e0bb9860d85676bf1fdfb09a6
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -49,6 +49,8 @@
|
|||||||
#include <utils/url.h>
|
#include <utils/url.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QDirIterator>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
@@ -186,11 +188,35 @@ static QString lldbServerArch(const QString &androidAbi)
|
|||||||
return androidAbi; // arm64-v8a, x86, x86_64
|
return androidAbi; // arm64-v8a, x86, x86_64
|
||||||
}
|
}
|
||||||
|
|
||||||
static FilePath lldbServer(const QString &androidAbi)
|
static QString lldbServerArch2(const QString &androidAbi)
|
||||||
|
{
|
||||||
|
if (androidAbi == "armeabi-v7a")
|
||||||
|
return {"arm"};
|
||||||
|
if (androidAbi == "x86")
|
||||||
|
return {"i386"};
|
||||||
|
if (androidAbi == "arm64-v8a")
|
||||||
|
return {"aarch64"};
|
||||||
|
// Correct for "x86_64" a and best guess at anything that will evolve:
|
||||||
|
return androidAbi; // arm64-v8a
|
||||||
|
}
|
||||||
|
|
||||||
|
static FilePath lldbServer(const QString &androidAbi, const QtSupport::BaseQtVersion *qtVersion)
|
||||||
{
|
{
|
||||||
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
||||||
|
const FilePath prebuilt = config.ndkLocation(qtVersion) / "toolchains/llvm/prebuilt";
|
||||||
|
const QString abiNeedle = lldbServerArch2(androidAbi);
|
||||||
|
|
||||||
// Find LLDB version. sdk_definitions.json contains something like "lldb;3.1". Use that.
|
// The new, built-in LLDB.
|
||||||
|
QDirIterator it(prebuilt.toString(), QDir::Files|QDir::Executable, QDirIterator::Subdirectories);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
const QString filePath = it.filePath();
|
||||||
|
if (filePath.endsWith(abiNeedle + "/lldb-server")) {
|
||||||
|
return FilePath::fromString(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Older: Find LLDB version. sdk_definitions.json contains something like "lldb;3.1". Use that.
|
||||||
const QStringList packages = config.defaultEssentials();
|
const QStringList packages = config.defaultEssentials();
|
||||||
for (const QString &package : packages) {
|
for (const QString &package : packages) {
|
||||||
if (package.startsWith("lldb;")) {
|
if (package.startsWith("lldb;")) {
|
||||||
@@ -282,7 +308,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
|
|||||||
QString preferredAbi = AndroidManager::apkDevicePreferredAbi(target);
|
QString preferredAbi = AndroidManager::apkDevicePreferredAbi(target);
|
||||||
if (!preferredAbi.isEmpty()) {
|
if (!preferredAbi.isEmpty()) {
|
||||||
if (m_useLldb)
|
if (m_useLldb)
|
||||||
m_debugServerPath = lldbServer(preferredAbi).toString();
|
m_debugServerPath = lldbServer(preferredAbi, version).toString();
|
||||||
else
|
else
|
||||||
m_debugServerPath = gdbServer(preferredAbi, version).toString();
|
m_debugServerPath = gdbServer(preferredAbi, version).toString();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user