26 "not enough space to extract a rangelist encoding");
27 uint8_t Encoding =
Data.getU8(OffsetPtr);
31 case dwarf::DW_RLE_end_of_list:
35 case dwarf::DW_RLE_base_addressx: {
39 case dwarf::DW_RLE_startx_endx:
43 case dwarf::DW_RLE_startx_length: {
48 case dwarf::DW_RLE_offset_pair: {
53 case dwarf::DW_RLE_base_address: {
57 case dwarf::DW_RLE_start_end: {
62 case dwarf::DW_RLE_start_length: {
70 "unknown rnglists encoding 0x%" PRIx32
71 " at offset 0x%" PRIx64,
79 "read past end of table when reading %s encoding at offset 0x%" PRIx64,
83 *OffsetPtr =
C.tell();
92 [&](
uint32_t Index) { return U.getAddrOffsetSectionItem(Index); });
98 LookupPooledAddress)
const {
102 if (RLE.EntryKind == dwarf::DW_RLE_end_of_list)
104 if (RLE.EntryKind == dwarf::DW_RLE_base_addressx) {
105 BaseAddr = LookupPooledAddress(RLE.Value0);
107 BaseAddr = {RLE.Value0, -1ULL};
110 if (RLE.EntryKind == dwarf::DW_RLE_base_address) {
111 BaseAddr = {RLE.Value0, RLE.SectionIndex};
116 E.SectionIndex = RLE.SectionIndex;
117 if (BaseAddr &&
E.SectionIndex == -1ULL)
120 switch (RLE.EntryKind) {
121 case dwarf::DW_RLE_offset_pair:
122 E.LowPC = RLE.Value0;
123 if (
E.LowPC == Tombstone)
125 E.HighPC = RLE.Value1;
127 if (BaseAddr->
Address == Tombstone)
133 case dwarf::DW_RLE_start_end:
134 E.LowPC = RLE.Value0;
135 E.HighPC = RLE.Value1;
137 case dwarf::DW_RLE_start_length:
138 E.LowPC = RLE.Value0;
139 E.HighPC =
E.LowPC + RLE.Value1;
141 case dwarf::DW_RLE_startx_length: {
142 auto Start = LookupPooledAddress(RLE.Value0);
145 E.SectionIndex = Start->SectionIndex;
146 E.LowPC = Start->Address;
147 E.HighPC =
E.LowPC + RLE.Value1;
150 case dwarf::DW_RLE_startx_endx: {
151 auto Start = LookupPooledAddress(RLE.Value0);
154 auto End = LookupPooledAddress(RLE.Value1);
158 E.SectionIndex = Start->SectionIndex;
159 E.LowPC = Start->Address;
160 E.HighPC = End->Address;
168 if (
E.LowPC == Tombstone)
176 raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
179 LookupPooledAddress)
const {
185 .
dump(OS, AddrSize, DumpOpts);
195 assert(!EncodingString.empty() &&
"Unknown range entry encoding");
196 OS <<
format(
" [%s%*c", EncodingString.data(),
197 MaxEncodingStringLength - EncodingString.size() + 1,
']');
198 if (
EntryKind != dwarf::DW_RLE_end_of_list)
205 case dwarf::DW_RLE_end_of_list:
206 OS << (DumpOpts.
Verbose ?
"" :
"<End of list>");
208 case dwarf::DW_RLE_base_addressx: {
209 if (
auto SA = LookupPooledAddress(
Value0))
210 CurrentBase = SA->Address;
218 case dwarf::DW_RLE_base_address:
225 case dwarf::DW_RLE_start_length:
226 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
229 case dwarf::DW_RLE_offset_pair:
230 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
231 if (CurrentBase != Tombstone)
233 .
dump(OS, AddrSize, DumpOpts);
237 case dwarf::DW_RLE_start_end:
240 case dwarf::DW_RLE_startx_length: {
241 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
243 if (
auto SA = LookupPooledAddress(
Value0))
248 case dwarf::DW_RLE_startx_endx: {
249 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
251 if (
auto SA = LookupPooledAddress(
Value0))
254 if (
auto SA = LookupPooledAddress(
Value1))