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 def test(self): 28 """Break inside a() and b() defined within libfoo.a.""" 29 self.build() 30 31 exe = self.getBuildArtifact("a.out") 32 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) 33 34 # Break inside a() by file and line first. 35 lldbutil.run_break_set_by_file_and_line( 36 self, "a.c", self.line, num_expected_locations=1, loc_exact=True) 37 38 self.runCmd("run", RUN_SUCCEEDED) 39 40 # The stop reason of the thread should be breakpoint. 41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 42 substrs=['stopped', 43 'stop reason = breakpoint']) 44 45 # Break at a(int) first. 46 self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, 47 substrs=['(int) arg = 1']) 48 self.expect_var_path("__a_global", type="int", value="1") 49 50 # Set breakpoint for b() next. 51 lldbutil.run_break_set_by_symbol( 52 self, "b", num_expected_locations=1, sym_exact=True) 53 54 # Continue the program, we should break at b(int) next. 55 self.runCmd("continue") 56 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, 57 substrs=['stopped', 58 'stop reason = breakpoint']) 59 self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY, 60 substrs=['(int) arg = 2']) 61 self.expect_var_path("__b_global", type="int", value="2") 62