brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 05db407 Raw
37 lines · python
1"""2Test that the expression parser accounts for the underlying type of bitfield3enums when looking for matching values.4"""5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class TestBitfieldEnum(TestBase):13    # Prior to clang-19, clang's DWARF v2 is missing missing DW_AT_type which14    # causes unsigned_max to appear as -1 instead of the "max" enumerator, whose15    # value is 3. From 19 onward, DW_AT_type is added as long as strict DWARF16    # is not enabled.17    @skipIf(dwarf_version=["<", "3"], compiler="clang", compiler_version=["<", "19.0"])18    def test_bitfield_enums(self):19        self.build()20 21        lldbutil.run_to_source_breakpoint(22            self, "// break here", lldb.SBFileSpec("main.cpp", False)23        )24 25        self.expect_expr(26            "bfs",27            result_type="BitfieldStruct",28            result_children=[29                ValueCheck(name="signed_min", value="min"),30                ValueCheck(name="signed_other", value="-1"),31                ValueCheck(name="signed_max", value="max"),32                ValueCheck(name="unsigned_min", value="min"),33                ValueCheck(name="unsigned_other", value="1"),34                ValueCheck(name="unsigned_max", value="max"),35            ],36        )37