21 HeaderOffset = *OffsetPtr;
25 "section is not large enough to contain a " 26 "%s table length at offset 0x%" PRIx32,
29 HeaderData.Length = Data.
getU32(OffsetPtr);
30 if (HeaderData.Length == 0xffffffffu)
32 "DWARF64 is not supported in %s at offset 0x%" PRIx32,
35 if (HeaderData.Length +
sizeof(
uint32_t) <
sizeof(Header))
37 "%s table at offset 0x%" PRIx32
38 " has too small length (0x%" PRIx32
39 ") to contain a complete header",
44 "section is not large enough to contain a %s table " 45 "of length 0x%" PRIx32
" at offset 0x%" PRIx32,
48 HeaderData.Version = Data.
getU16(OffsetPtr);
49 HeaderData.AddrSize = Data.
getU8(OffsetPtr);
50 HeaderData.SegSize = Data.
getU8(OffsetPtr);
51 HeaderData.OffsetEntryCount = Data.
getU32(OffsetPtr);
54 if (HeaderData.Version != 5)
56 "unrecognised %s table version %" PRIu16
57 " in table at offset 0x%" PRIx32,
58 SectionName.data(), HeaderData.Version, HeaderOffset);
59 if (HeaderData.AddrSize != 4 && HeaderData.AddrSize != 8)
61 "%s table at offset 0x%" PRIx32
62 " has unsupported address size %" PRIu8,
63 SectionName.data(), HeaderOffset, HeaderData.AddrSize);
64 if (HeaderData.SegSize != 0)
66 "%s table at offset 0x%" PRIx32
67 " has unsupported segment selector size %" PRIu8,
68 SectionName.data(), HeaderOffset, HeaderData.SegSize);
69 if (End < HeaderOffset +
sizeof(HeaderData) +
70 HeaderData.OffsetEntryCount *
sizeof(
uint32_t))
72 "%s table at offset 0x%" PRIx32
" has more offset entries (%" PRIu32
73 ") than there is space for",
74 SectionName.data(), HeaderOffset, HeaderData.OffsetEntryCount);
76 for (
uint32_t I = 0;
I < HeaderData.OffsetEntryCount; ++
I)
77 Offsets.push_back(Data.
getU32(OffsetPtr));
83 OS <<
format(
"0x%8.8" PRIx32
": ", HeaderOffset);
85 "%s list header: length = 0x%8.8" PRIx32
", version = 0x%4.4" PRIx16
", " 86 "addr_size = 0x%2.2" PRIx8
", seg_size = 0x%2.2" PRIx8
87 ", offset_entry_count = " 89 ListTypeString.
data(), HeaderData.Length, HeaderData.Version,
90 HeaderData.AddrSize, HeaderData.SegSize, HeaderData.OffsetEntryCount);
92 if (HeaderData.OffsetEntryCount > 0) {
94 for (
const auto &Off : Offsets) {
95 OS <<
format(
"\n0x%8.8" PRIx32, Off);
97 OS <<
format(
" => 0x%8.8" PRIx32,
98 Off + HeaderOffset +
sizeof(HeaderData));
105 if (HeaderData.Length == 0)
108 return HeaderData.Length +
sizeof(
uint32_t);
This class represents lattice values for constants.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Container for dump options that control which debug information will be dumped.
static ErrorSuccess success()
Create a success value.
This file contains constants used for implementing Dwarf debug support.
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.