41 lines · python
1"""2Test that dynamically discovered ivars of type IMP do not crash LLDB3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class ObjCiVarIMPTestCase(TestBase):13 @skipIf(archs=["i386"]) # objc file does not build for i38614 @no_debug_info_test15 def test_imp_ivar_type(self):16 """Test that dynamically discovered ivars of type IMP do not crash LLDB"""17 self.build()18 exe = self.getBuildArtifact("a.out")19 20 # Create a target from the debugger.21 target = self.dbg.CreateTarget(exe)22 self.assertTrue(target, VALID_TARGET)23 24 # Set up our breakpoint25 26 bkpt = lldbutil.run_break_set_by_source_regexp(self, "break here")27 28 # Now launch the process, and do not stop at the entry point.29 process = target.LaunchSimple(None, None, self.get_process_working_directory())30 31 self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)32 33 self.expect(34 "frame variable --ptr-depth=1 --show-types -d run -- object",35 substrs=["(MyClass *) object = 0x", "(void *) myImp = 0x"],36 )37 self.expect(38 "disassemble --start-address `((MyClass*)object)->myImp`",39 substrs=["-[MyClass init]"],40 )41