[Lldb-commits] [lldb] [lldb][rpc] Add sysroot to lldb-rpc-gen test suite invocation (PR #151291)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 30 00:59:00 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Chelsea Cassanova (chelcassanova)

<details>
<summary>Changes</summary>

When running the lldb-rpc-gen tests On Darwin platforms, the sysroot needs to be added to the test invocation. Without it, basic includes will not be resolved and the test will fail.

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


1 Files Affected:

- (modified) lldb/test/Shell/helper/toolchain.py (+11) 


``````````diff
diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py
index 728f6347242f1..e3bf3123d3c94 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -119,6 +119,16 @@ def use_lldb_substitutions(config):
 
     lldb_init = _get_lldb_init_path(config)
 
+    if platform.system() in ["Darwin"]:
+        try:
+            out = subprocess.check_output(["xcrun", "--show-sdk-path"]).strip()
+            res = 0
+        except OSError:
+            res = -1
+        if res == 0 and out:
+            sdk_path = lit.util.to_string(out)
+            sysroot_arg = sdk_path
+
     primary_tools = [
         ToolSubst(
             "%lldb",
@@ -163,6 +173,7 @@ def use_lldb_substitutions(config):
             extra_args=[
                 "-p " + config.lldb_build_directory + "/..",
                 '--extra-arg="-resource-dir=' + config.clang_resource_dir + '"',
+                '--extra-arg="--sysroot=' + sysroot_arg + '"',
             ],
             unresolved="ignore",
         ),

``````````

</details>


https://github.com/llvm/llvm-project/pull/151291


More information about the lldb-commits mailing list