28 "not enough space to extract a rangelist encoding");
33 case dwarf::DW_RLE_end_of_list:
37 case dwarf::DW_RLE_base_addressx: {
41 case dwarf::DW_RLE_startx_endx:
45 case dwarf::DW_RLE_startx_length: {
50 case dwarf::DW_RLE_offset_pair: {
55 case dwarf::DW_RLE_base_address: {
59 case dwarf::DW_RLE_start_end: {
64 case dwarf::DW_RLE_start_length: {
72 "unknown rnglists encoding 0x%" PRIx32
73 " at offset 0x%" PRIx64,
81 "read past end of table when reading %s encoding at offset 0x%" PRIx64,
85 *OffsetPtr =
C.tell();
91 std::optional<object::SectionedAddress> BaseAddr,
DWARFUnit &U)
const {
93 BaseAddr, U.getAddressByteSize(),
94 [&](
uint32_t Index) { return U.getAddrOffsetSectionItem(Index); });
98 std::optional<object::SectionedAddress> BaseAddr,
uint8_t AddressByteSize,
100 LookupPooledAddress)
const {
104 if (RLE.EntryKind == dwarf::DW_RLE_end_of_list)
106 if (RLE.EntryKind == dwarf::DW_RLE_base_addressx) {
107 BaseAddr = LookupPooledAddress(RLE.Value0);
109 BaseAddr = {RLE.Value0, -1ULL};
112 if (RLE.EntryKind == dwarf::DW_RLE_base_address) {
113 BaseAddr = {RLE.Value0, RLE.SectionIndex};
119 if (BaseAddr && E.SectionIndex == -1ULL)
120 E.SectionIndex = BaseAddr->SectionIndex;
122 switch (RLE.EntryKind) {
123 case dwarf::DW_RLE_offset_pair:
124 E.LowPC = RLE.Value0;
127 E.HighPC = RLE.Value1;
131 E.LowPC += BaseAddr->Address;
132 E.HighPC += BaseAddr->Address;
135 case dwarf::DW_RLE_start_end:
136 E.LowPC = RLE.Value0;
137 E.HighPC = RLE.Value1;
139 case dwarf::DW_RLE_start_length:
140 E.LowPC = RLE.Value0;
141 E.HighPC = E.LowPC + RLE.Value1;
143 case dwarf::DW_RLE_startx_length: {
144 auto Start = LookupPooledAddress(RLE.Value0);
147 E.SectionIndex = Start->SectionIndex;
148 E.LowPC = Start->Address;
149 E.HighPC = E.LowPC + RLE.Value1;
152 case dwarf::DW_RLE_startx_endx: {
153 auto Start = LookupPooledAddress(RLE.Value0);
156 auto End = LookupPooledAddress(RLE.Value1);
160 E.SectionIndex = Start->SectionIndex;
161 E.LowPC = Start->Address;
162 E.HighPC = End->Address;
181 LookupPooledAddress)
const {
187 .
dump(OS, AddrSize, DumpOpts);
197 assert(!EncodingString.empty() &&
"Unknown range entry encoding");
199 fmt_pad(EncodingString.data(), 0,
200 MaxEncodingStringLength - EncodingString.size()));
201 if (
EntryKind != dwarf::DW_RLE_end_of_list)
208 case dwarf::DW_RLE_end_of_list:
209 OS << (DumpOpts.
Verbose ?
"" :
"<End of list>");
211 case dwarf::DW_RLE_base_addressx: {
212 if (
auto SA = LookupPooledAddress(
Value0))
213 CurrentBase = SA->Address;
221 case dwarf::DW_RLE_base_address:
228 case dwarf::DW_RLE_start_length:
229 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
232 case dwarf::DW_RLE_offset_pair:
233 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
236 .
dump(OS, AddrSize, DumpOpts);
240 case dwarf::DW_RLE_start_end:
243 case dwarf::DW_RLE_startx_length: {
244 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
246 if (
auto SA = LookupPooledAddress(
Value0))
251 case dwarf::DW_RLE_startx_endx: {
252 PrintRawEntry(OS, *
this, AddrSize, DumpOpts);
254 if (
auto SA = LookupPooledAddress(
Value0))
257 if (
auto SA = LookupPooledAddress(
Value1))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains constants used for implementing Dwarf debug support.
LocallyHashedType DenseMapInfo< LocallyHashedType >::Tombstone
LLVM_ABI 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.
LLVM_ABI StringRef RangeListEncodingString(unsigned Encoding)
LLVM_ABI 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.
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)
support::detail::PadAdapter< T > fmt_pad(T &&Item, size_t Left, size_t Right)
FunctionAddr VTableAddr uintptr_t uintptr_t Data
void consumeError(Error Err)
Consume a Error without doing anything.
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
Container for dump options that control which debug information will be dumped.
LLVM_ABI 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.
LLVM_ABI Error extract(DWARFDataExtractor Data, uint64_t *OffsetPtr)
LLVM_ABI 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.