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