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