21 HeaderOffset = *OffsetPtr;
24 std::tie(HeaderData.Length, Format) =
Data.getInitialLength(OffsetPtr, &Err);
35 "%s table at offset 0x%" PRIx64
36 " has too small length (0x%" PRIx64
37 ") to contain a complete header",
39 assert(FullLength ==
length() &&
"Inconsistent calculation of length.");
41 if (!
Data.isValidOffsetForDataOfSize(HeaderOffset, FullLength))
43 "section is not large enough to contain a %s table "
44 "of length 0x%" PRIx64
" at offset 0x%" PRIx64,
47 HeaderData.Version =
Data.getU16(OffsetPtr);
48 HeaderData.AddrSize =
Data.getU8(OffsetPtr);
49 HeaderData.SegSize =
Data.getU8(OffsetPtr);
50 HeaderData.OffsetEntryCount =
Data.getU32(OffsetPtr);
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))
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;
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);
92 if (HeaderData.OffsetEntryCount > 0) {
94 for (
uint32_t I = 0;
I < HeaderData.OffsetEntryCount; ++
I) {
96 OS <<
format(
"\n0x%0*" PRIx64, OffsetDumpWidth, Off);
106 if (HeaderData.Length == 0)
This file contains constants used for implementing Dwarf debug support.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef FormatString(DwarfFormat Format)
uint8_t getUnitLengthFieldByteSize(DwarfFormat Format)
Get the byte size of the unit length field depending on the DWARF format.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
This is an optimization pass for GlobalISel generic memory operations.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Container for dump options that control which debug information will be dumped.