xref: /llvm-project/lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py (revision 6bf923d5c3daf5d66e0acf53d037a12ceff4a275)
1"""
2Test that LLDB can launch a linux executable through the dynamic loader where
3the main executable has an extra exported "_r_debug" symbol that used to mess
4up shared library loading with DYLDRendezvous and the POSIX dynamic loader
5plug-in. What used to happen is that any shared libraries other than the main
6executable and the dynamic loader and VSDO would not get loaded. This test
7checks to make sure that we still load libraries correctly when we have
8multiple "_r_debug" symbols. See comments in the main.cpp source file for full
9details on what the problem is.
10"""
11
12import lldb
13import os
14
15from lldbsuite.test import lldbutil
16from lldbsuite.test.decorators import *
17from lldbsuite.test.lldbtest import *
18
19
20class TestDyldWithMultipleRDebug(TestBase):
21    @skipIf(oslist=no_match(["linux"]))
22    @no_debug_info_test
23    def test(self):
24        self.build()
25        # Run to a breakpoint in main.cpp to ensure we can hit breakpoints
26        # in the main executable. Setting breakpoints by file and line ensures
27        # that the main executable was loaded correctly by the dynamic loader
28        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
29            self, "// Break here", lldb.SBFileSpec("main.cpp"), extra_images=["testlib"]
30        )
31        # Set breakpoints both on shared library function to ensure that
32        # we hit a source breakpoint in the shared library which only will
33        # happen if we load the shared library correctly in the dynamic
34        # loader.
35        lldbutil.continue_to_source_breakpoint(
36            self,
37            process,
38            "// Library break here",
39            lldb.SBFileSpec("library_file.cpp", False),
40        )
41