3fecb3beae5a37469e19e8fb6a88c868522c9fab
[openbsd] /
1 """Test breaking inside functions defined within a BSD archive file libfoo.a."""
2
3
4
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
9
10
11 class BSDArchivesTestCase(TestBase):
12
13     mydir = TestBase.compute_mydir(__file__)
14
15     @expectedFailureAll(
16         oslist=["windows"],
17         bugnumber="llvm.org/pr24527.  Makefile.rules doesn't know how to build static libs on Windows")
18     def test(self):
19         """Break inside a() and b() defined within libfoo.a."""
20         self.build()
21
22         exe = self.getBuildArtifact("a.out")
23         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
24
25         # Break on a() and b() symbols
26         lldbutil.run_break_set_by_symbol(
27             self, "a", sym_exact=True)
28         lldbutil.run_break_set_by_symbol(
29             self, "b", sym_exact=True)
30
31         self.runCmd("run", RUN_SUCCEEDED)
32
33         # The stop reason of the thread should be breakpoint.
34         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
35                     substrs=['stopped',
36                              'stop reason = breakpoint'])
37
38         # Break at a(int) first.
39         self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
40                     substrs=['(int) arg = 1'])
41         self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
42                     substrs=['(int) __a_global = 1'])
43
44         # Continue the program, we should break at b(int) next.
45         self.runCmd("continue")
46         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
47                     substrs=['stopped',
48                              'stop reason = breakpoint'])
49         self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
50                     substrs=['(int) arg = 2'])
51         self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
52                     substrs=['(int) __b_global = 2'])