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 mydir = TestBase.compute_mydir(__file__) 16 17 def setUp(self): 18 # Call super's setUp(). 19 TestBase.setUp(self) 20 # Find the line number to break inside main(). 21 self.line = line_number('main.m', '// Set breakpoint 0 here.') 22 23 @skipUnlessDarwin 24 @skipIf(macos_version=["<", "10.12"]) 25 def test_expr(self): 26 self.build() 27 exe = self.getBuildArtifact("a.out") 28 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 29 30 # Break inside the foo function which takes a bar_ptr argument. 31 lldbutil.run_break_set_by_file_and_line( 32 self, "main.m", self.line, num_expected_locations=1, loc_exact=True) 33 34 self.runCmd("run", RUN_SUCCEEDED) 35 36 # The stop reason of the thread should be breakpoint. 37 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 38 substrs=['stopped', 39 'stop reason = breakpoint']) 40 41 # The breakpoint should have a hit count of 1. 42 self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, 43 substrs=[' resolved, hit count = 1']) 44 45 self.runCmd("settings set target.auto-import-clang-modules true") 46 47 self.expect("p getpid()", VARIABLES_DISPLAYED_CORRECTLY, 48 substrs=["pid_t"]) 49