1""" 2Regression test for <rdar://problem/8981098>: 3 4The expression parser's type search only looks in the current compilation unit for types. 5""" 6 7import unittest2 8import lldb 9from lldbtest import * 10import lldbutil 11 12class ObjCTypeQueryTestCase(TestBase): 13 14 mydir = os.path.join("expression_command", "two-files") 15 16 def setUp(self): 17 # Call super's setUp(). 18 TestBase.setUp(self) 19 # Find the line number to break for main.m. 20 self.line = line_number('main.m', 21 "// Set breakpoint here, then do 'expr (NSArray*)array_token'.") 22 23 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") 24 @dsym_test 25 def test_with_dsym(self): 26 """The expression parser's type search should be wider than the current compilation unit.""" 27 self.buildDsym() 28 self.type_query_from_other_cu() 29 30 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") 31 @dwarf_test 32 def test_with_dwarf(self): 33 """The expression parser's type search should be wider than the current compilation unit.""" 34 self.buildDwarf() 35 self.type_query_from_other_cu() 36 37 def type_query_from_other_cu(self): 38 """The expression parser's type search should be wider than the current compilation unit.""" 39 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) 40 41 lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True) 42 43 self.runCmd("run", RUN_SUCCEEDED) 44 45 # Now do a NSArry type query from the 'main.m' compile uint. 46 self.expect("expression (NSArray*)array_token", 47 substrs = ['(NSArray *) $0 = 0x']) 48 # (NSArray *) $0 = 0x00007fff70118398 49 50 51if __name__ == '__main__': 52 import atexit 53 lldb.SBDebugger.Initialize() 54 atexit.register(lambda: lldb.SBDebugger.Terminate()) 55 unittest2.main() 56