10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H 11 #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H 39 class DWARFAbbreviationDeclarationSet;
41 class DWARFDebugAbbrev;
53 uint64_t AbbrOffset = 0;
59 uint64_t TypeHash = 0;
90 assert((!DWOId || *DWOId == Id) &&
"setting DWOId to a different value");
98 return UnitType == dwarf::DW_UT_type || UnitType == dwarf::DW_UT_split_type;
115 int NumInfoUnits = -1;
122 DWARFUnit *getUnitForOffset(uint32_t Offset)
const;
136 void addUnitsForDWOSection(
DWARFContext &
C,
const DWARFSection &DWOSection,
147 return NumInfoUnits == -1 ?
size() : NumInfoUnits;
158 const DWARFSection *RS,
const DWARFSection *LocSection,
160 const DWARFSection *AOS,
const DWARFSection &
LS,
bool LE,
161 bool IsDWO,
bool Lazy, DWARFSectionKind
SectionKind);
175 : Base(Base), Size(Size), FormParams({
Version, 0, Format}) {}
223 std::vector<DWARFDebugInfoEntry> DieArray;
228 std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap;
233 std::shared_ptr<DWARFUnit> DWO;
236 auto First = DieArray.data();
237 assert(Die >= First && Die < First + DieArray.size());
292 return StringOffsetSection;
296 AddrOffsetSection = AOS;
297 AddrOffsetSectionBase = Base;
301 void updateAddressDieMap(
DWARFDie Die);
305 RangeSectionBase = Base;
327 return StringOffsetsTableContribution;
331 assert(StringOffsetsTableContribution);
332 return StringOffsetsTableContribution->getDwarfOffsetByteSize();
336 assert(StringOffsetsTableContribution);
337 return StringOffsetsTableContribution->Base;
344 case dwarf::DW_UT_compile:
345 return Tag == dwarf::DW_TAG_compile_unit;
346 case dwarf::DW_UT_type:
347 return Tag == dwarf::DW_TAG_type_unit;
348 case dwarf::DW_UT_partial:
349 return Tag == dwarf::DW_TAG_partial_unit;
350 case dwarf::DW_UT_skeleton:
351 return Tag == dwarf::DW_TAG_skeleton_unit;
352 case dwarf::DW_UT_split_compile:
353 case dwarf::DW_UT_split_type:
366 case dwarf::DW_UT_compile:
367 case dwarf::DW_UT_partial:
369 case dwarf::DW_UT_skeleton:
370 case dwarf::DW_UT_split_compile:
372 case dwarf::DW_UT_type:
373 case dwarf::DW_UT_split_type:
382 extractDIEsIfNeeded(ExtractUnitDIEOnly);
383 if (DieArray.empty())
385 return DWARFDie(
this, &DieArray[0]);
388 const char *getCompilationDir();
390 extractDIEsIfNeeded(
true);
391 return getHeader().getDWOId();
409 return RngListTable->getOffsetEntry(Index);
423 void getInlinedChainForAddress(uint64_t Address,
432 extractDIEsIfNeeded(
false);
433 return DieArray.size();
448 assert(Index < DieArray.size());
449 return DWARFDie(
this, &DieArray[Index]);
463 extractDIEsIfNeeded(
false);
464 assert(!DieArray.empty());
466 DieArray.begin(), DieArray.end(), Offset,
468 return LHS.getOffset() < Offset;
470 if (it != DieArray.end() && it->getOffset() == Offset)
477 if (
const auto *Contrib = IndexEntry->getOffset(
DW_SECT_LINE))
478 return Contrib->Offset;
483 extractDIEsIfNeeded(
false);
490 size_t getDebugInfoSize()
const {
491 return Header.
getLength() + 4 - getHeaderSize();
496 size_t extractDIEsIfNeeded(
bool CUDieOnly);
499 void extractDIEsToVector(
bool AppendCUDie,
bool AppendNonCUDIEs,
500 std::vector<DWARFDebugInfoEntry> &DIEs)
const;
503 void clearDIEs(
bool KeepCUDie);
512 #endif // LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
static bool isMatchingUnitTypeAndTag(uint8_t UnitType, dwarf::Tag Tag)
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
uint32_t getNextUnitOffset() 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 lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
void setDWOId(uint64_t NewID)
const DWARFSection & getStringOffsetSection() const
uint16_t getVersion() const
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")
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
void setRangesSection(const DWARFSection *RS, uint32_t Base)
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
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...
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
uint32_t getLength() const
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.
uint8_t getVersion() const
uint32_t getOffset() const
uint8_t getUnitType() const
DWARFDie getDIEForOffset(uint32_t Offset)
Return the DIE object for a given offset inside the unit's DIE vector.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const DWARFUnitHeader & getHeader() const
DWARFDebugInfoEntry - A DIE with only the minimum required data.
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.
Optional< uint32_t > getRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
uint8_t getDwarfOffsetByteSize() const
uint32_t getLineTableOffset() const
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.