9 #ifndef LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H 10 #define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H 71 : AccelSection(AccelSection), StringSection(StringSection) {}
99 uint64_t DIEOffsetBase;
106 struct HeaderData HdrData;
107 bool IsValid =
false;
112 uint64_t *DataOffset)
const;
117 const HeaderData *HdrData =
nullptr;
143 class ValueIterator :
public std::iterator<std::input_iterator_tag, Entry> {
146 uint64_t DataOffset = 0;
148 unsigned NumData = 0;
166 return A.NumData == B.NumData && A.DataOffset == B.DataOffset;
186 bool validateForms();
196 std::pair<uint64_t, dwarf::Tag> readAtoms(uint64_t *HashDataOffset);
258 : Index(Index), Form(Form) {}
273 std::vector<AttributeEncoding> Attributes)
274 : Code(Code), Tag(Tag), Attributes(
std::move(Attributes)) {}
328 std::error_code convertToErrorCode()
const override;
333 struct AbbrevMapInfo {
334 static Abbrev getEmptyKey();
335 static Abbrev getTombstoneKey();
336 static unsigned getHashValue(
uint32_t Code) {
339 static unsigned getHashValue(
const Abbrev &Abbr) {
340 return getHashValue(Abbr.
Code);
343 return LHS == RHS.
Code;
357 uint64_t StringOffset;
358 uint64_t EntryOffset;
362 uint64_t StringOffset, uint64_t EntryOffset)
363 : StrData(StrData), Index(Index), StringOffset(StringOffset),
364 EntryOffset(EntryOffset) {}
375 uint64_t Off = StringOffset;
394 uint64_t BucketsBase;
396 uint64_t StringOffsetsBase;
397 uint64_t EntryOffsetsBase;
398 uint64_t EntriesBase;
412 extractAttributeEncodings(uint64_t *Offset);
418 : Section(Section), Base(Base) {}
425 uint64_t getLocalTUOffset(
uint32_t TU)
const;
429 uint64_t getForeignTUSignature(
uint32_t TU)
const;
470 class ValueIterator :
public std::iterator<std::input_iterator_tag, Entry> {
482 uint64_t DataOffset = 0;
486 bool getEntryAtCurrentOffset();
488 bool findInCurrentIndex();
489 void searchFromStartOfCurrentIndex();
520 return A.CurrentIndex == B.CurrentIndex && A.DataOffset == B.DataOffset;
536 assert(CurrentName <= CurrentIndex->getNameCount());
550 : CurrentIndex(CurrentIndex), CurrentName(CurrentName) {}
566 return A.CurrentIndex == B.CurrentIndex && A.CurrentName == B.CurrentName;
594 const NameIndex *getCUNameIndex(uint64_t CUOffset);
599 #endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H The accelerator tables are designed to allow efficient random access (using a symbol name as a key) i...
Abbrev(uint32_t Code, dwarf::Tag Tag, std::vector< AttributeEncoding > Attributes)
typename SuperClass::const_iterator const_iterator
This class represents lattice values for constants.
const Abbrev & getAbbrev() const
Return the Abbreviation that can be used to interpret the raw values of this Accelerator Entry...
std::vector< AttributeEncoding > Attributes
List of index attributes.
Entry & operator=(const Entry &)=default
ValueIterator & operator++()
SmallVector< DWARFFormValue, 3 > Values
Implements a dense probed hash-table based set.
ValueIterator & operator++()
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
NameIndex(const DWARFDebugNames &Section, uint64_t Base)
uint64_t getUnitOffset() const
Abbreviation describing the encoding of Name Index entries.
An abstract class representing a single entry in the accelerator tables.
void log(raw_ostream &OS) const override
Print an error message to an output stream.
NameIterator(const NameIndex *CurrentIndex, uint32_t CurrentName)
Creates an iterator whose initial position is name CurrentName in CurrentIndex.
virtual void dump(raw_ostream &OS) const =0
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
friend bool operator==(const AttributeEncoding &LHS, const AttributeEncoding &RHS)
DWARFDataExtractor AccelSection
Tagged union holding either a T or a Error.
dwarf::Tag tag() const
.debug_names-specific getter, which always succeeds (DWARF v5 index entries always have a tag)...
Index attribute and its encoding.
dwarf::Tag Tag
Dwarf Tag of the described entity.
uint32_t getLocalTUCount() const
Apple-specific implementation of an Accelerator Entry.
NameTableEntry(const DataExtractor &StrData, uint32_t Index, uint64_t StringOffset, uint64_t EntryOffset)
uint64_t getNextUnitOffset() const
friend bool operator!=(const ValueIterator &A, const ValueIterator &B)
Optional< dwarf::Tag > getTag() const override
Returns the Tag of the Debug Info Entry associated with this Accelerator Entry or None if the Tag is ...
friend bool operator!=(const ValueIterator &A, const ValueIterator &B)
const DenseSet< Abbrev, AbbrevMapInfo > & getAbbrevs() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Represents a single accelerator table within the DWARF v5 .debug_names section.
const_iterator end() const
uint32_t getNameCount() const
NameTableEntry operator*() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DWARF v5-specific implementation of an Accelerator Entry.
This implements the Apple accelerator table format, a precursor of the DWARF 5 accelerator table form...
friend bool operator==(const NameIterator &A, const NameIterator &B)
uint32_t getForeignTUCount() const
virtual ~DWARFAcceleratorTable()
const Entry & operator*() const
DWARFDebugNames(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
virtual Optional< uint64_t > getCUOffset() const =0
Returns the Offset of the Compilation Unit associated with this Accelerator Entry or None if the Comp...
NameTableEntry getNameTableEntry(uint32_t Index) const
Reads an entry in the Name Table for the given Index.
uint32_t getBucketCount() const
DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
SmallVector< NameIndex, 0 >::const_iterator const_iterator
static const char *const Magic
ValueIterator operator++(int)
const char * getString() const
Return the string referenced by this name table entry or nullptr if the string offset is not valid...
.debug_names section consists of one or more units.
NameIterator & operator++()
A single entry in the Name Table (DWARF v5 sect.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const_iterator begin() const
ArrayRef< DWARFFormValue > getValues() const
Returns the raw values of fields in the Accelerator Entry.
constexpr AttributeEncoding(dwarf::Index Index, dwarf::Form Form)
uint32_t getIndex() const
Return the index of this name in the parent Name Index.
friend bool operator==(const ValueIterator &A, const ValueIterator &B)
ValueIterator operator++(int)
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
Base class for user error types.
Error returned by NameIndex::getEntry to report it has reached the end of the entry list...
NameIterator operator++(int)
virtual Optional< dwarf::Tag > getTag() const =0
Returns the Tag of the Debug Info Entry associated with this Accelerator Entry or None if the Tag is ...
AppleAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
NameIterator begin() const
friend bool operator==(const ValueIterator &A, const ValueIterator &B)
uint64_t getEntryOffset() const
Returns the offset of the first Entry in the list.
uint32_t getCUCount() const
uint32_t Code
Abbreviation code.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::input_iterator_tag iterator_category
virtual Error extract()=0
LLVM Value Representation.
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...
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
friend bool operator!=(const NameIterator &A, const NameIterator &B)
const Entry & operator*() const
StringRef - Represent a constant reference to a string, i.e.
uint64_t getStringOffset() const
Returns the offset of the name of the described entities.
DataExtractor StringSection