Author: Michael Buch Date: 2022-12-05T18:14:26Z New Revision: e31160155e484414db9177806ae9f0840c985b49
URL: https://github.com/llvm/llvm-project/commit/e31160155e484414db9177806ae9f0840c985b49 DIFF: https://github.com/llvm/llvm-project/commit/e31160155e484414db9177806ae9f0840c985b49.diff LOG: [lldb][Test] TestRerunAndExprDylib.py on Linux: dlclose solib to force destruction module Previously we didn't properly trigger the destructor of the `lldb_private::Module` backing `libfoo.so`. So the newly rebuilt version wouldn't actually be loaded on a program re-run. The test expects the fresh module to be loaded. Added: Modified: lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py lldb/test/API/functionalities/rerun_and_expr_dylib/main.cpp Removed: ################################################################################ diff --git a/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py b/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py index cf322215a65a1..93e586237b99c 100644 --- a/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py +++ b/lldb/test/API/functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py @@ -45,7 +45,8 @@ def test(self): exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) - breakpoint = target.BreakpointCreateBySourceRegex('return', lldb.SBFileSpec('main.cpp')) + target.BreakpointCreateBySourceRegex('dlclose', lldb.SBFileSpec('main.cpp')) + target.BreakpointCreateBySourceRegex('return', lldb.SBFileSpec('main.cpp')) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.expect_expr('*foo', result_type='Foo', result_children=[ @@ -60,6 +61,7 @@ def test(self): 'LD_EXTRAS':'-L.'}) # Rerun program within the same target + process.Continue() process.Destroy() process = target.LaunchSimple(None, None, self.get_process_working_directory()) diff --git a/lldb/test/API/functionalities/rerun_and_expr_dylib/main.cpp b/lldb/test/API/functionalities/rerun_and_expr_dylib/main.cpp index bbd218bef66c2..701f387627903 100644 --- a/lldb/test/API/functionalities/rerun_and_expr_dylib/main.cpp +++ b/lldb/test/API/functionalities/rerun_and_expr_dylib/main.cpp @@ -13,5 +13,9 @@ int main() { struct Foo *foo = (struct Foo *)dlsym(handle, "global_foo"); assert(foo != nullptr); + // Unload dylib (important on Linux so a program re-run loads + // an updated version of the dylib and destroys the old lldb module). + dlclose(handle); + return 0; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits