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;
84 if (
Error ExtractErr =
89 if (!IndexEntry && IsDWO) {
93 if (Header.isTypeUnit())
94 IndexEntry =
Index.getFromHash(Header.getTypeHash());
95 else if (
auto DWOId = Header.getDWOId())
96 IndexEntry =
Index.getFromHash(*DWOId);
99 IndexEntry =
Index.getFromOffset(Header.getOffset());
102 if (
Error ApplicationErr = Header.applyIndexEntry(IndexEntry)) {
107 std::unique_ptr<DWARFUnit>
U;
108 if (Header.isTypeUnit())
109 U = std::make_unique<DWARFTypeUnit>(Context, InfoSection, Header, DA,
110 RS, LocSection, SS, SOS, AOS, LS,
113 U = std::make_unique<DWARFCompileUnit>(Context, InfoSection, Header,
114 DA, RS, LocSection, SS, SOS,
115 AOS, LS, LE, IsDWO, *
this);
129 if (
I != this->
end() &&
130 (&(*I)->getInfoSection() != &Section || (*I)->getOffset() ==
Offset)) {
138 Offset =
U->getNextUnitOffset();
139 I = std::next(this->
insert(
I, std::move(U)));
145 [](
const std::unique_ptr<DWARFUnit> &
LHS,
146 const std::unique_ptr<DWARFUnit> &
RHS) {
149 return this->
insert(
I, std::move(Unit))->get();
157 return LHS <
RHS->getNextUnitOffset();
174 std::upper_bound(
begin(),
end, CUOff->getOffset(),
176 return LHS < RHS->getNextUnitOffset();
184 auto U = Parser(
Offset, DW_SECT_INFO,
nullptr, &E);
188 auto *NewCU = U.get();
200 : Context(DC), InfoSection(Section), Header(Header), Abbrev(DA),
201 RangeSection(RS), LineSection(LS), StringSection(SS),
202 StringOffsetSection(SOS), AddrOffsetSection(AOS), IsLittleEndian(LE),
203 IsDWO(IsDWO), UnitVector(UnitVector) {
214std::optional<object::SectionedAddress>
216 if (!AddrOffsetSectionBase) {
223 return (*R.begin())->getAddrOffsetSectionItem(
Index);
239 if (!StringOffsetsTableContribution)
240 return make_error<StringError>(
241 "DW_FORM_strx used without a valid string offsets table",
246 return make_error<StringError>(
"DW_FORM_strx uses index " +
Twine(
Index) +
247 ", which is too large",
251 return DA.getRelocatedValue(ItemSize, &
Offset);
258 Offset = *offset_ptr;
260 IndexEntry =
nullptr;
281 TypeHash = debug_info.
getU64(offset_ptr, &Err);
285 DWOId = debug_info.
getU64(offset_ptr, &Err);
291 "DWARF unit at 0x%8.8" PRIx64
" cannot be parsed:", Offset),
295 assert(*offset_ptr - Offset <= 255 &&
"unexpected header size");
296 Size = uint8_t(*offset_ptr - Offset);
301 "DWARF unit from offset 0x%8.8" PRIx64
" incl. "
302 "to offset 0x%8.8" PRIx64
" excl. "
303 "extends past section size 0x%8.8zx",
304 Offset, NextCUOffset, debug_info.
size());
309 "DWARF unit at offset 0x%8.8" PRIx64
" "
310 "has unsupported version %" PRIu16
", supported are 2-%u",
317 "DWARF type unit at offset "
319 "has its relocated type_offset 0x%8.8" PRIx64
" "
320 "pointing inside the header",
321 Offset, Offset + TypeOffset);
326 "DWARF type unit from offset 0x%8.8" PRIx64
" incl. "
327 "to offset 0x%8.8" PRIx64
" excl. has its "
328 "relocated type_offset 0x%8.8" PRIx64
" pointing past the unit end",
329 Offset, NextCUOffset, Offset + TypeOffset);
333 "DWARF unit at offset 0x%8.8" PRIx64, Offset))
347 "DWARF package unit at offset 0x%8.8" PRIx64
348 " has a non-zero abbreviation offset",
354 "DWARF package unit at offset 0x%8.8" PRIx64
355 " has no contribution index",
359 if (UnitContrib->getLength() != IndexLength)
361 "DWARF package unit at offset 0x%8.8" PRIx64
362 " has an inconsistent index (expected: %" PRIu64
363 ", actual: %" PRIu64
")",
364 Offset, UnitContrib->getLength(), IndexLength);
369 "DWARF package unit at offset 0x%8.8" PRIx64
370 " missing abbreviation column",
373 AbbrOffset = AbbrEntry->getOffset();
380 assert(!DieArray.empty());
383 uint64_t ActualRangeListOffset = RangeSectionBase + RangeListOffset;
384 return RangeList.
extract(RangesData, &ActualRangeListOffset);
390 RangeSectionBase = 0;
392 AddrOffsetSectionBase = std::nullopt;
405void DWARFUnit::extractDIEsToVector(
406 bool AppendCUDie,
bool AppendNonCUDies,
407 std::vector<DWARFDebugInfoEntry> &Dies)
const {
408 if (!AppendCUDie && !AppendNonCUDies)
419 std::vector<uint32_t> Parents;
420 std::vector<uint32_t> PrevSiblings;
424 ((AppendCUDie && Dies.empty()) || (!AppendCUDie && Dies.size() == 1)) &&
425 "Dies array is not empty");
428 Parents.push_back(UINT32_MAX);
430 Parents.push_back(0);
431 PrevSiblings.push_back(0);
435 assert(Parents.size() > 0 &&
"Empty parents stack");
436 assert((Parents.back() == UINT32_MAX || Parents.back() <= Dies.size()) &&
437 "Wrong parent index");
440 if (!
DIE.extractFast(*
this, &DIEOffset, DebugInfoData, NextCUOffset,
445 if (PrevSiblings.back() > 0) {
446 assert(PrevSiblings.back() < Dies.size() &&
447 "Previous sibling index is out of Dies boundaries");
448 Dies[PrevSiblings.back()].setSiblingIdx(Dies.size());
455 if (!AppendNonCUDies)
460 Dies.reserve(Dies.size() + getDebugInfoSize() / 14);
463 PrevSiblings.back() = Dies.size();
470 DIE.getAbbreviationDeclarationPtr()) {
471 if (AbbrDecl->hasChildren()) {
472 if (AppendCUDie || !IsCUDie) {
473 assert(Dies.size() > 0 &&
"Dies does not contain any die");
474 Parents.push_back(Dies.size() - 1);
475 PrevSiblings.push_back(0);
483 PrevSiblings.pop_back();
493void DWARFUnit::extractDIEsIfNeeded(
bool CUDieOnly) {
499 if ((CUDieOnly && !DieArray.empty()) ||
503 bool HasCUDie = !DieArray.empty();
504 extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
506 if (DieArray.empty())
513 DWARFDie UnitDie(
this, &DieArray[0]);
514 if (std::optional<uint64_t> DWOId =
516 Header.setDWOId(*DWOId);
518 assert(AddrOffsetSectionBase == std::nullopt);
519 assert(RangeSectionBase == 0);
520 assert(LocSectionBase == 0);
522 if (!AddrOffsetSectionBase)
523 AddrOffsetSectionBase =
539 auto StringOffsetOrError =
542 if (!StringOffsetOrError)
544 "invalid reference to or invalid content in "
545 ".debug_str_offsets[.dwo]: " +
546 toString(StringOffsetOrError.takeError()));
548 StringOffsetsTableContribution = *StringOffsetOrError;
556 uint64_t ContributionBaseOffset = 0;
557 if (
auto *IndexEntry = Header.getIndexEntry())
558 if (
auto *Contrib = IndexEntry->getContribution(DW_SECT_RNGLISTS))
559 ContributionBaseOffset = Contrib->getOffset();
562 ContributionBaseOffset +
568 Header.getFormat())));
577 if (
auto *IndexEntry = Header.getIndexEntry())
578 if (
const auto *
C = IndexEntry->getContribution(
580 Data =
Data.substr(
C->getOffset(),
C->getLength());
584 std::make_unique<DWARFDebugLoclists>(DWARFData, Header.getVersion());
587 LocTable = std::make_unique<DWARFDebugLoclists>(
603bool DWARFUnit::parseDWO(
StringRef DWOAlternativeLocation) {
629 if (DWOAlternativeLocation.
empty())
642 DWO = std::shared_ptr<DWARFCompileUnit>(std::move(DWOContext), DWOCU);
643 DWO->setSkeletonUnit(
this);
645 if (AddrOffsetSectionBase)
646 DWO->setAddrOffsetSection(AddrOffsetSection, *AddrOffsetSectionBase);
649 DWO->setRangesSection(RangeSection, DWORangesBase.value_or(0));
655void DWARFUnit::clearDIEs(
bool KeepCUDie) {
661 DieArray = (KeepCUDie && !DieArray.empty())
662 ? std::vector<DWARFDebugInfoEntry>({DieArray[0]})
663 : std::vector<DWARFDebugInfoEntry>();
675 IsLittleEndian, Header.getAddressByteSize());
677 auto RangeListOrError = RnglistTable.
findList(RangesData,
Offset);
678 if (RangeListOrError)
679 return RangeListOrError.get().getAbsoluteRanges(
getBaseAddress(), *
this);
680 return RangeListOrError.takeError();
689 "invalid range list table index %d (possibly "
690 "missing the entire range list table)",
701 if (!CUDIERangesOrError)
703 "decoding address ranges: %s",
704 toString(CUDIERangesOrError.takeError()).c_str());
705 return *CUDIERangesOrError;
719 Result.push_back(std::move(*L));
721 InterpretationError =
722 joinErrors(L.takeError(), std::move(InterpretationError));
723 return !InterpretationError;
726 if (ParseError || InterpretationError)
727 return joinErrors(std::move(ParseError), std::move(InterpretationError));
735 if (DIERangesOrError) {
736 for (
const auto &R : DIERangesOrError.get()) {
738 if (R.LowPC == R.HighPC)
740 auto B = AddrDieMap.upper_bound(R.LowPC);
741 if (
B != AddrDieMap.begin() && R.LowPC < (--
B)->second.first) {
744 if (R.HighPC <
B->second.first)
745 AddrDieMap[R.HighPC] =
B->second;
746 if (R.LowPC >
B->first)
747 AddrDieMap[
B->first].first = R.LowPC;
749 AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
764 extractDIEsIfNeeded(
false);
765 if (AddrDieMap.empty())
767 auto R = AddrDieMap.upper_bound(
Address);
768 if (R == AddrDieMap.begin())
772 if (
Address >= R->second.first)
774 return R->second.second;
779 if (
isType(Child.getTag()))
784 if (Die.
getTag() != DW_TAG_variable)
801 auto It = Expr.
begin();
802 if (It == Expr.
end())
812 if (It->getCode() == dwarf::DW_OP_addr) {
813 LocationAddr = It->getRawOperand(0);
814 }
else if (It->getCode() == dwarf::DW_OP_addrx) {
815 uint64_t DebugAddrOffset = It->getRawOperand(0);
817 LocationAddr = Pointer->Address;
824 if (++It != Expr.
end()) {
825 if (It->getCode() != dwarf::DW_OP_plus_uconst)
828 LocationAddr += It->getRawOperand(0);
831 if (++It != Expr.
end())
852 extractDIEsIfNeeded(
false);
856 auto RootLookup = RootsParsedForVariables.
insert(RootDie.getOffset());
857 if (RootLookup.second)
860 auto R = VariableDieMap.upper_bound(
Address);
861 if (R == VariableDieMap.begin())
866 if (
Address >= R->second.first)
868 return R->second.second;
882 while (SubroutineDIE) {
887 if (SubroutineDIE.
getTag() == DW_TAG_inlined_subroutine)
889 SubroutineDIE = SubroutineDIE.
getParent();
895 if (Kind == DW_SECT_INFO)
912 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
914 if (std::optional<uint32_t> ParentIdx = Die->
getParentIdx()) {
915 assert(*ParentIdx < DieArray.size() &&
916 "ParentIdx is out of DieArray boundaries");
934 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
936 if (std::optional<uint32_t> SiblingIdx = Die->
getSiblingIdx()) {
937 assert(*SiblingIdx < DieArray.size() &&
938 "SiblingIdx is out of DieArray boundaries");
939 return &DieArray[*SiblingIdx];
956 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
958 std::optional<uint32_t> ParentIdx = Die->
getParentIdx();
963 assert(*ParentIdx < DieArray.size() &&
964 "ParentIdx is out of DieArray boundaries");
968 if (PrevDieIdx == *ParentIdx)
972 while (DieArray[PrevDieIdx].getParentIdx() != *ParentIdx) {
973 PrevDieIdx = *DieArray[PrevDieIdx].getParentIdx();
975 assert(PrevDieIdx < DieArray.size() &&
976 "PrevDieIdx is out of DieArray boundaries");
977 assert(PrevDieIdx >= *ParentIdx &&
978 "PrevDieIdx is not a child of parent of Die");
981 return &DieArray[PrevDieIdx];
995 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
1004 if (
I >= DieArray.size())
1006 return &DieArray[
I];
1020 assert(Die >= DieArray.data() && Die < DieArray.data() + DieArray.size());
1025 if (std::optional<uint32_t> SiblingIdx = Die->
getSiblingIdx()) {
1026 assert(*SiblingIdx < DieArray.size() &&
1027 "SiblingIdx is out of DieArray boundaries");
1028 assert(DieArray[*SiblingIdx - 1].
getTag() == dwarf::DW_TAG_null &&
1029 "Bad end of children marker");
1030 return &DieArray[*SiblingIdx - 1];
1042 if (
getDIEIndex(Die) == 0 && DieArray.size() > 1 &&
1043 DieArray.back().getTag() == dwarf::DW_TAG_null) {
1048 return &DieArray.back();
1058 if (!AbbrevsOrError) {
1063 Abbrevs = *AbbrevsOrError;
1073 std::optional<DWARFFormValue> PC =
1074 UnitDie.
find({DW_AT_low_pc, DW_AT_entry_pc});
1087 if (ValidationSize >=
Size)
1088 if (DA.isValidOffsetForDataOfSize((
uint32_t)
Base, ValidationSize))
1097 if (!DA.isValidOffsetForDataOfSize(
Offset, 16))
1105 (void)DA.getU16(&
Offset);
1115 if (!DA.isValidOffsetForDataOfSize(
Offset, 8))
1123 (void)DA.getU16(&
Offset);
1141 return DescOrError.takeError();
1142 Desc = *DescOrError;
1150 return DescOrError.takeError();
1151 Desc = *DescOrError;
1155 return Desc.validateContributionSize(DA);
1163 return std::nullopt;
1167 return DescOrError.takeError();
1168 return *DescOrError;
1175 auto IndexEntry = Header.getIndexEntry();
1177 IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) :
nullptr;
1181 if (DA.getData().data() ==
nullptr)
1182 return std::nullopt;
1187 return DescOrError.takeError();
1188 return *DescOrError;
1196 Header.getFormat());
1197 else if (!IndexEntry && !StringOffsetSection.
Data.
empty())
1199 4, Header.getFormat());
1201 return std::nullopt;
1202 auto DescOrError =
Desc.validateContributionSize(DA);
1204 return DescOrError.takeError();
1205 return *DescOrError;
1215 return *Off + RangeSectionBase;
1216 return std::nullopt;
1222 return *Off + LocSectionBase;
1223 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 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.
const MachineOperand & RHS
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)
function_ref< void(Error)> getRecoverableErrorHandler()
const DWARFUnitIndex & getTUIndex()
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)
function_ref< void(Error)> getWarningHandler()
void setMaxVersionIfGreater(unsigned Version)
static unsigned getMaxSupportedVersion()
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
const DWARFUnitIndex & getCUIndex()
unit_iterator_range info_section_units()
Get units from .debug_info in this context.
const DWARFObject & getDWARFObj() const
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
virtual const DWARFSection & getLoclistsSection() const
virtual const DWARFSection & getLocDWOSection() const
virtual const DWARFSection & getRnglistsDWOSection() const
virtual const DWARFSection & getLocSection() const
virtual const DWARFSection & getRnglistsSection() const
virtual const DWARFSection & getLoclistsDWOSection() 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 ...
bool isLittleEndian() const
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.
int64_t getOffset() const
Return the offset from the symbol in this operand.
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