[Lldb-commits] [lldb] [lldb/test] Fix TestExpeditedThreadPCs on remote-darwin targets (PR #201275)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 3 00:10:04 PDT 2026
https://github.com/medismailben updated https://github.com/llvm/llvm-project/pull/201275
>From e2191969bc0dd8d98bf162cb26ddc27099f944cc Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Wed, 3 Jun 2026 00:09:42 -0700
Subject: [PATCH] [lldb/test] Fix TestExpeditedThreadPCs on remote-darwin
targets
Two distinct bugs were preventing TestExpeditedThreadPCs from running
on remote-darwin: the test wasn't deploying libfoo.dylib to the
device, and the post-load assertion was guarded by an uninitialized
local that raised UnboundLocalError instead of a clean assertion
failure when the dylib was missing.
1. main.cpp does dlopen("libfoo.dylib", RTLD_LAZY) at runtime, but
run_to_source_breakpoint was called without
extra_images=['foo'], so libfoo.dylib (linked with install_name
@executable_path/libfoo.dylib) was never deployed to the device.
dlopen returned NULL on the device and libfoo never showed up in
target.modules; the post-step assertTrue(found_libfoo) then
failed with "False is not true".
Add extra_images=['foo'] so registerSharedLibrariesWithTarget
deploys libfoo.dylib next to a.out on the remote target.
2. found_libfoo was only assigned inside the if-branch of the for
loop, so when libfoo.dylib was not present in target.modules
(the bug above) the assertTrue(found_libfoo) raised
UnboundLocalError instead of producing the intended assertion
failure message. Initialize the flag to False up front so the
original assertion fires cleanly when something else does go
wrong.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
---
.../macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py b/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py
index 0611907a34b0d..7416268805460 100644
--- a/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py
+++ b/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py
@@ -34,7 +34,10 @@ def cleanup():
self.source = "main.cpp"
self.build()
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
- self, "break here", lldb.SBFileSpec(self.source, False)
+ self,
+ "break here",
+ lldb.SBFileSpec(self.source, False),
+ extra_images=["foo"],
)
# verify that libfoo.dylib hasn't loaded yet
@@ -49,6 +52,7 @@ def cleanup():
thread.StepInto()
# verify that libfoo.dylib has loaded
+ found_libfoo = False
for m in target.modules:
if m.GetFileSpec().GetFilename() == "libfoo.dylib":
found_libfoo = True
More information about the lldb-commits
mailing list