21 uint64_t *OffsetPtr) {
22 HeaderOffset = *OffsetPtr;
25 std::tie(HeaderData.Length, Format) =
Data.getInitialLength(OffsetPtr, &Err);
29 SectionName.data(), HeaderOffset,
toString(std::move(Err)).
c_str());
36 "%s table at offset 0x%" PRIx64
37 " has too small length (0x%" PRIx64
38 ") to contain a complete header",
39 SectionName.data(), HeaderOffset, FullLength);
40 assert(FullLength ==
length() &&
"Inconsistent calculation of length.");
41 uint64_t
End = HeaderOffset + FullLength;
42 if (!
Data.isValidOffsetForDataOfSize(HeaderOffset, FullLength))
44 "section is not large enough to contain a %s table "
45 "of length 0x%" PRIx64
" at offset 0x%" PRIx64,
46 SectionName.data(), FullLength, HeaderOffset);
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 || HeaderData.Version > 6)
56 "unrecognised %s table version %" PRIu16
57 " in table at offset 0x%" PRIx64,
58 SectionName.data(), HeaderData.Version, HeaderOffset);
61 "%s table at offset 0x%" PRIx64, SectionName.data(), HeaderOffset))
63 if (HeaderData.SegSize != 0)
65 "%s table at offset 0x%" PRIx64
66 " has unsupported segment selector size %" PRIu8,
67 SectionName.data(), HeaderOffset, HeaderData.SegSize);
69 HeaderData.OffsetEntryCount * OffsetByteSize)
71 "%s table at offset 0x%" PRIx64
" has more offset entries (%" PRIu32
72 ") than there is space for",
73 SectionName.data(), HeaderOffset, HeaderData.OffsetEntryCount);
74 Data.setAddressSize(HeaderData.AddrSize);
75 *OffsetPtr += HeaderData.OffsetEntryCount * OffsetByteSize;
82 OS <<
formatv(
"{0:x8}: ", HeaderOffset);
84 OS <<
formatv(
"{0} list header: length = 0x{1:x-}", ListTypeString.data(),
88 <<
formatv(
", version = {0:x4}, addr_size = {1:x2}"
90 ", offset_entry_count = {3:x8}\n",
91 HeaderData.Version, HeaderData.AddrSize, HeaderData.SegSize,
92 HeaderData.OffsetEntryCount);
94 if (HeaderData.OffsetEntryCount > 0) {
96 for (
uint32_t I = 0;
I < HeaderData.OffsetEntryCount; ++
I) {
108 if (HeaderData.Length == 0)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains constants used for implementing Dwarf debug support.
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI StringRef FormatString(DwarfFormat Format)
uint8_t getUnitLengthFieldByteSize(DwarfFormat Format)
Get the byte size of the unit length field depending on the DWARF format.
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.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
@ Off
Use window algorithm after SMS algorithm fails.
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
@ End
Run the machine verifier once, at the end of the pipeline.
Container for dump options that control which debug information will be dumped.