Android: Hide gdbPathFromNdk() and lldbPathFromNdk() in cpp

Change-Id: I9f5923971dfa9e4431873734bb4195b565337229
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jarek Kobus
2024-05-21 11:58:00 +02:00
parent ff0074415e
commit d4464d8f49
2 changed files with 25 additions and 30 deletions

View File

@@ -212,6 +212,29 @@ static QLatin1String toolchainPrefix(const Abi &abi)
}
}
static FilePath gdbPathFromNdk(const Abi &abi, const FilePath &ndkLocation)
{
const FilePath path = ndkLocation.pathAppended(
QString("prebuilt/%1/bin/gdb%2").arg(AndroidConfig::toolchainHostFromNdk(ndkLocation),
QString(QTC_HOST_EXE_SUFFIX)));
if (path.exists())
return path;
// fallback for old NDKs (e.g. 10e)
return ndkLocation.pathAppended(QString("toolchains/%1-4.9/prebuilt/%2/bin/%3-gdb%4")
.arg(toolchainPrefix(abi),
AndroidConfig::toolchainHostFromNdk(ndkLocation),
toolsPrefix(abi),
QString(QTC_HOST_EXE_SUFFIX)));
}
static FilePath lldbPathFromNdk(const FilePath &ndkLocation)
{
const FilePath path = ndkLocation.pathAppended(
QString("toolchains/llvm/prebuilt/%1/bin/lldb%2")
.arg(AndroidConfig::toolchainHostFromNdk(ndkLocation), QString(QTC_HOST_EXE_SUFFIX)));
return path.exists() ? path : FilePath();
}
//////////////////////////////////
// AndroidConfig
//////////////////////////////////
@@ -601,31 +624,6 @@ FilePath AndroidConfig::gdbPath(const Abi &abi, const QtVersion *qtVersion) cons
return gdbPathFromNdk(abi, ndkLocation(qtVersion));
}
FilePath AndroidConfig::gdbPathFromNdk(const Abi &abi, const FilePath &ndkLocation)
{
const FilePath path = ndkLocation.pathAppended(
QString("prebuilt/%1/bin/gdb%2").arg(toolchainHostFromNdk(ndkLocation),
QString(QTC_HOST_EXE_SUFFIX)));
if (path.exists())
return path;
// fallback for old NDKs (e.g. 10e)
return ndkLocation.pathAppended(QString("toolchains/%1-4.9/prebuilt/%2/bin/%3-gdb%4")
.arg(toolchainPrefix(abi),
toolchainHostFromNdk(ndkLocation),
toolsPrefix(abi),
QString(QTC_HOST_EXE_SUFFIX)));
}
FilePath AndroidConfig::lldbPathFromNdk(const FilePath &ndkLocation)
{
const FilePath path = ndkLocation.pathAppended(
QString("toolchains/llvm/prebuilt/%1/bin/lldb%2").arg(toolchainHostFromNdk(ndkLocation),
QString(QTC_HOST_EXE_SUFFIX)));
if (path.exists())
return path;
return {};
}
FilePath AndroidConfig::makePathFromNdk(const FilePath &ndkLocation)
{
return ndkLocation.pathAppended(
@@ -1283,14 +1281,14 @@ static QVariant findOrRegisterDebugger(Toolchain *tc,
bool customDebugger = false)
{
const FilePath ndk = static_cast<AndroidToolchain *>(tc)->ndkLocation();
const FilePath lldbCommand = androidConfig().lldbPathFromNdk(ndk);
const FilePath lldbCommand = lldbPathFromNdk(ndk);
const Debugger::DebuggerItem *existingLldb = existingDebugger(lldbCommand,
Debugger::LldbEngineType);
// Return existing debugger with same command - prefer lldb (limit to sdk/ndk min version?)
if (existingLldb)
return existingLldb->id();
const FilePath gdbCommand = androidConfig().gdbPathFromNdk(tc->targetAbi(), ndk);
const FilePath gdbCommand = gdbPathFromNdk(tc->targetAbi(), ndk);
// check if the debugger is already registered, but ignoring the display name
const Debugger::DebuggerItem *existingGdb = existingDebugger(gdbCommand,

View File

@@ -104,9 +104,6 @@ public:
static Utils::FilePath clangPathFromNdk(const Utils::FilePath &ndkLocation);
Utils::FilePath gdbPath(const ProjectExplorer::Abi &abi, const QtSupport::QtVersion *qtVersion) const;
static Utils::FilePath gdbPathFromNdk(const ProjectExplorer::Abi &abi,
const Utils::FilePath &ndkLocation);
static Utils::FilePath lldbPathFromNdk(const Utils::FilePath &ndkLocation);
static Utils::FilePath makePathFromNdk(const Utils::FilePath &ndkLocation);
Utils::FilePath keytoolPath() const;