[Lldb-commits] [lldb] [lldb/test] Fix BacktraceRecording path for newer Darwin embedded devices (NFC) (PR #193436)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 22 00:54:55 PDT 2026
https://github.com/medismailben created https://github.com/llvm/llvm-project/pull/193436
rdar://172707080
>From 2c533ff1cba914985e92063bbc3e9cf3614842d0 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Tue, 21 Apr 2026 23:56:08 -0700
Subject: [PATCH] [lldb/test] Fix BacktraceRecording path for newer Darwin
embedded devices (NFC)
rdar://172707080
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
---
.../Python/lldbsuite/test/lldbplatformutil.py | 2 ++
.../TestExtendedBacktraceAPI.py | 22 ++++---------------
lldb/test/API/macosx/queues/TestQueues.py | 20 ++++-------------
3 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 39b52d6844bee..a394c041d1233 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -203,6 +203,8 @@ def findBacktraceRecordingDylib():
return ""
if getPlatform() in lldbplatform.translate(lldbplatform.darwin_embedded):
+ if getDarwinEmbeddedKernelVersion() >= 26:
+ return "/usr/lib/libBacktraceRecording.dylib"
return "/Developer/usr/lib/libBacktraceRecording.dylib"
with os.popen("xcode-select -p") as output:
diff --git a/lldb/test/API/macosx/extended-backtrace-api/TestExtendedBacktraceAPI.py b/lldb/test/API/macosx/extended-backtrace-api/TestExtendedBacktraceAPI.py
index 0e9ee0755065e..fb52ae2499a60 100644
--- a/lldb/test/API/macosx/extended-backtrace-api/TestExtendedBacktraceAPI.py
+++ b/lldb/test/API/macosx/extended-backtrace-api/TestExtendedBacktraceAPI.py
@@ -4,6 +4,7 @@
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbplatformutil import findBacktraceRecordingDylib
from lldbsuite.test import lldbutil
@@ -21,25 +22,10 @@ def test_extended_backtrace_thread_api(self):
self.build()
exe = self.getBuildArtifact("a.out")
- # Get Xcode developer directory path.
- # Try DEVELOPER_DIR environment variable first, then fall back to xcode-select.
- xcode_dev_path = os.environ.get("DEVELOPER_DIR")
-
- if not xcode_dev_path:
- import subprocess
-
- xcode_dev_path = (
- subprocess.check_output(["xcode-select", "-p"]).decode("utf-8").strip()
- )
-
- # Check for libBacktraceRecording.dylib.
- libbtr_path = os.path.join(
- xcode_dev_path, "usr/lib/libBacktraceRecording.dylib"
- )
-
+ libbtr_path = findBacktraceRecordingDylib()
self.assertTrue(
- os.path.isfile(libbtr_path),
- f"libBacktraceRecording.dylib is not present at {libbtr_path}",
+ libbtr_path,
+ "libBacktraceRecording.dylib was not found on the system.",
)
self.assertTrue(
diff --git a/lldb/test/API/macosx/queues/TestQueues.py b/lldb/test/API/macosx/queues/TestQueues.py
index 45b52af2fbdba..a1e1aae4f45c1 100644
--- a/lldb/test/API/macosx/queues/TestQueues.py
+++ b/lldb/test/API/macosx/queues/TestQueues.py
@@ -4,6 +4,7 @@
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbplatformutil import findBacktraceRecordingDylib
from lldbsuite.test import lldbutil
@@ -307,11 +308,10 @@ def queues_with_libBacktraceRecording(self):
"""Test queues inspection SB APIs with libBacktraceRecording present."""
exe = self.getBuildArtifact("a.out")
- if not os.path.isfile(
- "/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib"
- ):
+ libbtr_path = findBacktraceRecordingDylib()
+ if not libbtr_path:
self.skipTest(
- "Skipped because libBacktraceRecording.dylib was present on the system."
+ "Skipped because libBacktraceRecording.dylib was not found on the system."
)
if not os.path.isfile("/usr/lib/system/introspection/libdispatch.dylib"):
@@ -327,18 +327,6 @@ def queues_with_libBacktraceRecording(self):
break1 = target.BreakpointCreateByName("stopper", "a.out")
self.assertTrue(break1, VALID_BREAKPOINT)
- # Now launch the process, and do not stop at entry point.
- libbtr_path = "/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib"
- if self.getArchitecture() in [
- "arm",
- "arm64",
- "arm64e",
- "arm64_32",
- "armv7",
- "armv7k",
- ]:
- libbtr_path = "/Developer/usr/lib/libBacktraceRecording.dylib"
-
process = target.LaunchSimple(
[],
[
More information about the lldb-commits
mailing list