diff options
author | Paul Robinson <paul.robinson@sony.com> | 2017-12-15 20:29:25 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2017-12-15 20:29:25 +0000 |
commit | 86e9c5d8a846053e9159c49e66c0fd9f27845bdc (patch) | |
tree | 97cc3e3182500781c7b02d5603e2823af6f2c0a5 | |
parent | 47812d8e557d18833ce3501316d6b0e7795b5038 (diff) |
Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."
Unit test fails on some bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320857 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFDebugLine.h | 8 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIE.cpp | 2 | ||||
-rw-r--r-- | lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 41 | ||||
-rw-r--r-- | lib/DebugInfo/DWARF/DWARFFormValue.cpp | 12 | ||||
-rw-r--r-- | test/DebugInfo/X86/dwarfdump-header.s | 21 | ||||
-rw-r--r-- | unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp | 18 | ||||
-rw-r--r-- | unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp | 9 |
7 files changed, 27 insertions, 84 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h index de8ad4e5ef3..24075817219 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h +++ b/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h @@ -15,7 +15,6 @@ #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h" #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" -#include "llvm/Support/MD5.h" #include <cstdint> #include <map> #include <string> @@ -35,7 +34,6 @@ public: uint64_t DirIdx = 0; uint64_t ModTime = 0; uint64_t Length = 0; - MD5::MD5Result Checksum; }; struct Prologue { @@ -48,11 +46,11 @@ public: /// parameters affect interpretation of forms (used in the directory and /// file tables starting with v5). DWARFFormParams FormParams; + /// In v5, size in bytes of a segment selector. + uint8_t SegSelectorSize; /// The number of bytes following the prologue_length field to the beginning /// of the first byte of the statement program itself. uint64_t PrologueLength; - /// In v5, size in bytes of a segment selector. - uint8_t SegSelectorSize; /// The size in bytes of the smallest target machine instruction. Statement /// program opcodes that alter the address register first multiply their /// operands by this value. @@ -68,8 +66,6 @@ public: uint8_t LineRange; /// The number assigned to the first special opcode. uint8_t OpcodeBase; - /// For v5, whether filename entries provide an MD5 checksum. - bool HasMD5; std::vector<uint8_t> StandardOpcodeLengths; std::vector<StringRef> IncludeDirectories; std::vector<FileNameEntry> FileNames; diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index b3148db30cd..886e6e264b3 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -777,7 +777,6 @@ void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const { case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break; case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break; case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break; - case dwarf::DW_FORM_data16: break; } for (const auto &V : values()) @@ -792,7 +791,6 @@ unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { case dwarf::DW_FORM_block2: return Size + sizeof(int16_t); case dwarf::DW_FORM_block4: return Size + sizeof(int32_t); case dwarf::DW_FORM_block: return Size + getULEB128Size(Size); - case dwarf::DW_FORM_data16: return 16; default: llvm_unreachable("Improper form for block"); } } diff --git a/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/lib/DebugInfo/DWARF/DWARFDebugLine.cpp index e5ef4eaceeb..5376b465a49 100644 --- a/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -48,7 +48,6 @@ void DWARFDebugLine::Prologue::clear() { MinInstLength = MaxOpsPerInst = DefaultIsStmt = LineBase = LineRange = 0; OpcodeBase = 0; FormParams = DWARFFormParams({0, 0, DWARF32}); - HasMD5 = false; StandardOpcodeLengths.clear(); IncludeDirectories.clear(); FileNames.clear(); @@ -79,23 +78,15 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const { << IncludeDirectories[I] << "'\n"; if (!FileNames.empty()) { - if (HasMD5) - OS << " Dir MD5 Checksum File Name\n" - << " ---- -------------------------------- -----------" - "---------------\n"; - else - OS << " Dir Mod Time File Len File Name\n" - << " ---- ---------- ---------- -----------" - "----------------\n"; + OS << " Dir Mod Time File Len File Name\n" + << " ---- ---------- ---------- -----------" + "----------------\n"; for (uint32_t I = 0; I != FileNames.size(); ++I) { const FileNameEntry &FileEntry = FileNames[I]; - OS << format("file_names[%3u] %4" PRIu64 " ", I + 1, FileEntry.DirIdx); - if (HasMD5) - OS << FileEntry.Checksum.digest(); - else - OS << format("0x%8.8" PRIx64 " 0x%8.8" PRIx64, FileEntry.ModTime, - FileEntry.Length); - OS << ' ' << FileEntry.Name << '\n'; + OS << format("file_names[%3u] %4" PRIu64 " ", I + 1, FileEntry.DirIdx) + << format("0x%8.8" PRIx64 " 0x%8.8" PRIx64 " ", FileEntry.ModTime, + FileEntry.Length) + << FileEntry.Name << '\n'; } } } @@ -131,7 +122,7 @@ parseV2DirFileTables(const DWARFDataExtractor &DebugLineData, // ran off the end of the prologue. static ContentDescriptors parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr, - uint64_t EndPrologueOffset, bool *HasMD5) { + uint64_t EndPrologueOffset) { ContentDescriptors Descriptors; int FormatCount = DebugLineData.getU8(OffsetPtr); bool HasPath = false; @@ -144,8 +135,6 @@ parseV5EntryFormat(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr, Descriptor.Form = dwarf::Form(DebugLineData.getULEB128(OffsetPtr)); if (Descriptor.Type == dwarf::DW_LNCT_path) HasPath = true; - else if (Descriptor.Type == dwarf::DW_LNCT_MD5 && HasMD5) - *HasMD5 = true; Descriptors.push_back(Descriptor); } return HasPath ? Descriptors : ContentDescriptors(); @@ -155,11 +144,11 @@ static bool parseV5DirFileTables(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr, uint64_t EndPrologueOffset, const DWARFFormParams &FormParams, const DWARFUnit *U, - bool &HasMD5, std::vector<StringRef> &IncludeDirectories, + std::vector<StringRef> &IncludeDirectories, std::vector<DWARFDebugLine::FileNameEntry> &FileNames) { // Get the directory entry description. ContentDescriptors DirDescriptors = - parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset, nullptr); + parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset); if (DirDescriptors.empty()) return false; @@ -185,7 +174,7 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData, // Get the file entry description. ContentDescriptors FileDescriptors = - parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset, &HasMD5); + parseV5EntryFormat(DebugLineData, OffsetPtr, EndPrologueOffset); if (FileDescriptors.empty()) return false; @@ -212,11 +201,7 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData, case DW_LNCT_size: FileEntry.Length = Value.getAsUnsignedConstant().getValue(); break; - case DW_LNCT_MD5: - assert(Value.getAsBlock().getValue().size() == 16); - std::uninitialized_copy_n(Value.getAsBlock().getValue().begin(), 16, - FileEntry.Checksum.Bytes.begin()); - break; + // FIXME: Add MD5 default: break; } @@ -268,7 +253,7 @@ bool DWARFDebugLine::Prologue::parse(const DWARFDataExtractor &DebugLineData, if (getVersion() >= 5) { if (!parseV5DirFileTables(DebugLineData, OffsetPtr, EndPrologueOffset, - getFormParams(), U, HasMD5, IncludeDirectories, + getFormParams(), U, IncludeDirectories, FileNames)) { fprintf(stderr, "warning: parsing line table prologue at 0x%8.8" PRIx64 diff --git a/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 44886de2e3d..14e2fe3eeb5 100644 --- a/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -186,7 +186,6 @@ bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData, case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: - case DW_FORM_data16: case DW_FORM_flag: case DW_FORM_ref1: case DW_FORM_ref2: @@ -340,11 +339,6 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data, case DW_FORM_ref_sup8: Value.uval = Data.getU64(OffsetPtr); break; - case DW_FORM_data16: - // Treat this like a 16-byte block. - Value.uval = 16; - IsBlock = true; - break; case DW_FORM_sdata: Value.sval = Data.getSLEB128(OffsetPtr); break; @@ -438,9 +432,6 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { case DW_FORM_data8: OS << format("0x%016" PRIx64, UValue); break; - case DW_FORM_data16: - OS << format_bytes(ArrayRef<uint8_t>(Value.data, 16), None, 16, 16); - break; case DW_FORM_string: OS << '"'; OS.write_escaped(Value.cstr); @@ -660,8 +651,7 @@ Optional<int64_t> DWARFFormValue::getAsSignedConstant() const { } Optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const { - if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc) && - Form != DW_FORM_data16) + if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc)) return None; return makeArrayRef(Value.data, Value.uval); } diff --git a/test/DebugInfo/X86/dwarfdump-header.s b/test/DebugInfo/X86/dwarfdump-header.s index a0588b56652..d7b2e22e42b 100644 --- a/test/DebugInfo/X86/dwarfdump-header.s +++ b/test/DebugInfo/X86/dwarfdump-header.s @@ -298,23 +298,25 @@ LH_5_params: .long str_LT_5a .long str_LT_5b # File table format - .byte 3 # Three elements per file entry + .byte 4 # Four elements per file entry .byte 1 # DW_LNCT_path .byte 0x08 # DW_FORM_string .byte 2 # DW_LNCT_directory_index .byte 0x0b # DW_FORM_data1 - .byte 5 # DW_LNCT_MD5 - .byte 0x1e # DW_FORM_data16 + .byte 3 # DW_LNCT_timestamp + .byte 0x0f # DW_FORM_udata + .byte 4 # DW_LNCT_size + .byte 0x0f # DW_FORM_udata # File table entries .byte 2 # Two files .asciz "File5a" .byte 1 - .quad 0x7766554433221100 - .quad 0xffeeddccbbaa9988 + .byte 0x51 + .byte 0x52 .asciz "File5b" .byte 2 - .quad 0x8899aabbccddeeff - .quad 0x0011223344556677 + .byte 0x53 + .byte 0x54 LH_5_header_end: # Line number program, which is empty. LH_5_end: @@ -327,9 +329,8 @@ LH_5_end: # CHECK: include_directories[ 1] = 'Directory5a' # CHECK: include_directories[ 2] = 'Directory5b' # CHECK-NOT: include_directories -# CHECK: MD5 Checksum -# CHECK: file_names[ 1] 1 00112233445566778899aabbccddeeff File5a{{$}} -# CHECK: file_names[ 2] 2 ffeeddccbbaa99887766554433221100 File5b{{$}} +# CHECK: file_names[ 1] 1 0x00000051 0x00000052 File5a{{$}} +# CHECK: file_names[ 2] 2 0x00000053 0x00000054 File5b{{$}} # CHECK-NOT: file_names .section .debug_line.dwo,"",@progbits diff --git a/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp index cb7bf82d86f..953c5c57d20 100644 --- a/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ b/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -82,8 +82,6 @@ void TestAllForms() { const uint32_t Data4 = 0x6789abcdU; const uint64_t Data8 = 0x0011223344556677ULL; const uint64_t Data8_2 = 0xAABBCCDDEEFF0011ULL; - const uint8_t Data16[16] = {1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16}; const int64_t SData = INT64_MIN; const int64_t ICSData = INT64_MAX; // DW_FORM_implicit_const SData const uint64_t UData[] = {UINT64_MAX - 1, UINT64_MAX - 2, UINT64_MAX - 3, @@ -122,11 +120,6 @@ void TestAllForms() { const auto Attr_DW_FORM_block4 = static_cast<dwarf::Attribute>(Attr++); CUDie.addAttribute(Attr_DW_FORM_block4, DW_FORM_block4, BlockData, BlockSize); - // We handle data16 as a block form. - const auto Attr_DW_FORM_data16 = static_cast<dwarf::Attribute>(Attr++); - if (Version >= 5) - CUDie.addAttribute(Attr_DW_FORM_data16, DW_FORM_data16, Data16, 16); - //---------------------------------------------------------------------- // Test data forms //---------------------------------------------------------------------- @@ -283,17 +276,6 @@ void TestAllForms() { EXPECT_EQ(ExtractedBlockData.size(), BlockSize); EXPECT_TRUE(memcmp(ExtractedBlockData.data(), BlockData, BlockSize) == 0); - // Data16 is handled like a block. - if (Version >= 5) { - FormValue = DieDG.find(Attr_DW_FORM_data16); - EXPECT_TRUE((bool)FormValue); - BlockDataOpt = FormValue->getAsBlock(); - EXPECT_TRUE(BlockDataOpt.hasValue()); - ExtractedBlockData = BlockDataOpt.getValue(); - EXPECT_EQ(ExtractedBlockData.size(), 16u); - EXPECT_TRUE(memcmp(ExtractedBlockData.data(), Data16, 16) == 0); - } - //---------------------------------------------------------------------- // Test data forms //---------------------------------------------------------------------- diff --git a/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp b/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp index 8fc6b786ba4..14550b9082b 100644 --- a/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp +++ b/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp @@ -160,15 +160,6 @@ TEST(DWARFFormValue, SignedConstantForms) { EXPECT_EQ(LEBMax.getAsSignedConstant().getValue(), LLONG_MAX); EXPECT_EQ(LEB1.getAsSignedConstant().getValue(), -42); EXPECT_EQ(LEB2.getAsSignedConstant().getValue(), 42); - - // Data16 is a little tricky. - using uint128_t = std::array<uint8_t, 16>; - uint128_t Item16({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}); - auto Data16 = createDataXFormValue<uint128_t>(DW_FORM_data16, Item16); - SmallString<32> Str; - raw_svector_ostream Res(Str); - Data16.dump(Res, DIDumpOptions()); - EXPECT_EQ(memcmp(Str.data(), "000102030405060708090a0b0c0d0e0f", 32), 0); } } // end anonymous namespace |