llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

<details>
<summary>Changes</summary>

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.

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


1 Files Affected:

- (modified) 
lldb/test/API/macosx/expedited-thread-pcs/TestExpeditedThreadPCs.py (+3-1) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/201275
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to