Debugger: Fix LLDB start on Ubuntu 22.04

The LLDB (14) installation on Ubuntu 22.04 is broken, see
https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855

Work around by using a corrected PYTHONPATH when starting LLDB.

Change-Id: I9bede8f146c32f60247ca3416a14cf9ccf4b0fb6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-06-17 17:10:38 +02:00
parent 3b8b247f88
commit e980d87b50

View File

@@ -203,6 +203,22 @@ void LldbEngine::setupEngine()
Environment environment = runParameters().debugger.environment; Environment environment = runParameters().debugger.environment;
environment.appendOrSet("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS environment.appendOrSet("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS
DebuggerItem::addAndroidLldbPythonEnv(lldbCmd, environment); DebuggerItem::addAndroidLldbPythonEnv(lldbCmd, environment);
if (lldbCmd.osType() == OsTypeLinux) {
// LLDB 14 installation on Ubuntu 22.04 is broken:
// https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855
// Brush over it:
QtcProcess lldbPythonPathFinder;
lldbPythonPathFinder.setCommand({lldbCmd, {"-P"}});
lldbPythonPathFinder.start();
lldbPythonPathFinder.waitForFinished();
QString lldbPythonPath = lldbPythonPathFinder.cleanedStdOut();
if (lldbPythonPath.endsWith('\n'))
lldbPythonPath.chop(1);
if (lldbPythonPath == "/usr/lib/local/lib/python3.10/dist-packages")
environment.appendOrSet("PYTHONPATH", "/usr/lib/llvm-14/lib/python3.10/dist-packages");
}
m_lldbProc.setEnvironment(environment); m_lldbProc.setEnvironment(environment);
if (runParameters().debugger.workingDirectory.isDir()) if (runParameters().debugger.workingDirectory.isDir())