9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H 10 #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H 38 class DWARFAbbreviationDeclarationSet;
40 class DWARFDebugAbbrev;
52 uint64_t AbbrOffset = 0;
58 uint64_t TypeHash = 0;
59 uint64_t TypeOffset = 0;
89 assert((!DWOId || *DWOId == Id) &&
"setting DWOId to a different value");
97 return UnitType == dwarf::DW_UT_type || UnitType == dwarf::DW_UT_split_type;
118 int NumInfoUnits = -1;
125 DWARFUnit *getUnitForOffset(uint64_t Offset)
const;
139 void addUnitsForDWOSection(
DWARFContext &
C,
const DWARFSection &DWOSection,
144 DWARFUnit *addUnit(std::unique_ptr<DWARFUnit> Unit);
150 return NumInfoUnits == -1 ?
size() : NumInfoUnits;
161 const DWARFSection *RS,
const DWARFSection *LocSection,
163 const DWARFSection *AOS,
const DWARFSection &
LS,
bool LE,
164 bool IsDWO,
bool Lazy, DWARFSectionKind
SectionKind);
178 : Base(Base), Size(Size), FormParams({
Version, 0, Format}) {}
201 uint64_t RangeSectionBase;
227 std::vector<DWARFDebugInfoEntry> DieArray;
232 std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
237 std::shared_ptr<DWARFUnit> DWO;
240 auto First = DieArray.data();
241 assert(Die >= First && Die < First + DieArray.size());
296 return StringOffsetSection;
300 AddrOffsetSection = AOS;
301 AddrOffsetSectionBase = Base;
305 void updateAddressDieMap(
DWARFDie Die);
309 RangeSectionBase = Base;
326 Error extractRangeList(uint64_t RangeListOffset,
332 return StringOffsetsTableContribution;
336 assert(StringOffsetsTableContribution);
337 return StringOffsetsTableContribution->getDwarfOffsetByteSize();
341 assert(StringOffsetsTableContribution);
342 return StringOffsetsTableContribution->Base;
349 case dwarf::DW_UT_compile:
350 return Tag == dwarf::DW_TAG_compile_unit;
351 case dwarf::DW_UT_type:
352 return Tag == dwarf::DW_TAG_type_unit;
353 case dwarf::DW_UT_partial:
354 return Tag == dwarf::DW_TAG_partial_unit;
355 case dwarf::DW_UT_skeleton:
356 return Tag == dwarf::DW_TAG_skeleton_unit;
357 case dwarf::DW_UT_split_compile:
358 case dwarf::DW_UT_split_type:
371 case dwarf::DW_UT_compile:
372 case dwarf::DW_UT_partial:
374 case dwarf::DW_UT_skeleton:
375 case dwarf::DW_UT_split_compile:
377 case dwarf::DW_UT_type:
378 case dwarf::DW_UT_split_type:
387 extractDIEsIfNeeded(ExtractUnitDIEOnly);
388 if (DieArray.empty())
390 return DWARFDie(
this, &DieArray[0]);
396 return DWO->getUnitDIE(ExtractUnitDIEOnly);
397 return getUnitDIE(ExtractUnitDIEOnly);
400 const char *getCompilationDir();
402 extractDIEsIfNeeded(
true);
403 return getHeader().getDWOId();
421 return RngListTable->getOffsetEntry(Index);
435 void getInlinedChainForAddress(uint64_t Address,
444 extractDIEsIfNeeded(
false);
445 return DieArray.size();
460 assert(Index < DieArray.size());
461 return DWARFDie(
this, &DieArray[Index]);
475 extractDIEsIfNeeded(
false);
476 assert(!DieArray.empty());
481 if (It != DieArray.end() && It->getOffset() == Offset)
488 if (
const auto *Contrib = IndexEntry->getOffset(
DW_SECT_LINE))
489 return Contrib->Offset;
494 extractDIEsIfNeeded(
false);
500 Error tryExtractDIEsIfNeeded(
bool CUDieOnly);
504 size_t getDebugInfoSize()
const {
511 void extractDIEsIfNeeded(
bool CUDieOnly);
514 void extractDIEsToVector(
bool AppendCUDie,
bool AppendNonCUDIEs,
515 std::vector<DWARFDebugInfoEntry> &DIEs)
const;
518 void clearDIEs(
bool KeepCUDie);
527 #endif // LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag)
uint64_t getNextUnitOffset() const
This class represents lattice values for constants.
Represents base address of the CU.
bool isUnitType(uint8_t UnitType)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint8_t getDwarfOffsetByteSize() const
const DWARFSection * getLocSection() const
void setAddrOffsetSection(const DWARFSection *AOS, uint32_t Base)
const Optional< StrOffsetsContributionDescriptor > & getStringOffsetsTableContribution() const
unsigned getNumUnits() const
Returns number of all units held by this instance.
uint8_t getRefAddrByteSize() const
dwarf::DwarfFormat getFormat() const
uint8_t getDwarfStringOffsetsByteSize() const
const DWARFSection & getInfoSection() const
const dwarf::FormParams & getFormParams() const
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
const DWARFSection & getLineSection() const
Tagged union holding either a T or a Error.
const DWARFDebugInfoEntry * getDebugInfoEntry() const
uint8_t getAddressByteSize() const
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
auto partition_point(R &&Range, Predicate P) -> decltype(adl_begin(Range))
Binary search for the first iterator in a range where a predicate is false.
void setDWOId(uint64_t NewID)
const DWARFSection & getStringOffsetSection() const
uint16_t getVersion() const
uint8_t getUnitLengthFieldByteSize(DwarfFormat Format)
Get the byte size of the unit length field depending on the DWARF format.
Container for dump options that control which debug information will be dumped.
die_iterator_range dies()
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
A structured debug information entry.
Optional< uint64_t > getDWOId()
static uint32_t getDWARF5HeaderSize(uint8_t UnitType)
Return the number of bytes for the header of a unit of UnitType type.
StringRef getStringSection() const
uint32_t getDIEIndex(const DWARFDie &D)
Return the index of a DIE inside the unit's DIE vector.
SectionKind - This is a simple POD value that classifies the properties of a section.
DWARFContext & getContext() const
uint64_t getOffset() const
uint32_t getHeaderSize() const
Size in bytes of the parsed unit header.
typename UnitVector::iterator iterator
const DWARFUnitIndex & getDWARFUnitIndex(DWARFContext &Context, DWARFSectionKind Kind)
StrOffsetsContributionDescriptor(uint64_t Base, uint64_t Size, uint8_t Version, dwarf::DwarfFormat Format)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const DWARFSection * LocSection
const DWARFUnitVector & getUnitVector() const
Return the DWARFUnitVector containing this unit.
uint64_t getStringOffsetsBase() const
uint64_t getOffset() const
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
DWARFDie getDIEForOffset(uint64_t Offset)
Return the DIE object for a given offset inside the unit's DIE vector.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Describe a collection of units.
StringRef getLocSectionData() const
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
typename SuperClass::iterator iterator
static void clear(coro::Shape &Shape)
DataExtractor getStringExtractor() const
void finishedInfoUnits()
Indicate that parsing .debug_info[.dwo] is done, and remaining units will be from ...
DWARFDie getDIEAtIndex(unsigned Index)
Return the DIE object at the given index.
DWARFDie getNonSkeletonUnitDIE(bool ExtractUnitDIEOnly=true)
uint8_t getVersion() const
Optional< uint64_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
void setRangesSection(const DWARFSection *RS, uint64_t Base)
uint8_t getUnitType() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const DWARFUnitHeader & getHeader() const
DWARFDebugInfoEntry - A DIE with only the minimum required data.
uint64_t getLength() const
unsigned getNumTypesUnits() const
Returns number of units from all .debug_types[.dwo] sections.
Lightweight error class with error context and mandatory checking.
static const Function * getParent(const Value *V)
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
uint8_t getDwarfOffsetByteSize() const
uint32_t getLineTableOffset() const
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.