[all-commits] [llvm/llvm-project] 142ad4: [lldb] Add PythonRuntimeLoader for runtime libpyth...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Tue Jun 2 16:18:09 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 142ad481b6254104a51da7d636ad9e3f30518a32
      https://github.com/llvm/llvm-project/commit/142ad481b6254104a51da7d636ad9e3f30518a32
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M lldb/CMakeLists.txt
    M lldb/cmake/modules/LLDBConfig.cmake
    M lldb/include/lldb/Host/Config.h.cmake
    A lldb/include/lldb/Host/ScriptInterpreterRuntimeLoader.h
    M lldb/include/module.modulemap
    M lldb/source/Host/CMakeLists.txt
    A lldb/source/Host/common/PythonRuntimeLoader.cpp
    A lldb/source/Host/common/PythonRuntimeLoaderInternal.h
    A lldb/source/Host/common/ScriptInterpreterRuntimeLoader.cpp
    A lldb/source/Host/linux/PythonRuntimeLoaderLinux.cpp
    A lldb/source/Host/macosx/PythonRuntimeLoaderDarwin.cpp
    A lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp
    M lldb/unittests/Host/CMakeLists.txt
    A lldb/unittests/Host/PythonRuntimeLoaderTest.cpp

  Log Message:
  -----------
  [lldb] Add PythonRuntimeLoader for runtime libpython lookup (NFC) (#200524)

Generalizes the Windows-only Python lookup in PythonPathSetup into a
cross-platform abstraction. Adds an abstract ScriptInterpreterRuntimeLoader
with a per-language factory. The Python implementation dynamically loads Python
library into the current process.

The loader no-ops when Python is already in the process, then walks
LLDB_PYTHON_LIBRARY env override, the build-time Python
(LLDB_PYTHON_RUNTIME_LIBRARY_BUILD_PATH) and finally a platform candidate list:

- Darwin: DEVELOPER_DIR, the bundled Xcode.app, and Command Line Tools joined
  against Python3.framework. Then python.org, /opt/homebrew, and /usr/local
  joined against Python.framework. Then xcrun -f python3 and if that fails,
  libpython3.dylib as a last resort.
- Linux: libpython3.so plus descending stable-ABI SONAMEs.
- Windows: the LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME bare name (resolved via the
  loader's default search list) and the exe-relative
  LLDB_PYTHON_DLL_RELATIVE_PATH fallback (built off GetModuleFileNameW).
  Pre-mapping python3xx.dll lets the script interpreter plugin's delay-load
  thunks resolve against the already-loaded module by base name on first use.

This commit only introduces the abstraction. No existing call site is changed,
and the script interpreter plugin still hard-links Python, which are part of
two follow-up PRs.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list