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