1import lldb 2from lldbsuite.test.decorators import * 3from lldbsuite.test.lldbtest import * 4from lldbsuite.test import lldbutil 5 6class TestCase(TestBase): 7 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(self, "// break here", lldb.SBFileSpec("main.m")) 20 21 # Get the (dynamic) type of our 'id' variable so that our Objective-C 22 # runtime information is updated. 23 str_val = self.expect_expr("custom_class") 24 dyn_val = str_val.GetDynamicValue(lldb.eDynamicCanRunTarget) 25 26 # We should have retrieved the proper class list even in presence of 27 # the user-defined function. 28 self.assertEqual(dyn_val.GetTypeName(), "CustomClass *") 29