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    @expectedFailureAll(
14        oslist=["windows"],
15        bugnumber="llvm.org/pr24527.  Makefile.rules doesn't know how to build static libs on Windows")
16    def test(self):
17        """Break inside a() and b() defined within libfoo.a."""
18        self.build()
19
20        exe = self.getBuildArtifact("a.out")
21        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
22
23        # Break on a() and b() symbols
24        lldbutil.run_break_set_by_symbol(
25            self, "a", sym_exact=True)
26        lldbutil.run_break_set_by_symbol(
27            self, "b", sym_exact=True)
28
29        self.runCmd("run", RUN_SUCCEEDED)
30
31        # The stop reason of the thread should be breakpoint.
32        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
33                    substrs=['stopped',
34                             'stop reason = breakpoint'])
35
36        # Break at a(int) first.
37        self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
38                    substrs=['(int) arg = 1'])
39        self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
40                    substrs=['(int) __a_global = 1'])
41
42        # Continue the program, we should break at b(int) next.
43        self.runCmd("continue")
44        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
45                    substrs=['stopped',
46                             'stop reason = breakpoint'])
47        self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
48                    substrs=['(int) arg = 2'])
49        self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
50                    substrs=['(int) __b_global = 2'])
51