6352b68e7d7532be02d7e3fab26b0f3a70d31ba0
[openbsd] /
1 """
2 Tests that frame variable looks into anonymous unions
3 """
4 import lldb
5 from lldbsuite.test.lldbtest import *
6 import lldbsuite.test.lldbutil as lldbutil
7
8
9 class FrameVariableAnonymousUnionsTestCase(TestBase):
10
11     mydir = TestBase.compute_mydir(__file__)
12
13     def test_with_run_command(self):
14         """Tests that frame variable looks into anonymous unions"""
15         self.build()
16         self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
17
18         line = line_number('main.cpp', '// break here')
19         lldbutil.run_break_set_by_file_and_line(
20             self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
21
22         self.runCmd("process launch", RUN_SUCCEEDED)
23
24         process = self.dbg.GetSelectedTarget().GetProcess()
25
26         if process.GetByteOrder() == lldb.eByteOrderLittle:
27             self.expect('frame variable -f x i', substrs=['ffffff41'])
28         else:
29             self.expect('frame variable -f x i', substrs=['41ffff00'])
30
31         self.expect('frame variable c', substrs=["'A"])
32
33         self.expect('frame variable x', matching=False, substrs=['3'])
34         self.expect('frame variable y', matching=False, substrs=["'B'"])
35         self.expect('frame variable z', matching=False, substrs=['14'])