27 HeaderOffset = *OffsetPtr;
31 "section is not large enough to contain a " 32 ".debug_addr table length at offset 0x%" 37 "DWARF version is not defined in CU," 38 " assuming version 5"));
45 if (UnitVersion >= 5) {
50 "DWARF64 is not supported in .debug_addr at offset 0x%" PRIx64,
57 ".debug_addr table at offset 0x%" PRIx64
58 " has too small length (0x%" PRIx32
59 ") to contain a complete header",
60 HeaderOffset, TmpLength);
62 uint64_t End = HeaderOffset +
getLength();
67 "section is not large enough to contain a .debug_addr table " 68 "of length 0x%" PRIx32
" at offset 0x%" PRIx64,
69 TmpLength, HeaderOffset);
77 HeaderData.
Version = UnitVersion;
81 DataSize = Data.
size();
91 " of .debug_addr section at offset 0x%" PRIx64
" is not supported",
92 HeaderData.
Version, HeaderOffset);
98 if (HeaderData.
Version != UnitVersion)
100 ".debug_addr table at offset 0x%" PRIx64
101 " has version %" PRIu16
102 " which is different from the version suggested" 103 " by the DWARF unit header: %" PRIu16,
104 HeaderOffset, HeaderData.
Version, UnitVersion);
107 ".debug_addr table at offset 0x%" PRIx64
108 " has unsupported address size %" PRIu8,
110 if (HeaderData.
AddrSize != AddrSize && AddrSize != 0)
112 ".debug_addr table at offset 0x%" PRIx64
113 " has address size %" PRIu8
114 " which is different from CU address size %" PRIu8,
115 HeaderOffset, HeaderData.
AddrSize, AddrSize);
120 ".debug_addr table at offset 0x%" PRIx64
121 " has unsupported segment selector size %" PRIu8,
122 HeaderOffset, HeaderData.
SegSize);
123 if (DataSize % HeaderData.
AddrSize != 0) {
126 ".debug_addr table at offset 0x%" PRIx64
127 " contains data of size %" PRIu32
128 " which is not a multiple of addr size %" PRIu8,
129 HeaderOffset, DataSize, HeaderData.
AddrSize);
135 Addrs.push_back(Data.
getU32(OffsetPtr));
137 Addrs.push_back(Data.
getU64(OffsetPtr));
143 OS <<
format(
"0x%8.8" PRIx32
": ", HeaderOffset);
144 OS <<
format(
"Addr Section: length = 0x%8.8" PRIx32
145 ", version = 0x%4.4" PRIx16
", " 146 "addr_size = 0x%2.2" PRIx8
", seg_size = 0x%2.2" PRIx8
"\n",
150 if (Addrs.size() > 0) {
151 const char *AddrFmt = (HeaderData.
AddrSize == 4) ?
"0x%8.8" PRIx64
"\n" 152 :
"0x%16.16" PRIx64
"\n";
154 for (uint64_t Addr : Addrs)
155 OS <<
format(AddrFmt, Addr);
161 if (Index < Addrs.size())
164 "Index %" PRIu32
" is out of range of the " 165 ".debug_addr table at offset 0x%" PRIx64,
166 Index, HeaderOffset);
170 if (HeaderData.
Length == 0)
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.
uint8_t getHeaderSize() const
Return the size of the table header including the length but not including the addresses.
Tagged union holding either a T or a Error.
Error extract(DWARFDataExtractor Data, uint64_t *OffsetPtr, uint16_t Version, uint8_t AddrSize, std::function< void(Error)> WarnCallback)
Extract an entire table, including all addresses.
Container for dump options that control which debug information will be dumped.
Expected< uint64_t > getAddrEntry(uint32_t Index) const
Return the address based on a given index.
void dump(raw_ostream &OS, DIDumpOptions DumpOpts={}) const
static ErrorSuccess success()
Create a success value.
uint32_t getLength() const
Returns the length of this table, including the length field, or 0 if the length has not been determi...
This file contains constants used for implementing Dwarf debug support.
uint32_t getDataSize() const
Returns the length of the array of addresses.
void invalidateLength()
Invalidate Length field to stop further processing.
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...
print Print MemDeps of function
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.