10 #ifndef LLVM_DEBUGINFO_DWARFLISTTABLE_H 11 #define LLVM_DEBUGINFO_DWARFLISTTABLE_H 40 using EntryType = ListEntryType;
41 using ListEntries = std::vector<EntryType>;
47 const ListEntries &
getEntries()
const {
return Entries; }
48 bool empty()
const {
return Entries.empty(); }
49 void clear() { Entries.clear(); }
93 : SectionName(SectionName), ListTypeString(ListTypeString) {}
109 if (Index < Offsets.size())
110 return Offsets[Index];
132 std::map<uint32_t, DWARFListType> ListMap;
140 : Header(SectionName, ListTypeString), HeaderString(HeaderString) {}
149 return Header.
extract(Data, OffsetPtr);
185 template <
typename DWARFListType>
189 if (
Error E = extractHeaderAndOffsets(Data, OffsetPtr))
193 uint32_t End = getHeaderOffset() + Header.length();
194 while (*OffsetPtr < End) {
197 if (
Error E = CurrentList.
extract(Data, getHeaderOffset(), End, OffsetPtr,
198 Header.getSectionName(),
199 Header.getListTypeString()))
201 ListMap[Off] = CurrentList;
204 assert(*OffsetPtr == End &&
205 "mismatch between expected length of table and length " 206 "of extracted data");
210 template <
typename ListEntryType>
216 if (*OffsetPtr < HeaderOffset || *OffsetPtr >= End)
218 "invalid %s list offset 0x%" PRIx32,
219 ListTypeString.
data(), *OffsetPtr);
221 while (*OffsetPtr < End) {
223 if (
Error E = Entry.extract(Data, End, OffsetPtr))
225 Entries.push_back(Entry);
226 if (Entry.isSentinel())
230 "no end of list marker detected at end of %s table " 231 "starting at offset 0x%" PRIx32,
232 SectionName.
data(), HeaderOffset);
235 template <
typename DWARFListType>
241 Header.dump(OS, DumpOpts);
242 OS << HeaderString <<
"\n";
246 size_t MaxEncodingStringLength = 0;
248 for (
const auto &
List : ListMap)
249 for (
const auto &Entry :
List.second.getEntries())
250 MaxEncodingStringLength =
255 uint64_t CurrentBase = 0;
256 for (
const auto &
List : ListMap)
257 for (
const auto &Entry :
List.second.getEntries())
258 Entry.
dump(OS, getAddrSize(), MaxEncodingStringLength, CurrentBase,
259 DumpOpts, LookupPooledAddress);
262 template <
typename DWARFListType>
266 auto Entry = ListMap.find(Offset);
267 if (Entry != ListMap.end())
268 return Entry->second;
272 uint32_t End = getHeaderOffset() + Header.length();
275 List.extract(Data, getHeaderOffset(), End, &Offset,
276 Header.getSectionName(), Header.getListTypeString()))
278 ListMap[StartingOffset] =
List;
284 #endif // LLVM_DEBUGINFO_DWARFLISTTABLE_H
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
const ListEntries & getEntries() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
An efficient, type-erasing, non-owning reference to a callable.
Expected< DWARFListType > findList(DWARFDataExtractor Data, uint32_t Offset)
Look up a list based on a given offset.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
A base class for DWARF list entries, such as range or location list entries.
uint8_t EntryKind
The DWARF encoding (DW_RLE_* or DW_LLE_*).
Tagged union holding either a T or a Error.
uint64_t SectionIndex
The index of the section this entry belongs to.
Container for dump options that control which debug information will be dumped.
uint32_t getHeaderOffset() const
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Optional< uint32_t > getOffsetEntry(uint32_t Index) const
Return the contents of the offset entry designated by a given index.
Error extract(DWARFDataExtractor Data, uint32_t HeaderOffset, uint32_t End, uint32_t *OffsetPtr, StringRef SectionName, StringRef ListStringName)
StringRef RangeListEncodingString(unsigned Encoding)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
DWARFListTableBase(StringRef SectionName, StringRef HeaderString, StringRef ListTypeString)
static ErrorSuccess success()
Create a success value.
uint32_t Offset
The offset at which the entry is located in the section.
Error extractHeaderAndOffsets(DWARFDataExtractor Data, uint32_t *OffsetPtr)
Extract the table header and the array of offsets.
void dump(raw_ostream &OS, llvm::function_ref< Optional< SectionedAddress >(uint32_t)> LookupPooledAddress, DIDumpOptions DumpOpts={}) const
This file contains constants used for implementing Dwarf debug support.
uint8_t getHeaderSize() const
Return the size of the table header including the length but not including the offsets.
static void clear(coro::Shape &Shape)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Error extract(DWARFDataExtractor Data, uint32_t *OffsetPtr)
Extract an entire table, including all list entries.
uint8_t getAddrSize() const
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...
StringRef - Represent a constant reference to a string, i.e.
A base class for lists of entries that are extracted from a particular section, such as range lists o...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
A class representing a table of lists as specified in the DWARF v5 standard for location lists and ra...