1"""Test that importing modules in Objective-C works as expected.""" 2 3 4 5import unittest2 6import lldb 7 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13class ObjCModulesAutoImportTestCase(TestBase): 14 15 def setUp(self): 16 # Call super's setUp(). 17 TestBase.setUp(self) 18 # Find the line number to break inside main(). 19 self.line = line_number('main.m', '// Set breakpoint 0 here.') 20 21 @skipIf(macos_version=["<", "10.12"]) 22 def test_expr(self): 23 self.build() 24 exe = self.getBuildArtifact("a.out") 25 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 26 27 # Break inside the foo function which takes a bar_ptr argument. 28 lldbutil.run_break_set_by_file_and_line( 29 self, "main.m", self.line, num_expected_locations=1, loc_exact=True) 30 31 self.runCmd("run", RUN_SUCCEEDED) 32 33 # The stop reason of the thread should be breakpoint. 34 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 35 substrs=['stopped', 36 'stop reason = breakpoint']) 37 38 # The breakpoint should have a hit count of 1. 39 lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1) 40 41 self.runCmd("settings set target.auto-import-clang-modules true") 42 43 self.expect("p getpid()", VARIABLES_DISPLAYED_CORRECTLY, 44 substrs=["pid_t"]) 45