35 return OS <<
"DW_ATOM_unknown_" <<
format(
"%x",
A.Value);
49 "Section too small: cannot read header.");
64 "Section too small: cannot read buckets and hashes.");
69 HashDataEntryLength = 0;
76 for (
unsigned i = 0; i < NumAtoms; ++i) {
79 HdrData.Atoms.push_back(std::make_pair(AtomType, AtomForm));
81 std::optional<uint8_t> FormSize =
84 return MakeUnsupportedFormError(AtomForm);
85 HashDataEntryLength += *FormSize;
93 return Hdr.BucketCount;
98 return Hdr.HeaderDataLength;
104 return HdrData.Atoms;
110 switch (Atom.first) {
116 FormValue.
getForm() == dwarf::DW_FORM_sdata)
126std::pair<uint64_t, dwarf::Tag>
134 switch (Atom.first) {
145 return {DieOffset, DieTag};
148void AppleAcceleratorTable::Header::dump(
ScopedPrinter &W)
const {
150 W.printHex(
"Magic", Magic);
151 W.printHex(
"Version", Version);
152 W.printHex(
"Hash function", HashFunction);
153 W.printNumber(
"Bucket count", BucketCount);
154 W.printNumber(
"Hashes count", HashCount);
155 W.printNumber(
"HeaderData length", HeaderDataLength);
158std::optional<uint64_t> AppleAcceleratorTable::HeaderData::extractOffset(
159 std::optional<DWARFFormValue>
Value)
const {
163 switch (
Value->getForm()) {
164 case dwarf::DW_FORM_ref1:
165 case dwarf::DW_FORM_ref2:
166 case dwarf::DW_FORM_ref4:
167 case dwarf::DW_FORM_ref8:
168 case dwarf::DW_FORM_ref_udata:
169 return Value->getRawUValue() + DIEOffsetBase;
171 return Value->getAsSectionOffset();
180 W.printString(
"Incorrectly terminated list.");
188 W.startLine() <<
format(
"String: 0x%08" PRIx64, StringOffset);
195 for (
auto &Atom : AtomForms) {
196 W.startLine() <<
format(
"Atom[%d]: ", i);
198 Atom.dump(
W.getOStream());
199 if (std::optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
202 W.getOStream() <<
" (" << Str <<
")";
205 W.getOStream() <<
"Error extracting the value";
206 W.getOStream() <<
"\n";
221 W.printNumber(
"DIE offset base", HdrData.DIEOffsetBase);
222 W.printNumber(
"Number of atoms",
uint64_t(HdrData.Atoms.size()));
228 for (
const auto &Atom : HdrData.Atoms) {
230 W.startLine() <<
"Type: " <<
formatAtom(Atom.first) <<
'\n';
231 W.startLine() <<
"Form: " <<
formatv(
"{0}", Atom.second) <<
'\n';
239 uint64_t OffsetsBase = HashesBase + Hdr.HashCount * 4;
241 for (
unsigned Bucket = 0; Bucket < Hdr.BucketCount; ++Bucket) {
245 if (
Index == UINT32_MAX) {
246 W.printString(
"EMPTY");
250 for (
unsigned HashIdx =
Index; HashIdx < Hdr.HashCount; ++HashIdx) {
251 uint64_t HashOffset = HashesBase + HashIdx*4;
252 uint64_t OffsetsOffset = OffsetsBase + HashIdx*4;
255 if (Hash % Hdr.BucketCount != Bucket)
261 W.printString(
"Invalid section offset");
264 while (dumpName(W, AtomForms, &DataOffset))
272 Values.reserve(Table.HdrData.Atoms.size());
273 for (
const auto &Atom : Table.HdrData.Atoms)
278 for (
auto &FormValue :
Values)
282std::optional<DWARFFormValue>
284 for (
auto [Atom, FormValue] :
zip_equal(Table.HdrData.Atoms, Values))
285 if (Atom.first == AtomToFind)
290std::optional<uint64_t>
303 if (std::optional<uint64_t>
Value =
Tag->getAsUnsignedConstant())
312void AppleAcceleratorTable::Iterator::prepareNextEntryOrEnd() {
313 if (NumEntriesToCome == 0)
314 prepareNextStringOrEnd();
318 Current.BaseEntry.extract(&OffsetCopy);
320 Offset += getTable().getHashDataEntryLength();
323void AppleAcceleratorTable::Iterator::prepareNextStringOrEnd() {
324 std::optional<uint32_t> StrOffset = getTable().readStringOffsetAt(
Offset);
331 return prepareNextStringOrEnd();
332 Current.StrOffset = *StrOffset;
334 std::optional<uint32_t> MaybeNumEntries = getTable().readU32FromAccel(
Offset);
335 if (!MaybeNumEntries || *MaybeNumEntries == 0)
337 NumEntriesToCome = *MaybeNumEntries;
342 : Current(Table),
Offset(Table.getEntriesBase()), NumEntriesToCome(0) {
346 prepareNextEntryOrEnd();
351 const auto EmptyRange =
358 uint32_t BucketIdx = hashToBucketIdx(SearchHash);
359 std::optional<uint32_t> HashIdx = idxOfHashInBucket(SearchHash, BucketIdx);
363 std::optional<uint64_t> MaybeDataOffset = readIthOffset(*HashIdx);
364 if (!MaybeDataOffset)
367 uint64_t DataOffset = *MaybeDataOffset;
371 std::optional<uint32_t> StrOffset = readStringOffsetAt(DataOffset);
373 while (StrOffset && *StrOffset) {
374 std::optional<StringRef> MaybeStr = readStringFromStrSection(*StrOffset);
375 std::optional<uint32_t> NumEntries = this->readU32FromAccel(DataOffset);
376 if (!MaybeStr || !NumEntries)
379 if (Key == *MaybeStr)
382 DataOffset = EndOffset;
383 StrOffset = readStringOffsetAt(DataOffset);
389std::optional<uint32_t>
390AppleAcceleratorTable::idxOfHashInBucket(
uint32_t HashToFind,
392 std::optional<uint32_t> HashStartIdx = readIthBucket(BucketIdx);
397 std::optional<uint32_t> MaybeHash = readIthHash(HashIdx);
398 if (!MaybeHash || !wouldHashBeInBucket(*MaybeHash, BucketIdx))
400 if (*MaybeHash == HashToFind)
406std::optional<StringRef> AppleAcceleratorTable::readStringFromStrSection(
407 uint64_t StringSectionOffset)
const {
417std::optional<uint32_t>
419 bool UseRelocation)
const {
433 W.printHex(
"Length", UnitLength);
435 W.printNumber(
"Version", Version);
436 W.printNumber(
"CU count", CompUnitCount);
437 W.printNumber(
"Local TU count", LocalTypeUnitCount);
438 W.printNumber(
"Foreign TU count", ForeignTypeUnitCount);
439 W.printNumber(
"Bucket count", BucketCount);
440 W.printNumber(
"Name count", NameCount);
441 W.printHex(
"Abbreviations table size", AbbrevTableSize);
442 W.startLine() <<
"Augmentation: '" << AugmentationString <<
"'\n";
449 "parsing .debug_names header at 0x%" PRIx64
": %s",
459 LocalTypeUnitCount = AS.
getU32(
C);
460 ForeignTypeUnitCount = AS.
getU32(
C);
463 AbbrevTableSize = AS.
getU32(
C);
467 return HeaderError(
C.takeError());
471 "cannot read header augmentation"));
472 AugmentationString.resize(AugmentationStringSize);
473 AS.
getU8(
C,
reinterpret_cast<uint8_t *
>(AugmentationString.data()),
474 AugmentationStringSize);
476 return C.takeError();
484 W.startLine() <<
formatv(
"{0}: {1}\n", Attr.Index, Attr.Form);
500 return Abbr.
Code == 0;
512DWARFDebugNames::NameIndex::extractAttributeEncoding(
uint64_t *
Offset) {
515 "Incorrectly terminated abbreviation table.");
524DWARFDebugNames::NameIndex::extractAttributeEncodings(
uint64_t *
Offset) {
525 std::vector<AttributeEncoding>
Result;
527 auto AttrEncOr = extractAttributeEncoding(
Offset);
529 return AttrEncOr.takeError();
531 return std::move(Result);
533 Result.emplace_back(*AttrEncOr);
541 "Incorrectly terminated abbreviation table.");
549 auto AttrEncOr = extractAttributeEncodings(
Offset);
551 return AttrEncOr.takeError();
552 return Abbrev(Code,
dwarf::Tag(
Tag), AbbrevOffset, std::move(*AttrEncOr));
565 Offsets.BucketsBase =
Offset;
568 Offsets.HashesBase =
Offset;
572 Offsets.StringOffsetsBase =
Offset;
575 Offsets.EntryOffsetsBase =
Offset;
579 Offsets.EntriesBase =
Offset;
585 if (
Error E = Hdr.extract(AS, &hdrSize))
592 Offsets.EntryOffsetsBase + (Hdr.NameCount * SectionOffsetSize);
596 "Section too small: cannot read abbreviations.");
598 Offsets.EntriesBase =
Offset + Hdr.AbbrevTableSize;
601 auto AbbrevOr = extractAbbrev(&
Offset);
603 return AbbrevOr.takeError();
607 if (!Abbrevs.insert(std::move(*AbbrevOr)).second)
609 "Duplicate abbreviation code.");
614 : NameIdx(&NameIdx), Abbr(&Abbr) {
619 Values.emplace_back(Attr.Form);
622std::optional<DWARFFormValue>
627 return std::get<1>(Tuple);
633 return lookup(dwarf::DW_IDX_parent).has_value();
637 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_die_offset))
638 return Off->getAsReferenceUVal();
643 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_compile_unit))
644 return Off->getAsUnsignedConstant();
648 if (
lookup(dwarf::DW_IDX_type_unit).has_value())
656 std::optional<uint64_t>
Index = getCUIndex();
663 std::optional<uint64_t>
Index = getLocalTUIndex();
670 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_type_unit))
671 return Off->getAsUnsignedConstant();
678 std::optional<DWARFFormValue> ParentEntryOff =
lookup(dwarf::DW_IDX_parent);
679 assert(ParentEntryOff.has_value() &&
"hasParentInformation() must be called");
681 if (ParentEntryOff->getForm() == dwarf::Form::DW_FORM_flag_present)
690 W.getOStream() <<
"<invalid offset data>";
695 if (!ParentEntry->has_value()) {
696 W.getOStream() <<
"<parent not indexed>";
705 W.startLine() <<
formatv(
"Abbrev: {0:x}\n", Abbr->
Code);
706 W.startLine() <<
formatv(
"Tag: {0}\n", Abbr->
Tag);
709 auto Index = std::get<0>(Tuple).Index;
712 auto FormValue = std::get<1>(Tuple);
713 if (
Index == dwarf::Index::DW_IDX_parent)
714 dumpParentIdx(W, FormValue);
716 FormValue.dump(W.getOStream());
717 W.getOStream() <<
'\n';
730 return Section.AccelSection.getRelocatedValue(SectionOffsetSize, &
Offset);
734 assert(TU < Hdr.LocalTypeUnitCount);
737 Offsets.CUsBase + SectionOffsetSize * (Hdr.CompUnitCount + TU);
738 return Section.AccelSection.getRelocatedValue(SectionOffsetSize, &
Offset);
742 assert(TU < Hdr.ForeignTypeUnitCount);
746 SectionOffsetSize * (Hdr.CompUnitCount + Hdr.LocalTypeUnitCount) + 8 * TU;
747 return Section.AccelSection.getU64(&
Offset);
755 "Incorrectly terminated entry list.");
759 return make_error<SentinelError>();
761 const auto AbbrevIt = Abbrevs.find_as(AbbrevCode);
762 if (AbbrevIt == Abbrevs.end())
765 Entry E(*
this, *AbbrevIt);
768 for (
auto &
Value :
E.Values) {
771 "Error extracting index attribute values.");
781 Offsets.StringOffsetsBase + SectionOffsetSize * (
Index - 1);
783 Offsets.EntryOffsetsBase + SectionOffsetSize * (
Index - 1);
787 AS.getRelocatedValue(SectionOffsetSize, &StringOffsetOffset);
788 uint64_t EntryOffset = AS.getUnsigned(&EntryOffsetOffset, SectionOffsetSize);
789 EntryOffset += Offsets.EntriesBase;
790 return {Section.StringSection,
Index, StringOffset, EntryOffset};
795 assert(Bucket < Hdr.BucketCount);
796 uint64_t BucketOffset = Offsets.BucketsBase + 4 * Bucket;
797 return Section.AccelSection.getU32(&BucketOffset);
803 return Section.AccelSection.getU32(&HashOffset);
813 auto EntryOr = getEntry(
Offset);
826 const NameTableEntry &NTE,
827 std::optional<uint32_t> Hash)
const {
830 W.printHex(
"Hash", *Hash);
832 W.startLine() <<
format(
"String: 0x%08" PRIx64, NTE.getStringOffset());
833 W.getOStream() <<
" \"" << NTE.getString() <<
"\"\n";
835 uint64_t EntryOffset = NTE.getEntryOffset();
836 while (dumpEntry(W, &EntryOffset))
840void DWARFDebugNames::NameIndex::dumpCUs(
ScopedPrinter &W)
const {
841 ListScope CUScope(W,
"Compilation Unit offsets");
843 W.startLine() <<
format(
"CU[%u]: 0x%08" PRIx64
"\n",
CU, getCUOffset(
CU));
846void DWARFDebugNames::NameIndex::dumpLocalTUs(
ScopedPrinter &W)
const {
847 if (Hdr.LocalTypeUnitCount == 0)
850 ListScope TUScope(W,
"Local Type Unit offsets");
851 for (
uint32_t TU = 0; TU < Hdr.LocalTypeUnitCount; ++TU)
852 W.startLine() <<
format(
"LocalTU[%u]: 0x%08" PRIx64
"\n", TU,
853 getLocalTUOffset(TU));
856void DWARFDebugNames::NameIndex::dumpForeignTUs(
ScopedPrinter &W)
const {
857 if (Hdr.ForeignTypeUnitCount == 0)
860 ListScope TUScope(W,
"Foreign Type Unit signatures");
861 for (
uint32_t TU = 0; TU < Hdr.ForeignTypeUnitCount; ++TU) {
862 W.startLine() <<
format(
"ForeignTU[%u]: 0x%016" PRIx64
"\n", TU,
863 getForeignTUSignature(TU));
867void DWARFDebugNames::NameIndex::dumpAbbreviations(
ScopedPrinter &W)
const {
868 ListScope AbbrevsScope(W,
"Abbreviations");
869 std::vector<const Abbrev *> AbbrevsVect;
871 AbbrevsVect.push_back(&Abbr);
872 llvm::sort(AbbrevsVect, [](
const Abbrev *LHS,
const Abbrev *RHS) {
873 return LHS->AbbrevOffset <
RHS->AbbrevOffset;
884 W.printString(
"EMPTY");
887 if (
Index > Hdr.NameCount) {
888 W.printString(
"Name index is invalid");
894 if (Hash % Hdr.BucketCount != Bucket)
897 dumpName(W, getNameTableEntry(
Index), Hash);
907 dumpAbbreviations(W);
909 if (Hdr.BucketCount > 0) {
910 for (
uint32_t Bucket = 0; Bucket < Hdr.BucketCount; ++Bucket)
911 dumpBucket(W, Bucket);
915 W.startLine() <<
"Hash table not present\n";
917 dumpName(W, NTE, std::nullopt);
927 NameIndices.push_back(std::move(Next));
943std::optional<uint64_t>
944DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
945 const Header &Hdr = CurrentIndex->Hdr;
946 if (Hdr.BucketCount == 0) {
948 for (
const NameTableEntry &NTE : *CurrentIndex) {
949 if (NTE.sameNameAs(Key))
950 return NTE.getEntryOffset();
959 uint32_t Bucket = *Hash % Hdr.BucketCount;
965 uint32_t HashAtIndex = CurrentIndex->getHashArrayEntry(
Index);
966 if (HashAtIndex % Hdr.BucketCount != Bucket)
969 if (HashAtIndex != Hash)
972 NameTableEntry NTE = CurrentIndex->getNameTableEntry(
Index);
973 if (NTE.sameNameAs(Key))
974 return NTE.getEntryOffset();
979bool DWARFDebugNames::ValueIterator::getEntryAtCurrentOffset() {
980 auto EntryOr = CurrentIndex->getEntry(&DataOffset);
985 CurrentEntry = std::move(*EntryOr);
989bool DWARFDebugNames::ValueIterator::findInCurrentIndex() {
990 std::optional<uint64_t>
Offset = findEntryOffsetInCurrentIndex();
994 return getEntryAtCurrentOffset();
997void DWARFDebugNames::ValueIterator::searchFromStartOfCurrentIndex() {
998 for (
const NameIndex *
End = CurrentIndex->Section.NameIndices.end();
999 CurrentIndex !=
End; ++CurrentIndex) {
1000 if (findInCurrentIndex())
1006void DWARFDebugNames::ValueIterator::next() {
1007 assert(CurrentIndex &&
"Incrementing an end() iterator?");
1010 if (getEntryAtCurrentOffset())
1014 if (IsLocal || CurrentIndex == &CurrentIndex->Section.NameIndices.back()) {
1021 searchFromStartOfCurrentIndex();
1028 searchFromStartOfCurrentIndex();
1034 if (!findInCurrentIndex())
1040 if (NameIndices.empty())
1047 if (CUToNameIndex.size() == 0 && NameIndices.size() > 0) {
1048 for (
const auto &NI : *
this) {
1050 CUToNameIndex.try_emplace(NI.getCUOffset(
CU), &NI);
1053 return CUToNameIndex.lookup(CUOffset);
1057 return Name.size() > 2 && (
Name[0] ==
'-' ||
Name[0] ==
'+') &&
1063 return std::nullopt;
1066 size_t FirstSpace = ClassNameStart.
find(
' ');
1068 return std::nullopt;
1071 if (!SelectorStart.
size())
1072 return std::nullopt;
1100 if (!
Name.ends_with(
">") ||
Name.count(
"<") == 0 ||
Name.ends_with(
"<=>"))
1104 size_t NumLeftAnglesToSkip = 1;
1107 NumLeftAnglesToSkip +=
Name.count(
"<=>");
1109 size_t RightAngleCount =
Name.count(
'>');
1110 size_t LeftAngleCount =
Name.count(
'<');
1114 if (LeftAngleCount > RightAngleCount)
1115 NumLeftAnglesToSkip += LeftAngleCount - RightAngleCount;
1117 size_t StartOfTemplate = 0;
1118 while (NumLeftAnglesToSkip--)
1119 StartOfTemplate =
Name.find(
'<', StartOfTemplate) + 1;
1121 return Name.substr(0, StartOfTemplate - 1);
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
#define offsetof(TYPE, MEMBER)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
static constexpr DWARFDebugNames::AttributeEncoding sentinelAttrEnc()
static bool isSentinel(const DWARFDebugNames::AttributeEncoding &AE)
static DWARFDebugNames::Abbrev sentinelAbbrev()
static bool isObjCSelector(StringRef Name)
static Atom formatAtom(unsigned Atom)
This file contains constants used for implementing Dwarf debug support.
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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
This class holds an abstract representation of an Accelerator Table, consisting of a sequence of buck...
std::optional< DWARFFormValue > lookup(HeaderData::AtomType Atom) const
Returns the value of the Atom in this Accelerator Entry, if the Entry contains such Atom.
std::optional< uint64_t > getDIESectionOffset() const
Returns the Section Offset of the Debug Info Entry associated with this Accelerator Entry or std::nul...
std::optional< dwarf::Tag > getTag() const override
Returns the Tag of the Debug Info Entry associated with this Accelerator Entry or std::nullopt if the...
std::optional< uint64_t > getCUOffset() const override
Returns the Offset of the Compilation Unit associated with this Accelerator Entry or std::nullopt if ...
Iterator(const AppleAcceleratorTable &Table, bool SetEnd=false)
An iterator for Entries all having the same string as key.
SameNameIterator(const AppleAcceleratorTable &AccelTable, uint64_t DataOffset)
Construct a new iterator for the entries at DataOffset.
This implements the Apple accelerator table format, a precursor of the DWARF 5 accelerator table form...
iterator_range< SameNameIterator > equal_range(StringRef Key) const
Look up all entries in the accelerator table matching Key.
uint32_t getNumBuckets() const
uint32_t getSizeHdr() const
std::pair< uint64_t, dwarf::Tag > readAtoms(uint64_t *HashDataOffset)
Return information related to the DWARF DIE we're looking for when performing a lookup by name.
uint32_t getNumHashes() const
uint32_t getHashDataEntryLength() const
Returns the size of one HashData entry.
void dump(raw_ostream &OS) const override
ArrayRef< std::pair< HeaderData::AtomType, HeaderData::Form > > getAtomsDesc()
Return the Atom description, which can be used to interpret the raw values of the Accelerator Entries...
uint32_t getHeaderDataLength() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
SmallVector< DWARFFormValue, 3 > Values
DataExtractor StringSection
virtual ~DWARFAcceleratorTable()
DWARFDataExtractor AccelSection
DWARF v5-specific implementation of an Accelerator Entry.
std::optional< uint64_t > getLocalTUIndex() const
Returns the Index into the Local Type Unit list of the owning Name Index or std::nullopt if this Acce...
std::optional< uint64_t > getCUIndex() const
Returns the Index into the Compilation Unit list of the owning Name Index or std::nullopt if this Acc...
std::optional< uint64_t > getCUOffset() const override
Returns the Offset of the Compilation Unit associated with this Accelerator Entry or std::nullopt if ...
std::optional< uint64_t > getDIEUnitOffset() const
Returns the Offset of the DIE within the containing CU or TU.
Expected< std::optional< DWARFDebugNames::Entry > > getParentDIEEntry() const
Returns the Entry corresponding to the parent of the DIE represented by this Entry.
bool hasParentInformation() const
Returns true if this Entry has information about its parent DIE (i.e.
std::optional< DWARFFormValue > lookup(dwarf::Index Index) const
Returns the value of the Index Attribute in this Accelerator Entry, if the Entry contains such Attrib...
std::optional< uint64_t > getLocalTUOffset() const override
Returns the Offset of the Type Unit associated with this Accelerator Entry or std::nullopt if the Typ...
void dumpParentIdx(ScopedPrinter &W, const DWARFFormValue &FormValue) const
void dump(ScopedPrinter &W) const
Represents a single accelerator table within the DWARF v5 .debug_names section.
uint32_t getHashArrayEntry(uint32_t Index) const
Reads an entry in the Hash Array for the given Index.
uint64_t getLocalTUOffset(uint32_t TU) const
Reads offset of local type unit TU, TU is 0-based.
uint32_t getBucketArrayEntry(uint32_t Bucket) const
Reads an entry in the Bucket Array for the given Bucket.
uint64_t getNextUnitOffset() const
void dump(ScopedPrinter &W) const
uint32_t getCUCount() const
iterator_range< ValueIterator > equal_range(StringRef Key) const
Look up all entries in this Name Index matching Key.
uint64_t getCUOffset(uint32_t CU) const
Reads offset of compilation unit CU. CU is 0-based.
Expected< Entry > getEntry(uint64_t *Offset) const
NameTableEntry getNameTableEntry(uint32_t Index) const
Reads an entry in the Name Table for the given Index.
uint64_t getForeignTUSignature(uint32_t TU) const
Reads signature of foreign type unit TU. TU is 0-based.
uint32_t getLocalTUCount() const
Expected< Entry > getEntryAtRelativeOffset(uint64_t Offset) const
Returns the Entry at the relative Offset from the start of the Entry pool.
A single entry in the Name Table (DWARF v5 sect.
Error returned by NameIndex::getEntry to report it has reached the end of the entry list.
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
ValueIterator()=default
End marker.
.debug_names section consists of one or more units.
const NameIndex * getCUNameIndex(uint64_t CUOffset)
Return the Name Index covering the compile unit at CUOffset, or nullptr if there is no Name Index cov...
const_iterator begin() const
iterator_range< ValueIterator > equal_range(StringRef Key) const
Look up all entries in the accelerator table matching Key.
void dump(raw_ostream &OS) const override
Base class for error info classes.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
char back() const
back - Get the last character in the string.
constexpr size_t size() const
size - Get the string size.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static constexpr size_t npos
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(const uint64_t &Val)
LLVM Value Representation.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef FormEncodingString(unsigned Encoding)
StringRef AtomTypeString(unsigned Atom)
StringRef FormatString(DwarfFormat Format)
@ C
The default llvm calling convention, compatible with C.
StringRef AtomValueString(uint16_t Atom, unsigned Val)
Returns the symbolic string representing Val when used as a value for atom Atom.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
const uint32_t DW_INVALID_OFFSET
Identifier of an invalid DIE offset in the .debug_info section.
std::optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
@ DW_ATOM_die_offset
Marker as the end of a list of atoms.
NodeAddr< CodeNode * > Code
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
void findDebugNamesOffsets(DWARFDebugNames::DWARFDebugNamesOffsets &Offsets, uint64_t HdrSize, const dwarf::DwarfFormat Format, const DWARFDebugNames::Header &Hdr)
Calculates the starting offsets for various sections within the .debug_names section.
detail::zippy< detail::zip_first, T, U, Args... > zip_equal(T &&t, U &&u, Args &&...args)
zip iterator that assumes that all iteratees have the same length.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
detail::zippy< detail::zip_first, T, U, Args... > zip_first(T &&t, U &&u, Args &&...args)
zip iterator that, for the sake of efficiency, assumes the first iteratee to be the shortest.
void sort(IteratorTy Start, IteratorTy End)
std::optional< StringRef > StripTemplateParameters(StringRef Name)
If Name is the name of a templated function that includes template parameters, returns a substring of...
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H=5381)
Computes the Bernstein hash after folding the input according to the Dwarf 5 standard case folding ru...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
uint32_t djbHash(StringRef Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
std::optional< ObjCSelectorNames > getObjCNamesIfSelector(StringRef Name)
If Name is the AT_name of a DIE which refers to an Objective-C selector, returns an instance of ObjCS...
void consumeError(Error Err)
Consume a Error without doing anything.
Implement std::hash so that hash_code can be used in STL containers.
Abbreviation describing the encoding of Name Index entries.
void dump(ScopedPrinter &W) const
uint32_t Code
< Abbreviation offset in the .debug_names section
std::vector< AttributeEncoding > Attributes
List of index attributes.
dwarf::Tag Tag
Dwarf Tag of the described entity.
Index attribute and its encoding.
Offsets for the start of various important tables from the start of the section.
StringRef ClassName
For "-[A(Category) method:]", this would be "A(category)".
std::optional< std::string > MethodNameNoCategory
For "-[A(Category) method:]", this would be "A method:".
StringRef Selector
For "-[A(Category) method:]", this would be "method:".
std::optional< StringRef > ClassNameNoCategory
For "-[A(Category) method:]", this would be "A".