https://github.com/medismailben created
https://github.com/llvm/llvm-project/pull/201275
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.
>From 4e86662c9d40590bcdcb43f1d947d00780b1021a Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <[email protected]>
Date: Thu, 28 May 2026 17:01:56 -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.
---
.../API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py | 4 +++-
1 file changed, 3 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..04139eff95238 100644
--- a/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py
+++ b/lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py
@@ -34,7 +34,8 @@ 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 +50,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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits