157bf5c86SRaphael Isemannimport lldb
257bf5c86SRaphael Isemannfrom lldbsuite.test.decorators import *
357bf5c86SRaphael Isemannfrom lldbsuite.test.lldbtest import *
457bf5c86SRaphael Isemannfrom lldbsuite.test import lldbutil
557bf5c86SRaphael Isemann
657bf5c86SRaphael Isemannclass TestCase(TestBase):
757bf5c86SRaphael Isemann
857bf5c86SRaphael Isemann    @skipUnlessDarwin
957bf5c86SRaphael Isemann    # LLDB ends up calling the user-defined function (but at least doesn't
1057bf5c86SRaphael Isemann    # crash).
11*fc437034SJonas Devlieghere    @skipIf(macos_version=["<", "13.0"])
1257bf5c86SRaphael Isemann    def test(self):
1357bf5c86SRaphael Isemann        """
1457bf5c86SRaphael Isemann        Tests LLDB's behaviour if the user defines their own conflicting
1557bf5c86SRaphael Isemann        objc_copyRealizedClassList_nolock function.
1657bf5c86SRaphael Isemann        """
1757bf5c86SRaphael Isemann
1857bf5c86SRaphael Isemann        self.build()
1957bf5c86SRaphael Isemann        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
2057bf5c86SRaphael Isemann
2157bf5c86SRaphael Isemann        # Get the (dynamic) type of our 'id' variable so that our Objective-C
2257bf5c86SRaphael Isemann        # runtime information is updated.
2357bf5c86SRaphael Isemann        str_val = self.expect_expr("custom_class")
2457bf5c86SRaphael Isemann        dyn_val = str_val.GetDynamicValue(lldb.eDynamicCanRunTarget)
2557bf5c86SRaphael Isemann
2657bf5c86SRaphael Isemann        # We should have retrieved the proper class list even in presence of
2757bf5c86SRaphael Isemann        # the user-defined function.
2857bf5c86SRaphael Isemann        self.assertEqual(dyn_val.GetTypeName(), "CustomClass *")
29