LLVM: lib/DebugInfo/DWARF/DWARFListTable.cpp Source File (original) (raw)
21 HeaderOffset = *OffsetPtr;
23
24 std::tie(HeaderData.Length, Format) = Data.getInitialLength(OffsetPtr, &Err);
25 if (Err)
28 SectionName.data(), HeaderOffset, toString(std::move(Err)).c_str());
29
35 "%s table at offset 0x%" PRIx64
36 " has too small length (0x%" PRIx64
37 ") to contain a complete header",
38 SectionName.data(), HeaderOffset, FullLength);
39 assert(FullLength == length() && "Inconsistent calculation of length.");
40 uint64_t End = HeaderOffset + FullLength;
41 if (.isValidOffsetForDataOfSize(HeaderOffset, FullLength))
43 "section is not large enough to contain a %s table "
44 "of length 0x%" PRIx64 " at offset 0x%" PRIx64,
45 SectionName.data(), FullLength, HeaderOffset);
46
47 HeaderData.Version = Data.getU16(OffsetPtr);
48 HeaderData.AddrSize = Data.getU8(OffsetPtr);
49 HeaderData.SegSize = Data.getU8(OffsetPtr);
50 HeaderData.OffsetEntryCount = Data.getU32(OffsetPtr);
51
52
53 if (HeaderData.Version != 5)
55 "unrecognised %s table version %" PRIu16
56 " in table at offset 0x%" PRIx64,
57 SectionName.data(), HeaderData.Version, HeaderOffset);
60 "%s table at offset 0x%" PRIx64, SectionName.data(), HeaderOffset))
61 return SizeErr;
62 if (HeaderData.SegSize != 0)
64 "%s table at offset 0x%" PRIx64
65 " has unsupported segment selector size %" PRIu8,
66 SectionName.data(), HeaderOffset, HeaderData.SegSize);
68 HeaderData.OffsetEntryCount * OffsetByteSize)
70 "%s table at offset 0x%" PRIx64 " has more offset entries (%" PRIu32
71 ") than there is space for",
72 SectionName.data(), HeaderOffset, HeaderData.OffsetEntryCount);
73 Data.setAddressSize(HeaderData.AddrSize);
74 *OffsetPtr += HeaderData.OffsetEntryCount * OffsetByteSize;
76}
81 OS << format("0x%8.8" PRIx64 ": ", HeaderOffset);
83 OS << format("%s list header: length = 0x%0*" PRIx64, ListTypeString.data(),
84 OffsetDumpWidth, HeaderData.Length)
86 << format(", version = 0x%4.4" PRIx16 ", addr_size = 0x%2.2" PRIx8
87 ", seg_size = 0x%2.2" PRIx8
88 ", offset_entry_count = 0x%8.8" PRIx32 "\n",
89 HeaderData.Version, HeaderData.AddrSize, HeaderData.SegSize,
90 HeaderData.OffsetEntryCount);
91
92 if (HeaderData.OffsetEntryCount > 0) {
93 OS << "offsets: [";
94 for (uint32_t I = 0; I < HeaderData.OffsetEntryCount; ++I) {
96 OS << format("\n0x%0*" PRIx64, OffsetDumpWidth, Off);
98 OS << format(" => 0x%08" PRIx64,
100 }
101 OS << "\n]\n";
102 }
103}
106 if (HeaderData.Length == 0)
107 return 0;
109}
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)