1"""Test that types defined in shared libraries work correctly.""" 2 3 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test import lldbutil 9 10 11class TestRealDefinition(TestBase): 12 13 mydir = TestBase.compute_mydir(__file__) 14 15 def test_frame_var_after_stop_at_interface(self): 16 """Test that we can find the implementation for an objective C type""" 17 if self.getArchitecture() == 'i386': 18 self.skipTest("requires modern objc runtime") 19 self.build() 20 21 lldbutil.run_to_source_breakpoint( 22 self, 23 '// Set breakpoint where Bar is an interface', 24 lldb.SBFileSpec("Foo.m", False)) 25 26 # Break inside the foo function which takes a bar_ptr argument. 27 self.expect('breakpoint set -p "// Set breakpoint in main"') 28 self.runCmd("continue", RUN_SUCCEEDED) 29 30 # Run at stop at main 31 lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1) 32 33 # This should display correctly. 34 self.expect( 35 "frame variable foo->_bar->_hidden_ivar", 36 VARIABLES_DISPLAYED_CORRECTLY, 37 substrs=[ 38 "(NSString *)", 39 "foo->_bar->_hidden_ivar = 0x"]) 40 41 def test_frame_var_after_stop_at_implementation(self): 42 """Test that we can find the implementation for an objective C type""" 43 if self.getArchitecture() == 'i386': 44 self.skipTest("requires modern objc runtime") 45 self.build() 46 47 lldbutil.run_to_source_breakpoint( 48 self, 49 '// Set breakpoint where Bar is an implementation', 50 lldb.SBFileSpec("Bar.m", False)) 51 52 self.expect('breakpoint set -p "// Set breakpoint in main"') 53 self.runCmd("continue", RUN_SUCCEEDED) 54 55 # Run at stop at main 56 lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1) 57 58 # This should display correctly. 59 self.expect( 60 "frame variable foo->_bar->_hidden_ivar", 61 VARIABLES_DISPLAYED_CORRECTLY, 62 substrs=[ 63 "(NSString *)", 64 "foo->_bar->_hidden_ivar = 0x"]) 65