1"""Test breaking inside functions defined within a BSD archive file libfoo.a.""" 2 3 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test import lldbutil 9 10 11class BSDArchivesTestCase(TestBase): 12 13 mydir = TestBase.compute_mydir(__file__) 14 15 def setUp(self): 16 # Call super's setUp(). 17 TestBase.setUp(self) 18 # Find the line number in a(int) to break at. 19 self.line = line_number( 20 'a.c', '// Set file and line breakpoint inside a().') 21 22 # Doesn't depend on any specific debug information. 23 @no_debug_info_test 24 @expectedFailureAll( 25 oslist=["windows"], 26 bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows") 27 @expectedFailureAll(remote=True) 28 def test(self): 29 """Break inside a() and b() defined within libfoo.a.""" 30 self.build() 31 32 exe = self.getBuildArtifact("a.out") 33 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 34 35 # Break inside a() by file and line first. 36 lldbutil.run_break_set_by_file_and_line( 37 self, "a.c", self.line, num_expected_locations=1, loc_exact=True) 38 39 self.runCmd("run", RUN_SUCCEEDED) 40 41 # The stop reason of the thread should be breakpoint. 42 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 43 substrs=['stopped', 44 'stop reason = breakpoint']) 45 46 # Break at a(int) first. 47 self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, 48 substrs=['(int) arg = 1']) 49 self.expect_var_path("__a_global", type="int", value="1") 50 51 # Set breakpoint for b() next. 52 lldbutil.run_break_set_by_symbol( 53 self, "b", num_expected_locations=1, sym_exact=True) 54 55 # Continue the program, we should break at b(int) next. 56 self.runCmd("continue") 57 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 58 substrs=['stopped', 59 'stop reason = breakpoint']) 60 self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, 61 substrs=['(int) arg = 2']) 62 self.expect_var_path("__b_global", type="int", value="2") 63