1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6 7class TestCase(TestBase): 8 @skipUnlessDarwin 9 # LLDB ends up calling the user-defined function (but at least doesn't 10 # crash). 11 @skipIf(macos_version=["<", "13.0"]) 12 def test(self): 13 """ 14 Tests LLDB's behaviour if the user defines their own conflicting 15 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-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