llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Kendal Harland (kendalharland)

<details>
<summary>Changes</summary>

In python 3.8 PATH is no longer used to search for DLLs on Windows. When 
building Swift's patched version of LLDB this prevents LLDB from starting up, 
because it cannot find DLLs like swiftCore.dll, cmark-gfm.dll, etc. This PR 
adds a flag that can be passed to manually add specific directories as DLL 
search paths. This is preferred over simply expanding all directories in PATH 
which would recreate the code-injection security issues that the Python 3.8 
change was designed to address.

For context in this change to Python 3.8, see: 
https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew

Fixes https://github.com/llvm/llvm-project/issues/46235

---
Full diff: https://github.com/llvm/llvm-project/pull/104514.diff


2 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+4) 
- (modified) lldb/packages/Python/lldbsuite/test/dotest_args.py (+6) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index f14a00a2394b0b..aa9581a0aedc23 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -219,6 +219,10 @@ def parseOptionsAndInitTestdirs():
     except:
         raise
 
+    if args.dll_directory:
+        for dir in args.dll_directory:
+            os.add_dll_directory(dir)
+
     if args.unset_env_varnames:
         for env_var in args.unset_env_varnames:
             if env_var in os.environ:
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py 
b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index a80428ebec5891..cdcc659df61b1f 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -321,6 +321,12 @@ def create_parser():
         action="append",
         help="Specify an environment variable to set to the given value for 
the inferior.",
     )
+    # See https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew.
+    group.add_argument(
+        "--dll-directory",
+        action="append",
+        help="Specify a directory to include when searching for .dll files. 
This can be passed multiple times.",
+    )
     X(
         "-v",
         "Do verbose mode of unittest framework (print out each test case 
invocation)",

``````````

</details>


https://github.com/llvm/llvm-project/pull/104514
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to