aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2021-11-08 11:37:19 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2021-11-08 10:57:32 +0000
commit5c0c3ff6cad1c2cb2227f07b9c5b7ecf6c27dbf5 (patch)
tree90b1b1c36dcbc18f50e32028be12eafd20045d3b
parentd06ddd12b605c08f4f0387bc346380b7c79299c6 (diff)
Debugger: Also look for "/ndk/" path segment in LldbEngine::setupEngine
And pull the env-modifying code into a function which we might want to use in other places where lldb gets executed. Change-Id: Ic9caaf8c29896c54d67c969d2812b4da627a5fc0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/debugger/lldb/lldbengine.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp
index a5440edb7f..ad2f4f2974 100644
--- a/src/plugins/debugger/lldb/lldbengine.cpp
+++ b/src/plugins/debugger/lldb/lldbengine.cpp
@@ -204,6 +204,18 @@ static QString adapterStartFailed()
return LldbEngine::tr("Adapter start failed.");
}
+static void addAndroidPythonDir(const FilePath &lldbCmd, Environment &env)
+{
+ if (!lldbCmd.path().contains("/ndk/") && !lldbCmd.path().contains("/ndk-bundle/"))
+ return;
+
+ FilePath androidPythonDir = lldbCmd.parentDir().parentDir().pathAppended("python3");
+ if (HostOsInfo::isAnyUnixHost())
+ androidPythonDir = androidPythonDir.pathAppended("bin");
+ if (androidPythonDir.exists())
+ env.prependOrSetPath(androidPythonDir.path());
+}
+
void LldbEngine::setupEngine()
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
@@ -213,13 +225,7 @@ void LldbEngine::setupEngine()
showMessage("STARTING LLDB: " + lldbCmd.toUserOutput());
Environment environment = runParameters().debugger.environment;
environment.appendOrSet("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS
- if (lldbCmd.path().contains("/ndk-bundle/")) {
- FilePath androidPythonDir = lldbCmd.parentDir().parentDir().pathAppended("python3");
- if (HostOsInfo::isAnyUnixHost())
- androidPythonDir = androidPythonDir.pathAppended("bin");
- if (androidPythonDir.exists())
- environment.prependOrSetPath(androidPythonDir.path());
- }
+ addAndroidPythonDir(lldbCmd, environment);
m_lldbProc.setEnvironment(environment);
if (runParameters().debugger.workingDirectory.isDir())