31 lines · python
1import lldb2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5 6 7class TestCase(TestBase):8 @skipUnlessDarwin9 # LLDB ends up calling the user-defined function (but at least doesn't10 # crash).11 @skipIf(macos_version=["<", "13.0"])12 def test(self):13 """14 Tests LLDB's behaviour if the user defines their own conflicting15 objc_copyRealizedClassList_nolock function.16 """17 18 self.build()19 lldbutil.run_to_source_breakpoint(20 self, "// break here", lldb.SBFileSpec("main.m")21 )22 23 # Get the (dynamic) type of our 'id' variable so that our Objective-C24 # 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 of29 # the user-defined function.30 self.assertEqual(dyn_val.GetTypeName(), "CustomClass *")31