Skip to content

Conversation

…vm#162509)

This patch adds the `LLDB_PYTHON_DLL_RELATIVE_PATH` Cmake variable which
is the relative path to the directory containing `python.dll`. The path
is relative to the directory containing `lldb.exe`.

If this variable is set and the resolved path points to an existing
directory, we call `SetDllDirectoryW` to add `python.dll` to the list of
DLL search paths.

This, combined with `liblldb.dll` being delay loaded, allows to package
`python.dll` with the `llvm` installer.
@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/python-check-to-stable branch from f50a26b to f8a6917 Compare November 3, 2025 18:02
@charles-zablit charles-zablit changed the title [lldb][windows] add support for out of PATH python.dll resolution 🍒 [lldb][windows] add support for out of PATH python.dll resolution Nov 3, 2025
@charles-zablit
Copy link
Author

@swift-ci please test

… path (llvm#164893)

This is a follow up to llvm#162509.

Using the `SearchPathW` API, we can ensure that the correct version of
Python is installed before `liblldb` is loaded (and `python.dll`
subsequently). If it's not, we try to add it to the search path with the
methods introduced in llvm#162509.
If that fails or if that method is `#ifdef`'d out, we print an error
which will appear before lldb crashes due to the missing dll.

Before llvm#162509, when invoked
from Powershell, lldb would silently crash (no error message/crash
report). After llvm#162509, it
crashes without any indications that the root cause is the missing
python.dll. With this patch, we print the error before crashing.
@charles-zablit
Copy link
Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants