1""" 2Test more expression command sequences with objective-c. 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13@skipUnlessDarwin 14class FoundationTestCaseString(TestBase): 15 16 mydir = TestBase.compute_mydir(__file__) 17 18 def test_NSString_expr_commands(self): 19 """Test expression commands for NSString.""" 20 self.build() 21 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( 22 self, '// Break here for NSString tests', 23 lldb.SBFileSpec('main.m', False)) 24 25 # Test_NSString: 26 self.runCmd("thread backtrace") 27 self.expect("expression (int)[str length]", 28 patterns=["\(int\) \$.* ="]) 29 self.expect("expression (int)[str_id length]", 30 patterns=["\(int\) \$.* ="]) 31 self.expect("expression (id)[str description]", 32 patterns=["\(id\) \$.* = 0x"]) 33 self.expect("expression (id)[str_id description]", 34 patterns=["\(id\) \$.* = 0x"]) 35 self.expect("expression str.length") 36 self.expect('expression str = @"new"') 37 self.runCmd("image lookup -t NSString") 38 self.expect('expression str = (id)[NSString stringWithCString: "new"]') 39 self.runCmd("process continue") 40 41 @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>") 42 def test_MyString_dump_with_runtime(self): 43 """Test dump of a known Objective-C object by dereferencing it.""" 44 self.build() 45 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( 46 self, '// Set break point at this line', 47 lldb.SBFileSpec('main.m', False)) 48 self.expect( 49 "expression --show-types -- *my", 50 patterns=[ 51 "\(MyString\) \$.* = ", 52 "\(MyBase\)"]) 53 self.runCmd("process continue") 54