28 HeaderOffset = *OffsetPtr;
32 "section is not large enough to contain a " 33 ".debug_addr table length at offset 0x%" 38 "DWARF version is not defined in CU," 39 " assuming version 5"));
46 if (UnitVersion >= 5) {
48 if (HeaderData.
Length == 0xffffffffu) {
51 "DWARF64 is not supported in .debug_addr at offset 0x%" PRIx32,
58 ".debug_addr table at offset 0x%" PRIx32
59 " has too small length (0x%" PRIx32
60 ") to contain a complete header",
61 HeaderOffset, TmpLength);
68 "section is not large enough to contain a .debug_addr table " 69 "of length 0x%" PRIx32
" at offset 0x%" PRIx32,
70 TmpLength, HeaderOffset);
78 HeaderData.
Version = UnitVersion;
82 DataSize = Data.
size();
92 " of .debug_addr section at offset 0x%" PRIx32
" is not supported",
93 HeaderData.
Version, HeaderOffset);
99 if (HeaderData.
Version != UnitVersion)
101 ".debug_addr table at offset 0x%" PRIx32
102 " has version %" PRIu16
103 " which is different from the version suggested" 104 " by the DWARF unit header: %" PRIu16,
105 HeaderOffset, HeaderData.
Version, UnitVersion);
108 ".debug_addr table at offset 0x%" PRIx32
109 " has unsupported address size %" PRIu8,
111 if (HeaderData.
AddrSize != AddrSize && AddrSize != 0)
113 ".debug_addr table at offset 0x%" PRIx32
114 " has address size %" PRIu8
115 " which is different from CU address size %" PRIu8,
116 HeaderOffset, HeaderData.
AddrSize, AddrSize);
121 ".debug_addr table at offset 0x%" PRIx32
122 " has unsupported segment selector size %" PRIu8,
123 HeaderOffset, HeaderData.
SegSize);
124 if (DataSize % HeaderData.
AddrSize != 0) {
127 ".debug_addr table at offset 0x%" PRIx32
128 " contains data of size %" PRIu32
129 " which is not a multiple of addr size %" PRIu8,
130 HeaderOffset, DataSize, HeaderData.
AddrSize);
136 Addrs.push_back(Data.
getU32(OffsetPtr));
138 Addrs.push_back(Data.
getU64(OffsetPtr));
144 OS <<
format(
"0x%8.8" PRIx32
": ", HeaderOffset);
145 OS <<
format(
"Addr Section: length = 0x%8.8" PRIx32
146 ", version = 0x%4.4" PRIx16
", " 147 "addr_size = 0x%2.2" PRIx8
", seg_size = 0x%2.2" PRIx8
"\n",
151 static const char *Fmt32 =
"0x%8.8" PRIx64;
152 static const char *Fmt64 =
"0x%16.16" PRIx64;
153 std::string AddrFmt =
"\n";
154 std::string AddrFmtVerbose =
" => ";
156 AddrFmt.append(Fmt32);
157 AddrFmtVerbose.append(Fmt32);
160 AddrFmt.append(Fmt64);
161 AddrFmtVerbose.append(Fmt64);
164 if (Addrs.size() > 0) {
166 for (uint64_t Addr : Addrs) {
167 OS <<
format(AddrFmt.c_str(), Addr);
169 OS <<
format(AddrFmtVerbose.c_str(),
170 Addr + HeaderOffset +
sizeof(HeaderData));
177 if (Index < Addrs.size())
180 "Index %" PRIu32
" is out of range of the " 181 ".debug_addr table at offset 0x%" PRIx32,
182 Index, HeaderOffset);
186 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.
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.
Error extract(DWARFDataExtractor Data, uint32_t *OffsetPtr, uint16_t Version, uint8_t AddrSize, std::function< void(Error)> WarnCallback)
Extract an entire table, including all addresses.
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.