46 addUnitsImpl(
C,
D, Section,
C.getDebugAbbrev(), &
D.getRangesSection(),
47 &
D.getLocSection(),
D.getStrSection(),
48 D.getStrOffsetsSection(), &
D.getAddrSection(),
49 D.getLineSection(),
D.isLittleEndian(),
false,
false,
58 addUnitsImpl(
C,
D, DWOSection,
C.getDebugAbbrevDWO(), &
D.getRangesDWOSection(),
59 &
D.getLocDWOSection(),
D.getStrDWOSection(),
60 D.getStrOffsetsDWOSection(), &
D.getAddrSection(),
61 D.getLineDWOSection(),
C.isLittleEndian(),
true, Lazy,
65void DWARFUnitVector::addUnitsImpl(
74 Parser = [=, &
Context, &Obj, &Section, &SOS,
78 -> std::unique_ptr<DWARFUnit> {
79 const DWARFSection &InfoSection = CurSection ? *CurSection : Section;
86 if (!IndexEntry && IsDWO) {
90 if (Header.isTypeUnit())
91 IndexEntry =
Index.getFromHash(Header.getTypeHash());
92 else if (
auto DWOId = Header.getDWOId())
93 IndexEntry =
Index.getFromHash(*DWOId);
96 IndexEntry =
Index.getFromOffset(Header.getOffset());
98 if (IndexEntry && !Header.applyIndexEntry(IndexEntry))
100 std::unique_ptr<DWARFUnit>
U;
101 if (Header.isTypeUnit())
102 U = std::make_unique<DWARFTypeUnit>(Context, InfoSection, Header, DA,
103 RS, LocSection, SS, SOS, AOS, LS,
106 U = std::make_unique<DWARFCompileUnit>(Context, InfoSection, Header,
107 DA, RS, LocSection, SS, SOS,
108 AOS, LS, LE, IsDWO, *
this);
122 if (
I != this->
end() &&
123 (&(*I)->getInfoSection() != &Section || (*I)->getOffset() ==
Offset)) {
131 Offset =
U->getNextUnitOffset();
132 I = std::next(this->
insert(
I, std::move(U)));
138 [](
const std::unique_ptr<DWARFUnit> &
LHS,
139 const std::unique_ptr<DWARFUnit> &
RHS) {
140 return LHS->getOffset() <
RHS->getOffset();
142 return this->
insert(
I, std::move(Unit))->get();
150 return LHS <
RHS->getNextUnitOffset();
159 const auto *CUOff =
E.getContribution(DW_SECT_INFO);
167 std::upper_bound(
begin(),
end, CUOff->getOffset(),
169 return LHS < RHS->getNextUnitOffset();
177 auto U = Parser(
Offset, DW_SECT_INFO,
nullptr, &
E);
181 auto *NewCU = U.get();
193 :
Context(DC), InfoSection(Section), Header(Header), Abbrev(DA),
194 RangeSection(RS), LineSection(LS), StringSection(SS),
195 StringOffsetSection(SOS), AddrOffsetSection(AOS), IsLittleEndian(LE),
196 IsDWO(IsDWO), UnitVector(UnitVector) {
207std::optional<object::SectionedAddress>
209 if (!AddrOffsetSectionBase) {
210 auto R =
Context.info_section_units();
216 return (*R.begin())->getAddrOffsetSectionItem(
Index);
232 if (!StringOffsetsTableContribution)
233 return make_error<StringError>(
234 "DW_FORM_strx used without a valid string offsets table",
239 return make_error<StringError>(
"DW_FORM_strx uses index " +
Twine(
Index) +
240 ", which is too large",
244 return DA.getRelocatedValue(ItemSize, &
Offset);
251 Offset = *offset_ptr;
253 IndexEntry =
nullptr;
274 TypeHash = debug_info.
getU64(offset_ptr, &Err);
278 DWOId = debug_info.
getU64(offset_ptr, &Err);
284 "DWARF unit at 0x%8.8" PRIx64
" cannot be parsed:", Offset),
290 assert(*offset_ptr - Offset <= 255 &&
"unexpected header size");
291 Size = uint8_t(*offset_ptr - Offset);
297 "DWARF unit from offset 0x%8.8" PRIx64
" incl. "
298 "to offset 0x%8.8" PRIx64
" excl. "
299 "extends past section size 0x%8.8zx",
300 Offset, NextCUOffset, debug_info.
size()));
307 "DWARF unit at offset 0x%8.8" PRIx64
" "
308 "has unsupported version %" PRIu16
", supported are 2-%u",
318 "DWARF type unit at offset "
320 "has its relocated type_offset 0x%8.8" PRIx64
" "
321 "pointing inside the header",
322 Offset, Offset + TypeOffset));
329 "DWARF type unit from offset 0x%8.8" PRIx64
" incl. "
330 "to offset 0x%8.8" PRIx64
" excl. has its "
331 "relocated type_offset 0x%8.8" PRIx64
" pointing past the unit end",
332 Offset, NextCUOffset, Offset + TypeOffset));
338 "DWARF unit at offset 0x%8.8" PRIx64, Offset)) {
339 Context.getWarningHandler()(std::move(SizeErr));
361 AbbrOffset = AbbrEntry->getOffset();
368 assert(!DieArray.empty());
371 uint64_t ActualRangeListOffset = RangeSectionBase + RangeListOffset;
372 return RangeList.
extract(RangesData, &ActualRangeListOffset);
378 RangeSectionBase = 0;
380 AddrOffsetSectionBase = std::nullopt;
393void DWARFUnit::extractDIEsToVector(
394 bool AppendCUDie,
bool AppendNonCUDies,
395 std::vector<DWARFDebugInfoEntry> &Dies)
const {
396 if (!AppendCUDie && !AppendNonCUDies)
407 std::vector<uint32_t> Parents;
408 std::vector<uint32_t> PrevSiblings;
412 ((AppendCUDie && Dies.empty()) || (!AppendCUDie && Dies.size() == 1)) &&
413 "Dies array is not empty");
416 Parents.push_back(UINT32_MAX);
418 Parents.push_back(0);
419 PrevSiblings.push_back(0);
423 assert(Parents.size() > 0 &&
"Empty parents stack");
424 assert((Parents.back() == UINT32_MAX || Parents.back() <= Dies.size()) &&
425 "Wrong parent index");
428 if (!
DIE.extractFast(*
this, &DIEOffset, DebugInfoData, NextCUOffset,
433 if (PrevSiblings.back() > 0) {
434 assert(PrevSiblings.back() < Dies.size() &&
435 "Previous sibling index is out of Dies boundaries");
436 Dies[PrevSiblings.back()].setSiblingIdx(Dies.size());
443 if (!AppendNonCUDies)
448 Dies.reserve(Dies.size() + getDebugInfoSize() / 14);
451 PrevSiblings.back() = Dies.size();
458 DIE.getAbbreviationDeclarationPtr()) {
459 if (AbbrDecl->hasChildren()) {
460 if (AppendCUDie || !IsCUDie) {
461 assert(Dies.size() > 0 &&
"Dies does not contain any die");
462 Parents.push_back(Dies.size() - 1);
463 PrevSiblings.push_back(0);
471 PrevSiblings.pop_back();
481void DWARFUnit::extractDIEsIfNeeded(
bool CUDieOnly) {
483 Context.getRecoverableErrorHandler()(std::move(e));
487 if ((CUDieOnly && !DieArray.empty()) ||
491 bool HasCUDie = !DieArray.empty();
492 extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
494 if (DieArray.empty())
501 DWARFDie UnitDie(
this, &DieArray[0]);
502 if (std::optional<uint64_t> DWOId =
504 Header.setDWOId(*DWOId);
506 assert(AddrOffsetSectionBase == std::nullopt);
507 assert(RangeSectionBase == 0);
508 assert(LocSectionBase == 0);
510 if (!AddrOffsetSectionBase)
511 AddrOffsetSectionBase =
527 auto StringOffsetOrError =
530 if (!StringOffsetOrError)
532 "invalid reference to or invalid content in "
533 ".debug_str_offsets[.dwo]: " +
534 toString(StringOffsetOrError.takeError()));
536 StringOffsetsTableContribution = *StringOffsetOrError;
544 uint64_t ContributionBaseOffset = 0;
545 if (
auto *IndexEntry = Header.getIndexEntry())
546 if (
auto *Contrib = IndexEntry->getContribution(DW_SECT_RNGLISTS))
547 ContributionBaseOffset = Contrib->getOffset();
549 &
Context.getDWARFObj().getRnglistsDWOSection(),
550 ContributionBaseOffset +
556 Header.getFormat())));
563 ?
Context.getDWARFObj().getLoclistsDWOSection().Data
564 :
Context.getDWARFObj().getLocDWOSection().Data;
565 if (
auto *IndexEntry = Header.getIndexEntry())
566 if (
const auto *
C = IndexEntry->getContribution(
568 Data =
Data.substr(
C->getOffset(),
C->getLength());
572 std::make_unique<DWARFDebugLoclists>(DWARFData, Header.getVersion());
575 LocTable = std::make_unique<DWARFDebugLoclists>(
577 Context.getDWARFObj().getLoclistsSection(),
591bool DWARFUnit::parseDWO(
StringRef DWOAlternativeLocation) {
614 auto DWOContext =
Context.getDWOContext(AbsolutePath);
617 if (DWOAlternativeLocation.
empty())
622 DWOContext =
Context.getDWOContext(DWOAlternativeLocation);
630 DWO = std::shared_ptr<DWARFCompileUnit>(std::move(DWOContext), DWOCU);
631 DWO->setSkeletonUnit(
this);
633 if (AddrOffsetSectionBase)
634 DWO->setAddrOffsetSection(AddrOffsetSection, *AddrOffsetSectionBase);
637 DWO->setRangesSection(RangeSection, DWORangesBase.value_or(0));
643void DWARFUnit::clearDIEs(
bool KeepCUDie) {
649 DieArray = (KeepCUDie && !DieArray.empty())
650 ? std::vector<DWARFDebugInfoEntry>({DieArray[0]})
651 : std::vector<DWARFDebugInfoEntry>();
663 IsLittleEndian, Header.getAddressByteSize());
665 auto RangeListOrError = RnglistTable.
findList(RangesData,
Offset);
666 if (RangeListOrError)
667 return RangeListOrError.get().getAbsoluteRanges(
getBaseAddress(), *
this);
668 return RangeListOrError.takeError();
677 "invalid range list table index %d (possibly "
678 "missing the entire range list table)",
689 if (!CUDIERangesOrError)
691 "decoding address ranges: %s",
692 toString(CUDIERangesOrError.takeError()).c_str());
693 return *CUDIERangesOrError;
707 Result.push_back(std::move(*L));
709 InterpretationError =
710 joinErrors(L.takeError(), std::move(InterpretationError));
711 return !InterpretationError;
714 if (ParseError || InterpretationError)
715 return joinErrors(std::move(ParseError), std::move(InterpretationError));
723 if (DIERangesOrError) {
724 for (
const auto &R : DIERangesOrError.get()) {
726 if (R.LowPC == R.HighPC)
728 auto B = AddrDieMap.upper_bound(R.LowPC);
729 if (
B != AddrDieMap.begin() && R.LowPC < (--
B)->second.first) {
732 if (R.HighPC <
B->second.first)
733 AddrDieMap[R.HighPC] =
B->second;
734 if (R.LowPC >
B->first)
735 AddrDieMap[
B->first].first = R.LowPC;
737 AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
752 extractDIEsIfNeeded(
false);
753 if (AddrDieMap.empty())
755 auto R = AddrDieMap.upper_bound(
Address);
756 if (R == AddrDieMap.begin())
760 if (
Address >= R->second.first)
762 return R->second.second;
767 if (
isType(Child.getTag()))
772 if (Die.
getTag() != DW_TAG_variable)
789 auto It = Expr.
begin();
790 if (It == Expr.
end())
800 if (It->getCode() == dwarf::DW_OP_addr) {
801 LocationAddr = It->getRawOperand(0);
802 }
else if (It->getCode() == dwarf::DW_OP_addrx) {
803 uint64_t DebugAddrOffset = It->getRawOperand(0);
805 LocationAddr = Pointer->Address;
812 if (++It != Expr.
end()) {
813 if (It->getCode() != dwarf::DW_OP_plus_uconst)
816 LocationAddr += It->getRawOperand(0);
819 if (++It != Expr.
end())
840 extractDIEsIfNeeded(
false);
844 auto RootLookup = RootsParsedForVariables.
insert(RootDie.getOffset());
845 if (RootLookup.second)
848 auto R = VariableDieMap.upper_bound(
Address);
849 if (R == VariableDieMap.begin())
854 if (
Address >= R->second.first)
856 return R->second.second;
870 while (SubroutineDIE) {
875 if (SubroutineDIE.
getTag() == DW_TAG_inlined_subroutine)
877 SubroutineDIE = SubroutineDIE.
getParent();
883 if (Kind == DW_SECT_INFO)
900 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
902 if (std::optional<uint32_t> ParentIdx = Die->
getParentIdx()) {
903 assert(*ParentIdx < DieArray.size() &&
904 "ParentIdx is out of DieArray boundaries");
922 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
924 if (std::optional<uint32_t> SiblingIdx = Die->
getSiblingIdx()) {
925 assert(*SiblingIdx < DieArray.size() &&
926 "SiblingIdx is out of DieArray boundaries");
927 return &DieArray[*SiblingIdx];
944 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
946 std::optional<uint32_t> ParentIdx = Die->
getParentIdx();
951 assert(*ParentIdx < DieArray.size() &&
952 "ParentIdx is out of DieArray boundaries");
956 if (PrevDieIdx == *ParentIdx)
960 while (DieArray[PrevDieIdx].getParentIdx() != *ParentIdx) {
961 PrevDieIdx = *DieArray[PrevDieIdx].getParentIdx();
963 assert(PrevDieIdx < DieArray.size() &&
964 "PrevDieIdx is out of DieArray boundaries");
965 assert(PrevDieIdx >= *ParentIdx &&
966 "PrevDieIdx is not a child of parent of Die");
969 return &DieArray[PrevDieIdx];
983 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
992 if (
I >= DieArray.size())
1008 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
1013 if (std::optional<uint32_t> SiblingIdx = Die->
getSiblingIdx()) {
1014 assert(*SiblingIdx < DieArray.size() &&
1015 "SiblingIdx is out of DieArray boundaries");
1016 assert(DieArray[*SiblingIdx - 1].
getTag() == dwarf::DW_TAG_null &&
1017 "Bad end of children marker");
1018 return &DieArray[*SiblingIdx - 1];
1030 if (
getDIEIndex(Die) == 0 && DieArray.size() > 1 &&
1031 DieArray.back().getTag() == dwarf::DW_TAG_null) {
1036 return &DieArray.back();
1046 if (!AbbrevsOrError) {
1051 Abbrevs = *AbbrevsOrError;
1061 std::optional<DWARFFormValue> PC =
1062 UnitDie.
find({DW_AT_low_pc, DW_AT_entry_pc});
1075 if (ValidationSize >=
Size)
1076 if (DA.isValidOffsetForDataOfSize((
uint32_t)
Base, ValidationSize))
1085 if (!DA.isValidOffsetForDataOfSize(
Offset, 16))
1092 uint8_t Version = DA.getU16(&
Offset);
1093 (void)DA.getU16(&
Offset);
1103 if (!DA.isValidOffsetForDataOfSize(
Offset, 8))
1110 uint8_t Version = DA.getU16(&
Offset);
1111 (void)DA.getU16(&
Offset);
1129 return DescOrError.takeError();
1130 Desc = *DescOrError;
1138 return DescOrError.takeError();
1139 Desc = *DescOrError;
1143 return Desc.validateContributionSize(DA);
1151 return std::nullopt;
1155 return DescOrError.takeError();
1156 return *DescOrError;
1163 auto IndexEntry = Header.getIndexEntry();
1165 IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) :
nullptr;
1169 if (DA.getData().data() ==
nullptr)
1170 return std::nullopt;
1175 return DescOrError.takeError();
1176 return *DescOrError;
1184 Header.getFormat());
1185 else if (!IndexEntry && !StringOffsetSection.
Data.
empty())
1187 4, Header.getFormat());
1189 return std::nullopt;
1190 auto DescOrError =
Desc.validateContributionSize(DA);
1192 return DescOrError.takeError();
1193 return *DescOrError;
1203 return *Off + RangeSectionBase;
1204 return std::nullopt;
1210 return *Off + LocSectionBase;
1211 return std::nullopt;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Expected< StrOffsetsContributionDescriptor > parseDWARF64StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset)
static Expected< StrOffsetsContributionDescriptor > parseDWARF32StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset)
static Expected< StrOffsetsContributionDescriptor > parseDWARFStringOffsetsTableHeader(DWARFDataExtractor &DA, llvm::dwarf::DwarfFormat Format, uint64_t Offset)
This file contains constants used for implementing Dwarf debug support.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
A structured debug information entry.
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
static bool isSupportedVersion(unsigned version)
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)
static unsigned getMaxSupportedVersion()
Expected< const DWARFAbbreviationDeclarationSet * > getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
DWARFDebugInfoEntry - A DIE with only the minimum required data.
std::optional< uint32_t > getSiblingIdx() const
Returns index of the sibling die.
std::optional< uint32_t > getParentIdx() const
Returns index of the parent die.
Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr)
DWARFAddressRangesVector getAbsoluteRanges(std::optional< object::SectionedAddress > BaseAddr) const
getAbsoluteRanges - Returns absolute address ranges defined by this range list.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Expected< DWARFAddressRangesVector > getAddressRanges() const
Get the address ranges for this DIE.
DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE as the referenced DIE.
DWARFDie getParent() const
Get the parent of this DIE object.
std::optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
DWARFDie getSibling() const
Get the sibling of this DIE object.
bool isSubroutineDIE() const
Returns true if DIE represents a subprogram or an inlined subroutine.
bool isSubprogramDIE() const
Returns true if DIE represents a subprogram (not inlined).
std::optional< uint64_t > getTypeSize(uint64_t PointerSize)
Gets the type size (in bytes) for this DIE.
DWARFDie getFirstChild() const
Get the first child of this DIE object.
dwarf::Tag getTag() const
Expected< DWARFLocationExpressionsVector > getLocations(dwarf::Attribute Attr) const
std::optional< uint64_t > getRangesBaseAttribute() const
Extract the range base attribute from this DIE as absolute section offset.
Expected< DWARFListType > findList(DWARFDataExtractor Data, uint64_t Offset) const
Look up a list based on a given offset.
Error visitAbsoluteLocationList(uint64_t Offset, std::optional< object::SectionedAddress > BaseAddr, std::function< std::optional< object::SectionedAddress >(uint32_t)> LookupAddr, function_ref< bool(Expected< DWARFLocationExpression >)> Callback) const
const SectionContribution * getContribution(DWARFSectionKind Sec) const
Describe a collection of units.
DWARFUnit * addUnit(std::unique_ptr< DWARFUnit > Unit)
Add an existing DWARFUnit to this UnitVector.
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
void addUnitsForSection(DWARFContext &C, const DWARFSection &Section, DWARFSectionKind SectionKind)
Read units from a .debug_info or .debug_types section.
DWARFUnit * getUnitForOffset(uint64_t Offset) const
void addUnitsForDWOSection(DWARFContext &C, const DWARFSection &DWOSection, DWARFSectionKind SectionKind, bool Lazy=false)
Read units from a .debug_info.dwo or .debug_types.dwo section.
DWARFUnit * getUnitForIndexEntry(const DWARFUnitIndex::Entry &E)
const DWARFDebugInfoEntry * getDebugInfoEntry(unsigned Index) const
Return DWARFDebugInfoEntry for the specified index Index.
const DWARFDebugInfoEntry * getSiblingEntry(const DWARFDebugInfoEntry *Die) const
std::optional< uint64_t > getDWOId()
uint32_t getHeaderSize() const
Size in bytes of the parsed unit header.
DWARFDie getPreviousSibling(const DWARFDebugInfoEntry *Die)
Expected< std::optional< StrOffsetsContributionDescriptor > > determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA)
Find the unit's contribution to the string offsets table and determine its length and form.
const DWARFLocationTable & getLocationTable()
const DWARFDebugInfoEntry * getParentEntry(const DWARFDebugInfoEntry *Die) const
DWARFDie getFirstChild(const DWARFDebugInfoEntry *Die)
DWARFDataExtractor getDebugInfoExtractor() const
DWARFDie getSibling(const DWARFDebugInfoEntry *Die)
std::optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Error tryExtractDIEsIfNeeded(bool CUDieOnly)
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
uint8_t getAddressByteSize() const
DWARFDie getVariableForAddress(uint64_t Address)
Returns variable DIE for the address provided.
void setRangesSection(const DWARFSection *RS, uint64_t Base)
uint8_t getDwarfStringOffsetsByteSize() const
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
DWARFDie getParent(const DWARFDebugInfoEntry *Die)
std::optional< uint64_t > getLoclistOffset(uint32_t Index)
const char * getCompilationDir()
uint64_t getStringOffsetsBase() const
dwarf::DwarfFormat getFormat() const
DWARFUnit(DWARFContext &Context, const DWARFSection &Section, const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA, const DWARFSection *RS, const DWARFSection *LocSection, StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO, const DWARFUnitVector &UnitVector)
Expected< std::optional< StrOffsetsContributionDescriptor > > determineStringOffsetsTableContribution(DWARFDataExtractor &DA)
Find the unit's contribution to the string offsets table and determine its length and form.
uint64_t getAbbreviationsOffset() const
uint16_t getVersion() const
void getInlinedChainForAddress(uint64_t Address, SmallVectorImpl< DWARFDie > &InlinedChain)
getInlinedChainForAddress - fetches inlined chain for a given address.
Error extractRangeList(uint64_t RangeListOffset, DWARFDebugRangeList &RangeList) const
Extract the range list referenced by this compile unit from the .debug_ranges section.
Expected< uint64_t > getStringOffsetSectionItem(uint32_t Index) const
uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) const
Return the index of a Die entry inside the unit's DIE vector.
Expected< DWARFLocationExpressionsVector > findLoclistFromOffset(uint64_t Offset)
Expected< DWARFAddressRangesVector > findRnglistFromOffset(uint64_t Offset)
Return a vector of address ranges resulting from a (possibly encoded) range list starting at a given ...
const DWARFDebugInfoEntry * getPreviousSiblingEntry(const DWARFDebugInfoEntry *Die) const
const DWARFDebugInfoEntry * getLastChildEntry(const DWARFDebugInfoEntry *Die) const
void updateVariableDieMap(DWARFDie Die)
Recursively update address to variable Die map.
DWARFDie getSubroutineForAddress(uint64_t Address)
Returns subprogram DIE with address range encompassing the provided address.
const DWARFDebugInfoEntry * getFirstChildEntry(const DWARFDebugInfoEntry *Die) const
Expected< DWARFAddressRangesVector > findRnglistFromIndex(uint32_t Index)
Return a vector of address ranges retrieved from an encoded range list whose offset is found via a ta...
uint64_t getNextUnitOffset() const
std::optional< object::SectionedAddress > getBaseAddress()
Expected< DWARFAddressRangesVector > collectAddressRanges()
std::optional< object::SectionedAddress > getAddrOffsetSectionItem(uint32_t Index) const
uint64_t getOffset() const
DWARFDie getLastChild(const DWARFDebugInfoEntry *Die)
void updateAddressDieMap(DWARFDie Die)
Recursively update address to Die map.
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.
SectionKind - This is a simple POD value that classifies the properties of a section.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::pair< iterator, bool > insert(const ValueT &V)
unsigned getTag(StringRef TagString)
@ C
The default llvm calling convention, compatible with C.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
std::optional< object::SectionedAddress > toSectionedAddress(const std::optional< DWARFFormValue > &V)
UnitType
Constants for unit types in DWARF v5.
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
std::optional< uint64_t > toSectionOffset(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an section offset.
std::optional< uint64_t > toUnsigned(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
@ DW_LENGTH_lo_reserved
Special values for an initial length field.
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
bool is_relative(const Twine &path, Style style=Style::native)
Is path relative?
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
std::vector< DWARFLocationExpression > DWARFLocationExpressionsVector
Represents a set of absolute location expressions.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
bool hasSingleElement(ContainerTy &&C)
Returns true if the given container only contains a single element.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
void consumeError(Error Err)
Consume a Error without doing anything.
Description of the encoding of one expression Op.
Represents a single DWARF expression, whose value is location-dependent.
Represents base address of the CU.
Expected< StrOffsetsContributionDescriptor > validateContributionSize(DWARFDataExtractor &DA)
Determine whether a contribution to the string offsets table is consistent with the relevant section ...
uint64_t Size
The contribution size not including the header.
uint8_t getDwarfOffsetByteSize() const