26 "not enough space to extract a rangelist encoding");
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();
89 std::optional<object::SectionedAddress> BaseAddr,
DWARFUnit &U)
const {
91 BaseAddr, U.getAddressByteSize(),
92 [&](
uint32_t Index) { return U.getAddrOffsetSectionItem(Index); });
96 std::optional<object::SectionedAddress> BaseAddr,
uint8_t AddressByteSize,
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};
120 switch (RLE.EntryKind) {
121 case dwarf::DW_RLE_offset_pair:
122 E.
LowPC = RLE.Value0;
123 if (E.
LowPC == Tombstone)
127 if (BaseAddr->Address == Tombstone)
129 E.
LowPC += BaseAddr->Address;
130 E.
HighPC += BaseAddr->Address;
133 case dwarf::DW_RLE_start_end:
134 E.
LowPC = RLE.Value0;
137 case dwarf::DW_RLE_start_length:
138 E.
LowPC = RLE.Value0;
141 case dwarf::DW_RLE_startx_length: {
142 auto Start = LookupPooledAddress(RLE.Value0);
146 E.
LowPC = Start->Address;
150 case dwarf::DW_RLE_startx_endx: {
151 auto Start = LookupPooledAddress(RLE.Value0);
154 auto End = LookupPooledAddress(RLE.Value1);
159 E.
LowPC = Start->Address;
168 if (E.
LowPC == Tombstone)
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))
This file contains constants used for implementing Dwarf debug support.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DWARFAddressRangesVector getAbsoluteRanges(std::optional< object::SectionedAddress > BaseAddr, uint8_t AddressByteSize, function_ref< std::optional< object::SectionedAddress >(uint32_t)> LookupPooledAddress) const
Build a DWARFAddressRangesVector from a rangelist.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef RangeListEncodingString(unsigned Encoding)
StringRef RLEString(unsigned RLE)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
This is an optimization pass for GlobalISel generic memory operations.
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
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.
void consumeError(Error Err)
Consume a Error without doing anything.
Container for dump options that control which debug information will be dumped.
void dump(raw_ostream &OS, uint32_t AddressSize, DIDumpOptions DumpOpts={}, const DWARFObject *Obj=nullptr) const
uint64_t SectionIndex
The index of the section this entry belongs to.
uint8_t EntryKind
The DWARF encoding (DW_RLE_* or DW_LLE_*).
uint64_t Offset
The offset at which the entry is located in the section.
A class representing a single range list entry.
Error extract(DWARFDataExtractor Data, uint64_t *OffsetPtr)
void dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength, uint64_t &CurrentBase, DIDumpOptions DumpOpts, llvm::function_ref< std::optional< object::SectionedAddress >(uint32_t)> LookupPooledAddress) const
uint64_t Value0
The values making up the range list entry.