diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp --- a/llvm/lib/BinaryFormat/Dwarf.cpp +++ b/llvm/lib/BinaryFormat/Dwarf.cpp @@ -737,6 +737,7 @@ return 2; case DW_FORM_strx3: + case DW_FORM_addrx3: return 3; case DW_FORM_data4: diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp @@ -385,6 +385,7 @@ 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: diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -160,9 +160,11 @@ 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: @@ -300,6 +302,7 @@ 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: diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -51,6 +51,7 @@ 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}; @@ -100,14 +101,14 @@ const auto Attr_DW_FORM_addrx = static_cast(Attr++); const auto Attr_DW_FORM_addrx1 = static_cast(Attr++); const auto Attr_DW_FORM_addrx2 = static_cast(Attr++); - // TODO: Add Attr_DW_FORM_addrx3 test (this form type is currently - // unsupported) + const auto Attr_DW_FORM_addrx3 = static_cast(Attr++); const auto Attr_DW_FORM_addrx4 = static_cast(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); } @@ -275,6 +276,10 @@ 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); diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp @@ -232,9 +232,11 @@ 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),