30 lines · python
1"""2Tests that frame variable looks into anonymous unions3"""4import lldb5from lldbsuite.test.lldbtest import *6import lldbsuite.test.lldbutil as lldbutil7 8 9class FrameVariableAnonymousUnionsTestCase(TestBase):10 def test_with_run_command(self):11 """Tests that frame variable looks into anonymous unions"""12 self.build()13 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)14 15 line = line_number("main.cpp", "// break here")16 lldbutil.run_break_set_by_file_and_line(17 self, "main.cpp", line, num_expected_locations=-1, loc_exact=False18 )19 20 self.runCmd("process launch", RUN_SUCCEEDED)21 22 process = self.dbg.GetSelectedTarget().GetProcess()23 24 if process.GetByteOrder() == lldb.eByteOrderLittle:25 self.expect("frame variable -f x i", substrs=["ffffff41"])26 else:27 self.expect("frame variable -f x i", substrs=["41ffff00"])28 29 self.expect("frame variable c", substrs=["'A"])30