34 return OS <<
"DW_ATOM_unknown_" <<
formatv(
"{0:x-}",
A.Value);
48 "Section too small: cannot read header.");
60 if (!
AccelSection.isValidOffset(getIthBucketBase(Hdr.BucketCount - 1)))
63 "Section too small: cannot read buckets and hashes.");
68 HashDataEntryLength = 0;
69 auto MakeUnsupportedFormError = [](
dwarf::Form Form) {
75 for (
unsigned i = 0; i < NumAtoms; ++i) {
78 HdrData.Atoms.push_back(std::make_pair(AtomType, AtomForm));
80 std::optional<uint8_t> FormSize =
83 return MakeUnsupportedFormError(AtomForm);
84 HashDataEntryLength += *FormSize;
92 return Hdr.BucketCount;
97 return Hdr.HeaderDataLength;
100ArrayRef<std::pair<AppleAcceleratorTable::HeaderData::AtomType,
101 AppleAcceleratorTable::HeaderData::Form>>
103 return HdrData.Atoms;
109 switch (Atom.first) {
115 FormValue.
getForm() == dwarf::DW_FORM_sdata)
125std::pair<uint64_t, dwarf::Tag>
133 switch (Atom.first) {
144 return {DieOffset, DieTag};
147void AppleAcceleratorTable::Header::dump(
ScopedPrinter &W)
const {
149 W.printHex(
"Magic", Magic);
150 W.printHex(
"Version",
Version);
151 W.printHex(
"Hash function", HashFunction);
152 W.printNumber(
"Bucket count", BucketCount);
153 W.printNumber(
"Hashes count", HashCount);
154 W.printNumber(
"HeaderData length", HeaderDataLength);
157std::optional<uint64_t> AppleAcceleratorTable::HeaderData::extractOffset(
158 std::optional<DWARFFormValue>
Value)
const {
162 switch (
Value->getForm()) {
163 case dwarf::DW_FORM_ref1:
164 case dwarf::DW_FORM_ref2:
165 case dwarf::DW_FORM_ref4:
166 case dwarf::DW_FORM_ref8:
167 case dwarf::DW_FORM_ref_udata:
168 return Value->getRawUValue() + DIEOffsetBase;
170 return Value->getAsSectionOffset();
174bool AppleAcceleratorTable::dumpName(ScopedPrinter &W,
175 SmallVectorImpl<DWARFFormValue> &AtomForms,
178 if (!
AccelSection.isValidOffsetForDataOfSize(*DataOffset, 4)) {
179 W.printString(
"Incorrectly terminated list.");
187 W.startLine() <<
formatv(
"String: {0:x8}", StringOffset);
188 W.getOStream() <<
" \"" <<
StringSection.getCStr(&StringOffset) <<
"\"\n";
192 ListScope DataScope(W, (
"Data " + Twine(
Data)).str());
194 for (
auto &Atom : AtomForms) {
195 W.startLine() <<
formatv(
"Atom[{0}]: ", i);
196 if (Atom.extractValue(
AccelSection, DataOffset, FormParams)) {
197 Atom.dump(
W.getOStream());
198 if (std::optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
201 W.getOStream() <<
" (" << Str <<
")";
204 W.getOStream() <<
"Error extracting the value";
205 W.getOStream() <<
"\n";
220 W.printNumber(
"DIE offset base", HdrData.DIEOffsetBase);
221 W.printNumber(
"Number of atoms",
uint64_t(HdrData.Atoms.size()));
227 for (
const auto &Atom : HdrData.Atoms) {
229 W.startLine() <<
"Type: " <<
formatAtom(Atom.first) <<
'\n';
230 W.startLine() <<
"Form: " <<
formatv(
"{0}", Atom.second) <<
'\n';
236 uint64_t
Offset =
sizeof(Hdr) + Hdr.HeaderDataLength;
237 uint64_t HashesBase =
Offset + Hdr.BucketCount * 4;
238 uint64_t OffsetsBase = HashesBase + Hdr.HashCount * 4;
240 for (
unsigned Bucket = 0; Bucket < Hdr.BucketCount; ++Bucket) {
244 if (Index == UINT32_MAX) {
245 W.printString(
"EMPTY");
249 for (
unsigned HashIdx = Index; HashIdx < Hdr.HashCount; ++HashIdx) {
250 uint64_t HashOffset = HashesBase + HashIdx*4;
251 uint64_t OffsetsOffset = OffsetsBase + HashIdx*4;
254 if (Hash % Hdr.BucketCount != Bucket)
257 uint64_t DataOffset =
AccelSection.getU32(&OffsetsOffset);
260 W.printString(
"Invalid section offset");
263 while (dumpName(W, AtomForms, &DataOffset))
272 for (
const auto &Atom :
Table.HdrData.Atoms)
277 for (
auto &FormValue :
Values)
281std::optional<DWARFFormValue>
284 if (Atom.first == AtomToFind)
289std::optional<uint64_t>
302 if (std::optional<uint64_t>
Value =
Tag->getAsUnsignedConstant())
311void AppleAcceleratorTable::Iterator::prepareNextEntryOrEnd() {
312 if (NumEntriesToCome == 0)
313 prepareNextStringOrEnd();
316 uint64_t OffsetCopy =
Offset;
317 Current.BaseEntry.extract(&OffsetCopy);
319 Offset += getTable().getHashDataEntryLength();
322void AppleAcceleratorTable::Iterator::prepareNextStringOrEnd() {
327 std::optional<uint64_t> OptOffset =
Table.readIthOffset(OffsetIdx++);
332 std::optional<uint32_t> StrOffset =
Table.readStringOffsetAt(
Offset);
339 if (*StrOffset == 0) {
341 return prepareNextStringOrEnd();
343 Current.StrOffset = *StrOffset;
345 std::optional<uint32_t> MaybeNumEntries =
Table.readU32FromAccel(
Offset);
346 if (!MaybeNumEntries || *MaybeNumEntries == 0)
348 NumEntriesToCome = *MaybeNumEntries;
353 : Current(
Table), Offset(0), NumEntriesToCome(0) {
357 prepareNextEntryOrEnd();
362 const auto EmptyRange =
369 uint32_t BucketIdx = hashToBucketIdx(SearchHash);
370 std::optional<uint32_t> HashIdx = idxOfHashInBucket(SearchHash, BucketIdx);
374 std::optional<uint64_t> MaybeDataOffset = readIthOffset(*HashIdx);
375 if (!MaybeDataOffset)
378 uint64_t DataOffset = *MaybeDataOffset;
382 std::optional<uint32_t> StrOffset = readStringOffsetAt(DataOffset);
384 while (StrOffset && *StrOffset) {
385 std::optional<StringRef> MaybeStr = readStringFromStrSection(*StrOffset);
386 std::optional<uint32_t> NumEntries = this->readU32FromAccel(DataOffset);
387 if (!MaybeStr || !NumEntries)
394 if (
Key == *MaybeStr)
397 DataOffset = EndOffset;
398 StrOffset = readStringOffsetAt(DataOffset);
404std::optional<uint32_t>
405AppleAcceleratorTable::idxOfHashInBucket(
uint32_t HashToFind,
407 std::optional<uint32_t> HashStartIdx = readIthBucket(BucketIdx);
412 std::optional<uint32_t> MaybeHash = readIthHash(HashIdx);
413 if (!MaybeHash || !wouldHashBeInBucket(*MaybeHash, BucketIdx))
415 if (*MaybeHash == HashToFind)
421std::optional<StringRef> AppleAcceleratorTable::readStringFromStrSection(
422 uint64_t StringSectionOffset)
const {
424 StringRef Str =
StringSection.getCStrRef(&StringSectionOffset, &
E);
432std::optional<uint32_t>
434 bool UseRelocation)
const {
436 uint32_t
Data = UseRelocation
450 W.printNumber(
"Version",
Version);
464 "parsing .debug_names header at 0x%" PRIx64
": %s",
482 return HeaderError(
C.takeError());
486 "cannot read header augmentation"));
491 return C.takeError();
499 W.startLine() <<
formatv(
"{0}: {1}\n", Attr.Index, Attr.Form);
515 return Abbr.
Code == 0;
518Expected<DWARFDebugNames::AttributeEncoding>
519DWARFDebugNames::NameIndex::extractAttributeEncoding(
uint64_t *
Offset) {
522 "Incorrectly terminated abbreviation table.");
530Expected<std::vector<DWARFDebugNames::AttributeEncoding>>
531DWARFDebugNames::NameIndex::extractAttributeEncodings(
uint64_t *
Offset) {
532 std::vector<AttributeEncoding>
Result;
534 auto AttrEncOr = extractAttributeEncoding(
Offset);
536 return AttrEncOr.takeError();
538 return std::move(Result);
540 Result.emplace_back(*AttrEncOr);
544Expected<DWARFDebugNames::Abbrev>
548 "Incorrectly terminated abbreviation table.");
556 auto AttrEncOr = extractAttributeEncodings(
Offset);
558 return AttrEncOr.takeError();
559 return Abbrev(Code,
dwarf::Tag(
Tag), AbbrevOffset, std::move(*AttrEncOr));
562DWARFDebugNames::DWARFDebugNamesOffsets
567 Ret.
CUsBase = EndOfHeaderOffset;
582 uint64_t EndOfHeaderOffset = Base;
583 if (
Error E = Hdr.extract(AS, &EndOfHeaderOffset))
590 Offsets.EntryOffsetsBase + (Hdr.NameCount * SectionOffsetSize);
594 "Section too small: cannot read abbreviations.");
596 Offsets.EntriesBase =
Offset + Hdr.AbbrevTableSize;
599 auto AbbrevOr = extractAbbrev(&
Offset);
601 return AbbrevOr.takeError();
605 if (!Abbrevs.insert(std::move(*AbbrevOr)).second)
607 "Duplicate abbreviation code.");
612 : NameIdx(&NameIdx), Abbr(&Abbr) {
617 Values.emplace_back(Attr.Form);
620std::optional<DWARFFormValue>
624 if (std::get<0>(Tuple).Index == Index)
625 return std::get<1>(Tuple);
631 return lookup(dwarf::DW_IDX_parent).has_value();
635 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_die_offset))
636 return Off->getAsReferenceUVal();
642 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_compile_unit))
643 return Off->getAsUnsignedConstant();
646 if (NameIdx->getCUCount() == 1)
655 if (
lookup(dwarf::DW_IDX_type_unit).has_value())
662 if (!Index || *Index >= NameIdx->getCUCount())
664 return NameIdx->getCUOffset(*Index);
669 if (!Index || *Index >= NameIdx->getCUCount())
671 return NameIdx->getCUOffset(*Index);
676 if (!Index || *Index >= NameIdx->getLocalTUCount())
678 return NameIdx->getLocalTUOffset(*Index);
681std::optional<uint64_t>
684 const uint32_t NumLocalTUs = NameIdx->getLocalTUCount();
685 if (!Index || *Index < NumLocalTUs)
688 const uint64_t ForeignTUIndex = *Index - NumLocalTUs;
689 if (ForeignTUIndex >= NameIdx->getForeignTUCount())
691 return NameIdx->getForeignTUSignature(ForeignTUIndex);
695 if (std::optional<DWARFFormValue> Off =
lookup(dwarf::DW_IDX_type_unit))
696 return Off->getAsUnsignedConstant();
703 std::optional<DWARFFormValue> ParentEntryOff =
lookup(dwarf::DW_IDX_parent);
704 assert(ParentEntryOff.has_value() &&
"hasParentInformation() must be called");
706 if (ParentEntryOff->getForm() == dwarf::Form::DW_FORM_flag_present)
708 return NameIdx->getEntryAtRelativeOffset(ParentEntryOff->getRawUValue());
715 W.getOStream() <<
"<invalid offset data>";
720 if (!ParentEntry->has_value()) {
721 W.getOStream() <<
"<parent not indexed>";
725 auto AbsoluteOffset = NameIdx->Offsets.EntriesBase + FormValue.
getRawUValue();
730 W.startLine() <<
formatv(
"Abbrev: {0:x}\n", Abbr->Code);
731 W.startLine() <<
formatv(
"Tag: {0}\n", Abbr->Tag);
734 auto Index = std::get<0>(Tuple).Index;
735 W.startLine() <<
formatv(
"{0}: ", Index);
737 auto FormValue = std::get<1>(Tuple);
738 if (Index == dwarf::Index::DW_IDX_parent)
741 FormValue.dump(W.getOStream());
742 W.getOStream() <<
'\n';
754 uint64_t
Offset = Offsets.CUsBase + SectionOffsetSize *
CU;
755 return Section.AccelSection.getRelocatedValue(SectionOffsetSize, &
Offset);
759 assert(TU < Hdr.LocalTypeUnitCount);
762 Offsets.CUsBase + SectionOffsetSize * (Hdr.CompUnitCount + TU);
763 return Section.AccelSection.getRelocatedValue(SectionOffsetSize, &
Offset);
767 assert(TU < Hdr.ForeignTypeUnitCount);
771 SectionOffsetSize * (Hdr.CompUnitCount + Hdr.LocalTypeUnitCount) + 8 * TU;
772 return Section.AccelSection.getU64(&
Offset);
780 "Incorrectly terminated entry list.");
786 const auto AbbrevIt = Abbrevs.find_as(AbbrevCode);
787 if (AbbrevIt == Abbrevs.end())
790 Entry E(*
this, *AbbrevIt);
793 for (
auto &
Value : E.Values) {
796 "Error extracting index attribute values.");
803 assert(0 < Index && Index <= Hdr.NameCount);
805 uint64_t StringOffsetOffset =
806 Offsets.StringOffsetsBase + SectionOffsetSize * (Index - 1);
807 uint64_t EntryOffsetOffset =
808 Offsets.EntryOffsetsBase + SectionOffsetSize * (Index - 1);
811 uint64_t StringOffset =
812 AS.getRelocatedValue(SectionOffsetSize, &StringOffsetOffset);
813 uint64_t EntryOffset = AS.getUnsigned(&EntryOffsetOffset, SectionOffsetSize);
814 EntryOffset += Offsets.EntriesBase;
815 return {Section.StringSection, Index, StringOffset, EntryOffset};
820 assert(Bucket < Hdr.BucketCount);
821 uint64_t BucketOffset = Offsets.BucketsBase + 4 * Bucket;
822 return Section.AccelSection.getU32(&BucketOffset);
826 assert(0 < Index && Index <= Hdr.NameCount);
827 uint64_t HashOffset = Offsets.HashesBase + 4 * (Index - 1);
828 return Section.AccelSection.getU32(&HashOffset);
837 uint64_t EntryId = *
Offset;
838 auto EntryOr = getEntry(
Offset);
851 const NameTableEntry &NTE,
852 std::optional<uint32_t> Hash)
const {
855 W.printHex(
"Hash", *Hash);
857 W.startLine() <<
formatv(
"String: {0:x8}", NTE.getStringOffset());
858 W.getOStream() <<
" \"" << NTE.getString() <<
"\"\n";
860 uint64_t EntryOffset = NTE.getEntryOffset();
861 while (dumpEntry(W, &EntryOffset))
865void DWARFDebugNames::NameIndex::dumpCUs(ScopedPrinter &W)
const {
866 ListScope CUScope(W,
"Compilation Unit offsets");
867 for (uint32_t CU = 0; CU < Hdr.CompUnitCount; ++CU)
868 W.startLine() <<
formatv(
"CU[{0}]: {1:x8}\n", CU, getCUOffset(CU));
871void DWARFDebugNames::NameIndex::dumpLocalTUs(ScopedPrinter &W)
const {
872 if (Hdr.LocalTypeUnitCount == 0)
875 ListScope TUScope(W,
"Local Type Unit offsets");
876 for (uint32_t TU = 0; TU < Hdr.LocalTypeUnitCount; ++TU)
877 W.startLine() <<
formatv(
"LocalTU[{0}]: {1:x8}\n", TU,
878 getLocalTUOffset(TU));
881void DWARFDebugNames::NameIndex::dumpForeignTUs(ScopedPrinter &W)
const {
882 if (Hdr.ForeignTypeUnitCount == 0)
885 ListScope TUScope(W,
"Foreign Type Unit signatures");
886 for (uint32_t TU = 0; TU < Hdr.ForeignTypeUnitCount; ++TU) {
887 W.startLine() <<
formatv(
"ForeignTU[{0}]: {1:x16}\n", TU,
888 getForeignTUSignature(TU));
892void DWARFDebugNames::NameIndex::dumpAbbreviations(ScopedPrinter &W)
const {
893 ListScope AbbrevsScope(W,
"Abbreviations");
894 std::vector<const Abbrev *> AbbrevsVect;
895 for (
const DWARFDebugNames::Abbrev &Abbr : Abbrevs)
896 AbbrevsVect.push_back(&Abbr);
898 return LHS->AbbrevOffset <
RHS->AbbrevOffset;
900 for (
const DWARFDebugNames::Abbrev *Abbr : AbbrevsVect)
904void DWARFDebugNames::NameIndex::dumpBucket(ScopedPrinter &W,
905 uint32_t Bucket)
const {
906 ListScope BucketScope(W, (
"Bucket " + Twine(Bucket)).str());
907 uint32_t
Index = getBucketArrayEntry(Bucket);
909 W.printString(
"EMPTY");
912 if (Index > Hdr.NameCount) {
913 W.printString(
"Name index is invalid");
918 uint32_t Hash = getHashArrayEntry(Index);
919 if (Hash % Hdr.BucketCount != Bucket)
922 dumpName(W, getNameTableEntry(Index), Hash);
932 dumpAbbreviations(W);
934 if (Hdr.BucketCount > 0) {
935 for (
uint32_t Bucket = 0; Bucket < Hdr.BucketCount; ++Bucket)
936 dumpBucket(W, Bucket);
940 W.startLine() <<
"Hash table not present\n";
942 dumpName(W, NTE, std::nullopt);
952 NameIndices.push_back(std::move(
Next));
968std::optional<uint64_t>
969DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
970 const Header &Hdr = CurrentIndex->Hdr;
971 if (Hdr.BucketCount == 0) {
973 for (
const NameTableEntry &NTE : *CurrentIndex) {
974 if (NTE.sameNameAs(
Key))
975 return NTE.getEntryOffset();
984 uint32_t Bucket = *Hash % Hdr.BucketCount;
985 uint32_t
Index = CurrentIndex->getBucketArrayEntry(Bucket);
990 uint32_t HashAtIndex = CurrentIndex->getHashArrayEntry(Index);
991 if (HashAtIndex % Hdr.BucketCount != Bucket)
994 if (HashAtIndex != Hash)
998 if (NTE.sameNameAs(
Key))
1001 return std::nullopt;
1004bool DWARFDebugNames::ValueIterator::getEntryAtCurrentOffset() {
1005 auto EntryOr = CurrentIndex->getEntry(&DataOffset);
1010 CurrentEntry = std::move(*EntryOr);
1014bool DWARFDebugNames::ValueIterator::findInCurrentIndex() {
1015 std::optional<uint64_t>
Offset = findEntryOffsetInCurrentIndex();
1019 return getEntryAtCurrentOffset();
1022void DWARFDebugNames::ValueIterator::searchFromStartOfCurrentIndex() {
1023 for (
const NameIndex *End = CurrentIndex->Section.NameIndices.end();
1024 CurrentIndex != End; ++CurrentIndex) {
1025 if (findInCurrentIndex())
1031void DWARFDebugNames::ValueIterator::next() {
1032 assert(CurrentIndex &&
"Incrementing an end() iterator?");
1035 if (getEntryAtCurrentOffset())
1039 if (IsLocal || CurrentIndex == &CurrentIndex->Section.NameIndices.back()) {
1046 searchFromStartOfCurrentIndex();
1052 Key(
std::string(Key)) {
1053 searchFromStartOfCurrentIndex();
1058 : CurrentIndex(&NI), IsLocal(
true), Key(
std::string(Key)) {
1059 if (!findInCurrentIndex())
1065 if (NameIndices.empty())
1072 if (UnitOffsetToNameIndex.size() == 0 && NameIndices.size() > 0) {
1073 for (
const auto &NI : *
this) {
1075 UnitOffsetToNameIndex.try_emplace(NI.getCUOffset(
CU), &NI);
1076 for (
uint32_t TU = 0; TU < NI.getLocalTUCount(); ++TU)
1077 UnitOffsetToNameIndex.try_emplace(NI.getLocalTUOffset(TU), &NI);
1080 return UnitOffsetToNameIndex.lookup(UnitOffset);
1084 return Name.size() > 2 && (Name[0] ==
'-' || Name[0] ==
'+') &&
1090 return std::nullopt;
1092 StringRef ClassNameStart(Name.drop_front(2));
1093 size_t FirstSpace = ClassNameStart.
find(
' ');
1095 return std::nullopt;
1098 if (!SelectorStart.
size())
1099 return std::nullopt;
1127 if (!Name.ends_with(
">") || Name.count(
"<") == 0 || Name.ends_with(
"<=>"))
1131 size_t NumLeftAnglesToSkip = 1;
1134 NumLeftAnglesToSkip += Name.count(
"<=>");
1136 size_t RightAngleCount = Name.count(
'>');
1137 size_t LeftAngleCount = Name.count(
'<');
1141 if (LeftAngleCount > RightAngleCount)
1142 NumLeftAnglesToSkip += LeftAngleCount - RightAngleCount;
1144 size_t StartOfTemplate = 0;
1145 while (NumLeftAnglesToSkip--)
1146 StartOfTemplate = Name.find(
'<', StartOfTemplate) + 1;
1148 StringRef Result = Name.substr(0, StartOfTemplate - 1);
1150 return std::nullopt;
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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, GsymDataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
#define offsetof(TYPE, MEMBER)
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 ...
LLVM_ABI Iterator(const AppleAcceleratorTable &Table, bool SetEnd=false)
An iterator for Entries all having the same string as key.
LLVM_ABI 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.
AppleAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
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
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 > getForeignTUTypeSignature() const override
Returns the type signature of the Type Unit associated with this Accelerator Entry or std::nullopt if...
std::optional< uint64_t > getRelatedCUIndex() const
Similar functionality to getCUIndex() but without the DW_IDX_type_unit restriction.
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 > getRelatedCUOffset() const
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< uint64_t > getTUIndex() const
Returns the index of the Type Unit of the owning Name Index or std::nullopt if this Accelerator Entry...
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.
LLVM_ABI uint32_t getHashArrayEntry(uint32_t Index) const
Reads an entry in the Hash Array for the given Index.
LLVM_ABI uint64_t getLocalTUOffset(uint32_t TU) const
Reads offset of local type unit TU, TU is 0-based.
LLVM_ABI uint32_t getBucketArrayEntry(uint32_t Bucket) const
Reads an entry in the Bucket Array for the given Bucket.
LLVM_ABI void dump(ScopedPrinter &W) const
LLVM_ABI iterator_range< ValueIterator > equal_range(StringRef Key) const
Look up all entries in this Name Index matching Key.
LLVM_ABI uint64_t getCUOffset(uint32_t CU) const
Reads offset of compilation unit CU. CU is 0-based.
LLVM_ABI Expected< Entry > getEntry(uint64_t *Offset) const
LLVM_ABI NameTableEntry getNameTableEntry(uint32_t Index) const
Reads an entry in the Name Table for the given Index.
LLVM_ABI uint64_t getForeignTUSignature(uint32_t TU) const
Reads signature of foreign type unit TU. TU is 0-based.
A single entry in the Name Table (DWARF v5 sect.
uint64_t getEntryOffset() const
Returns the offset of the first Entry in the list.
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.
const_iterator begin() const
DWARFDebugNames(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
iterator_range< ValueIterator > equal_range(StringRef Key) const
Look up all entries in the accelerator table matching Key.
const NameIndex * getCUOrTUNameIndex(uint64_t UnitOffset)
Return the Name Index covering the compile unit or local type unit at UnitOffset, or nullptr if there...
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.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
static constexpr size_t npos
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
char back() const
Get the last character in the string.
constexpr size_t size() const
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.
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(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.
LLVM_ABI StringRef FormEncodingString(unsigned Encoding)
LLVM_ABI StringRef AtomTypeString(unsigned Atom)
LLVM_ABI StringRef FormatString(DwarfFormat Format)
LLVM_ABI StringRef AtomValueString(uint16_t Atom, unsigned Val)
Returns the symbolic string representing Val when used as a value for atom Atom.
LLVM_ABI DWARFDebugNames::DWARFDebugNamesOffsets findDebugNamesOffsets(uint64_t EndOfHeaderOffset, const DWARFDebugNames::Header &Hdr)
const uint32_t DW_INVALID_OFFSET
Identifier of an invalid DIE offset in the .debug_info section.
LLVM_ABI 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.
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.
RelativeUniformCounterPtr Values
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
LLVM_ABI 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.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
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)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
LLVM_ABI std::optional< StringRef > StripTemplateParameters(StringRef Name)
If Name is the name of a templated function that includes template parameters, returns a substring of...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
LLVM_ABI 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...
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::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
LLVM_ABI 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...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
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.
LLVM_ABI 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.
uint64_t EntryOffsetsBase
uint64_t StringOffsetsBase
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".