brintos

brintos / llvm-project-archived public Read only

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