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