1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    @skipUnlessDarwin
11    # LLDB ends up calling the user-defined function (but at least doesn't
12    # crash).
13    @skipIf(macos_version=["<", "13.0"])
14    def test(self):
15        """
16        Tests LLDB's behaviour if the user defines their own conflicting
17        objc_copyRealizedClassList_nolock function.
18        """
19
20        self.build()
21        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
22
23        # Get the (dynamic) type of our 'id' variable so that our Objective-C
24        # runtime information is updated.
25        str_val = self.expect_expr("custom_class")
26        dyn_val = str_val.GetDynamicValue(lldb.eDynamicCanRunTarget)
27
28        # We should have retrieved the proper class list even in presence of
29        # the user-defined function.
30        self.assertEqual(dyn_val.GetTypeName(), "CustomClass *")
31