aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2021-11-08 11:44:10 +0100
committerChristian Stenger <christian.stenger@qt.io>2021-11-08 11:40:49 +0000
commit50b23958046a617c9182f4f44fa09b310449b24e (patch)
treeebd279b0e7af4f660fe0b0fe2947976b0a6139fe
parent39d2fc91fdcbca87d9adf915906433fc6ce79eec (diff)
Debugger: Fix running android lldb
..when gathering version information. Change-Id: I99d69de661edad856fe66a045e8e2ee03036dd2c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--src/plugins/debugger/debuggeritem.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/debugger/debuggeritem.cpp b/src/plugins/debugger/debuggeritem.cpp
index 2f71c8606b..2e689ae9d3 100644
--- a/src/plugins/debugger/debuggeritem.cpp
+++ b/src/plugins/debugger/debuggeritem.cpp
@@ -144,6 +144,8 @@ void DebuggerItem::createId()
void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *error)
{
+ const bool isAndroid = m_command.path().contains("/ndk/")
+ || m_command.path().contains("/ndk-bundle/");
// CDB only understands the single-dash -version, whereas GDB and LLDB are
// happy with both -version and --version. So use the "working" -version
// except for the experimental LLDB-MI which insists on --version.
@@ -167,7 +169,8 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *erro
// Prevent calling lldb on Windows because the lldb from the llvm package is linked against
// python but does not contain a python dll.
- if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb")) {
+ if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb")
+ && !isAndroid) {
QString errorMessage;
m_version = winGetDLLVersion(WinDLLFileVersion,
m_command.absoluteFilePath().path(),
@@ -177,8 +180,18 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *erro
return;
}
+ Environment env = sysEnv.toProcessEnvironment().isEmpty() ? Environment::systemEnvironment()
+ : sysEnv;
+ if (isAndroid && m_command.fileName().startsWith("lldb")) {
+ FilePath pythonPath = m_command.parentDir().parentDir().pathAppended("python3");
+ if (HostOsInfo::isAnyUnixHost())
+ pythonPath = pythonPath.pathAppended("bin");
+ if (pythonPath.exists())
+ env.prependOrSetPath(pythonPath.toUserOutput());
+ }
+
QtcProcess proc;
- proc.setEnvironment(sysEnv);
+ proc.setEnvironment(env);
proc.setCommand({m_command, {version}});
proc.runBlocking();
const QString output = proc.allOutput().trimmed();