This fixes a few places where the addrx3 and strx3 forms were missed.
Previously this meant if one of these forms appeared somewhere various
errors could occur. This now also adds an extra test case for the addrx3
form (which previously failed).
Differential Revision: https://reviews.llvm.org/D143488
return 2;
case DW_FORM_strx3:
+ case DW_FORM_addrx3:
return 3;
case DW_FORM_data4:
case dwarf::DW_FORM_strx2:
case dwarf::DW_FORM_addrx2:
case dwarf::DW_FORM_strx3:
+ case dwarf::DW_FORM_addrx3:
case dwarf::DW_FORM_strp:
case dwarf::DW_FORM_ref4:
case dwarf::DW_FORM_data4:
case DW_FORM_ref_sup8:
case DW_FORM_strx1:
case DW_FORM_strx2:
+ case DW_FORM_strx3:
case DW_FORM_strx4:
case DW_FORM_addrx1:
case DW_FORM_addrx2:
+ case DW_FORM_addrx3:
case DW_FORM_addrx4:
case DW_FORM_sec_offset:
case DW_FORM_strp:
Value.uval = Data.getU16(OffsetPtr, &Err);
break;
case DW_FORM_strx3:
+ case DW_FORM_addrx3:
Value.uval = Data.getU24(OffsetPtr, &Err);
break;
case DW_FORM_data4:
const AddrType AddrxValue = (AddrType)0x4231abcd4231abcdULL;
const AddrType Addrx1Value = (AddrType)0x0000aaaabbbbccccULL;
const AddrType Addrx2Value = (AddrType)0xf00123f00456f000ULL;
+ const AddrType Addrx3Value = (AddrType)0xABABA000B111C222ULL;
const AddrType Addrx4Value = (AddrType)0xa1b2c3d4e5f6e5d4ULL;
const uint8_t BlockData[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
const auto Attr_DW_FORM_addrx = static_cast<dwarf::Attribute>(Attr++);
const auto Attr_DW_FORM_addrx1 = static_cast<dwarf::Attribute>(Attr++);
const auto Attr_DW_FORM_addrx2 = static_cast<dwarf::Attribute>(Attr++);
- // TODO: Add Attr_DW_FORM_addrx3 test (this form type is currently
- // unsupported)
+ const auto Attr_DW_FORM_addrx3 = static_cast<dwarf::Attribute>(Attr++);
const auto Attr_DW_FORM_addrx4 = static_cast<dwarf::Attribute>(Attr++);
if (Version >= 5) {
CUDie.addAttribute(Attr_DW_FORM_addrx, DW_FORM_addrx, AddrxValue);
CUDie.addAttribute(Attr_DW_FORM_addrx1, DW_FORM_addrx1, Addrx1Value);
CUDie.addAttribute(Attr_DW_FORM_addrx2, DW_FORM_addrx2, Addrx2Value);
+ CUDie.addAttribute(Attr_DW_FORM_addrx3, DW_FORM_addrx3, Addrx3Value);
CUDie.addAttribute(Attr_DW_FORM_addrx4, DW_FORM_addrx4, Addrx4Value);
}
EXPECT_TRUE(ExtractedAddrx2Value.has_value());
EXPECT_EQ(Addrx2Value, *ExtractedAddrx2Value);
+ auto ExtractedAddrx3Value = toAddress(DieDG.find(Attr_DW_FORM_addrx3));
+ EXPECT_TRUE(ExtractedAddrx3Value.has_value());
+ EXPECT_EQ(Addrx3Value, *ExtractedAddrx3Value);
+
auto ExtractedAddrx4Value = toAddress(DieDG.find(Attr_DW_FORM_addrx4));
EXPECT_TRUE(ExtractedAddrx1Value.has_value());
EXPECT_EQ(Addrx4Value, *ExtractedAddrx4Value);
ParamType(DW_FORM_ref_sup8, 0, 0, DWARF32, SampleU32, 8, true),
ParamType(DW_FORM_strx1, 0, 0, DWARF32, SampleU32, 1, true),
ParamType(DW_FORM_strx2, 0, 0, DWARF32, SampleU32, 2, true),
+ ParamType(DW_FORM_strx3, 0, 0, DWARF32, SampleU32, 3, true),
ParamType(DW_FORM_strx4, 0, 0, DWARF32, SampleU32, 4, true),
ParamType(DW_FORM_addrx1, 0, 0, DWARF32, SampleU32, 1, true),
ParamType(DW_FORM_addrx2, 0, 0, DWARF32, SampleU32, 2, true),
+ ParamType(DW_FORM_addrx3, 0, 0, DWARF32, SampleU32, 3, true),
ParamType(DW_FORM_addrx4, 0, 0, DWARF32, SampleU32, 4, true),
ParamType(DW_FORM_sec_offset, 0, 1, DWARF32, SampleU32, 0, false),
ParamType(DW_FORM_sec_offset, 1, 0, DWARF32, SampleU32, 0, false),