class DWARFUnit

Declaration

class DWARFUnit { /* full declaration omitted */ };

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:207

Member Variables

private llvm::DWARFContext& Context
private const llvm::DWARFSection& InfoSection
Section containing this DWARFUnit.
private llvm::DWARFUnitHeader Header
private const llvm::DWARFDebugAbbrev* Abbrev
private const llvm::DWARFSection* RangeSection
private uint64_t RangeSectionBase
private uint64_t LocSectionBase
private std::unique_ptr<DWARFLocationTable> LocTable
Location table of this unit.
private const llvm::DWARFSection& LineSection
private llvm::StringRef StringSection
private const llvm::DWARFSection& StringOffsetSection
private const llvm::DWARFSection* AddrOffsetSection
private llvm::DWARFUnit* SU
private Optional<uint64_t> AddrOffsetSectionBase
private bool isLittleEndian
private bool IsDWO
private const llvm::DWARFUnitVector& UnitVector
private Optional<llvm::StrOffsetsContributionDescriptor> StringOffsetsTableContribution
Start, length, and DWARF format of the unit's contribution to the string offsets table (DWARF v5).
private const llvm::DWARFAbbreviationDeclarationSet* Abbrevs
private llvm::Optional<object::SectionedAddress> BaseAddr
private std::vector<DWARFDebugInfoEntry> DieArray
The compile unit debug information entry items.
private std::map<uint64_t, std::pair<uint64_t, DWARFDie>> AddrDieMap
Map from range's start address to end address and corresponding DIE. IntervalMap does not support range removal, as a result, we use the std::map::upper_bound for address range lookup.
private std::map<uint64_t, std::pair<uint64_t, DWARFDie>> VariableDieMap
Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, to the end address and the corresponding DIE.
private DenseSet<uint64_t> RootsParsedForVariables
private std::shared_ptr<DWARFUnit> DWO

Method Overview

Methods

DWARFUnit(llvm::DWARFContext& Context,
          const llvm::DWARFSection& Section,
          const llvm::DWARFUnitHeader& Header,
          const llvm::DWARFDebugAbbrev* DA,
          const llvm::DWARFSection* RS,
          const llvm::DWARFSection* LocSection,
          llvm::StringRef SS,
          const llvm::DWARFSection& SOS,
          const llvm::DWARFSection* AOS,
          const llvm::DWARFSection& LS,
          bool LE,
          bool IsDWO,
          const llvm::DWARFUnitVector& UnitVector)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:278

Parameters

llvm::DWARFContext& Context
const llvm::DWARFSection& Section
const llvm::DWARFUnitHeader& Header
const llvm::DWARFDebugAbbrev* DA
const llvm::DWARFSection* RS
const llvm::DWARFSection* LocSection
llvm::StringRef SS
const llvm::DWARFSection& SOS
const llvm::DWARFSection* AOS
const llvm::DWARFSection& LS
bool LE
bool IsDWO
const llvm::DWARFUnitVector& UnitVector

void clear()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:362

void clearDIEs(bool KeepCUDie)

Description

clearDIEs - Clear parsed DIEs to keep memory usage low.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:538

Parameters

bool KeepCUDie

Expected<llvm::DWARFAddressRangesVector>
collectAddressRanges()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:439

Expected<Optional<
    llvm::StrOffsetsContributionDescriptor>>
determineStringOffsetsTableContribution(
    llvm::DWARFDataExtractor& DA)

Description

Find the unit's contribution to the string offsets table and determine its length and form. The given offset is expected to be derived from the unit DIE's DW_AT_str_offsets_base attribute.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:268

Parameters

llvm::DWARFDataExtractor& DA

Expected<Optional<
    llvm::StrOffsetsContributionDescriptor>>
determineStringOffsetsTableContributionDWO(
    llvm::DWARFDataExtractor& DA)

Description

Find the unit's contribution to the string offsets table and determine its length and form. The given offset is expected to be 0 in a dwo file or, in a dwp file, the start of the unit's contribution to the string offsets table section (as determined by the index table).

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:275

Parameters

llvm::DWARFDataExtractor& DA

llvm::DWARFUnit::die_iterator_range dies()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:513

virtual void dump(llvm::raw_ostream& OS,
                  llvm::DIDumpOptions DumpOpts)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:518

Parameters

llvm::raw_ostream& OS
llvm::DIDumpOptions DumpOpts

void extractDIEsIfNeeded(bool CUDieOnly)

Description

extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it hasn't already been done

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:531

Parameters

bool CUDieOnly

void extractDIEsToVector(
    bool AppendCUDie,
    bool AppendNonCUDIEs,
    std::vector<DWARFDebugInfoEntry>& DIEs) const

Description

extractDIEsToVector - Appends all parsed DIEs to a vector.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:534

Parameters

bool AppendCUDie
bool AppendNonCUDIEs
std::vector<DWARFDebugInfoEntry>& DIEs

llvm::Error extractRangeList(
    uint64_t RangeListOffset,
    llvm::DWARFDebugRangeList& RangeList) const

Description

Extract the range list referenced by this compile unit from the .debug_ranges section. If the extraction is unsuccessful, an error is returned. Successful extraction requires that the compile unit has already been extracted.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:360

Parameters

uint64_t RangeListOffset
llvm::DWARFDebugRangeList& RangeList

Expected<llvm::DWARFLocationExpressionsVector>
findLoclistFromOffset(uint64_t Offset)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:442

Parameters

uint64_t Offset

Expected<llvm::DWARFAddressRangesVector>
findRnglistFromIndex(uint32_t Index)

Description

Return a vector of address ranges retrieved from an encoded range list whose offset is found via a table lookup given an index (DWARF v5 and later).

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:430

Parameters

uint32_t Index

Expected<llvm::DWARFAddressRangesVector>
findRnglistFromOffset(uint64_t Offset)

Description

Return a vector of address ranges resulting from a (possibly encoded) range list starting at a given offset in the appropriate ranges section.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:425

Parameters

uint64_t Offset

uint64_t getAbbrOffset() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:306

const llvm::DWARFAbbreviationDeclarationSet*
getAbbreviations() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:381

uint64_t getAbbreviationsOffset() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:379

Optional<uint64_t> getAddrOffsetSectionBase()
    const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:325

Optional<object::SectionedAddress>
getAddrOffsetSectionItem(uint32_t Index) const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:345

Parameters

uint32_t Index

uint8_t getAddressByteSize() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:295

llvm::Optional<object::SectionedAddress>
getBaseAddress()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:400

const char* getCompilationDir()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:416

llvm::DWARFContext& getContext() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:288

llvm::DWARFDie getDIEAtIndex(unsigned int Index)

Description

Return the DIE object at the given index.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:480

Parameters

unsigned int Index

llvm::DWARFDie getDIEForOffset(uint64_t Offset)

Description

Return the DIE object for a given offset inside the unit's DIE vector. The unit needs to have its DIEs extracted for this method to work.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:495

Parameters

uint64_t Offset

uint32_t getDIEIndex(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:255

Parameters

const llvm::DWARFDebugInfoEntry* Die

uint32_t getDIEIndex(const llvm::DWARFDie& D)

Description

Return the index of a DIE inside the unit's DIE vector. It is illegal to call this method with a DIE that hasn't be created by this unit. In other word, it's illegal to call this method on a DIE that isn't accessible by following children/sibling links starting from this unit's getUnitDIE().

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:475

Parameters

const llvm::DWARFDie& D

Optional<uint64_t> getDWOId()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:417

llvm::DWARFDataExtractor getDebugInfoExtractor()
    const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:348

size_t getDebugInfoSize() const

Description

Size in bytes of the .debug_info data associated with this compile unit.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:524

uint8_t getDwarfOffsetByteSize() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:297

uint8_t getDwarfStringOffsetsByteSize() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:369

llvm::DWARFDie getFirstChild(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:488

Parameters

const llvm::DWARFDebugInfoEntry* Die

const dwarf::FormParams& getFormParams() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:291

dwarf::DwarfFormat getFormat() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:303

const llvm::DWARFUnitHeader& getHeader() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:262

uint32_t getHeaderSize() const

Description

Size in bytes of the parsed unit header.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:301

const llvm::DWARFSection& getInfoSection() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:289

void getInlinedChainForAddress(
    uint64_t Address,
    SmallVectorImpl<llvm::DWARFDie>& InlinedChain)

Description

getInlinedChainForAddress - fetches inlined chain for a given address. Returns empty chain if there is no subprogram containing address. The chain is valid as long as parsed compile unit DIEs are not cleared.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:456

Parameters

uint64_t Address
SmallVectorImpl<llvm::DWARFDie>& InlinedChain

llvm::DWARFDie getLastChild(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:489

Parameters

const llvm::DWARFDebugInfoEntry* Die

uint64_t getLength() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:302

const llvm::DWARFSection& getLineSection() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:308

uint32_t getLineTableOffset() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:506

llvm::DWARFUnit* getLinkedUnit()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:318

uint64_t getLocSectionBase() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:340

const llvm::DWARFLocationTable& getLocationTable()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:354

Optional<uint64_t> getLoclistOffset(
    uint32_t Index)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:437

Parameters

uint32_t Index

uint64_t getNextUnitOffset() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:307

llvm::DWARFDie getNonSkeletonUnitDIE(
    bool ExtractUnitDIEOnly = true)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:409

Parameters

bool ExtractUnitDIEOnly = true

unsigned int getNumDIEs()

Description

Returns the number of DIEs in the unit. Parses the unit if necessary.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:464

uint64_t getOffset() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:290

llvm::DWARFDie getParent(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:485

Parameters

const llvm::DWARFDebugInfoEntry* Die

llvm::DWARFDie getPreviousSibling(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:487

Parameters

const llvm::DWARFDebugInfoEntry* Die

uint8_t getRefAddrByteSize() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:296

Optional<uint64_t> getRnglistOffset(
    uint32_t Index)

Description

Return a rangelist's offset based on an index. The index designates an entry in the rangelist table's offset array and is supplied by DW_FORM_rnglistx.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:435

Parameters

uint32_t Index

llvm::DWARFDie getSibling(
    const llvm::DWARFDebugInfoEntry* Die)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:486

Parameters

const llvm::DWARFDebugInfoEntry* Die

llvm::DataExtractor getStringExtractor() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:350

const llvm::DWARFSection& getStringOffsetSection()
    const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:310

Expected<uint64_t> getStringOffsetSectionItem(
    uint32_t Index) const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:346

Parameters

uint32_t Index

uint64_t getStringOffsetsBase() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:374

const Optional<
    llvm::StrOffsetsContributionDescriptor>&
getStringOffsetsTableContribution() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:365

llvm::StringRef getStringSection() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:309

llvm::DWARFDie getSubroutineForAddress(
    uint64_t Address)

Description

Returns subprogram DIE with address range encompassing the provided address. The pointer is alive as long as parsed compile unit DIEs are not cleared.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:447

Parameters

uint64_t Address

llvm::DWARFDie getUnitDIE(
    bool ExtractUnitDIEOnly = true)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:402

Parameters

bool ExtractUnitDIEOnly = true

uint8_t getUnitType() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:304

const llvm::DWARFUnitVector& getUnitVector() const

Description

Return the DWARFUnitVector containing this unit.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:460

llvm::DWARFDie getVariableForAddress(
    uint64_t Address)

Description

Returns variable DIE for the address provided. The pointer is alive as long as parsed compile unit DIEs are not cleared.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:451

Parameters

uint64_t Address

uint16_t getVersion() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:294

bool isDWOUnit() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:287

static bool isMatchingUnitTypeAndTag(
    uint8_t UnitType,
    dwarf::Tag Tag)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:383

Parameters

uint8_t UnitType
dwarf::Tag Tag

bool isTypeUnit() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:305

bool parseDWO()

Description

parseDWO - Parses .dwo file for current compile unit. Returns true if it was actually constructed.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:542

void setAddrOffsetSection(
    const llvm::DWARFSection* AOS,
    uint64_t Base)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:320

Parameters

const llvm::DWARFSection* AOS
uint64_t Base

void setDWOId(uint64_t NewID)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:421

Parameters

uint64_t NewID

void setRangesSection(
    const llvm::DWARFSection* RS,
    uint64_t Base)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:335

Parameters

const llvm::DWARFSection* RS
uint64_t Base

void setSkeletonUnit(llvm::DWARFUnit* SU)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:314

Parameters

llvm::DWARFUnit* SU

llvm::Error tryExtractDIEsIfNeeded(bool CUDieOnly)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:520

Parameters

bool CUDieOnly

void updateAddressDieMap(llvm::DWARFDie Die)

Description

Recursively update address to Die map.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:330

Parameters

llvm::DWARFDie Die

void updateVariableDieMap(llvm::DWARFDie Die)

Description

Recursively update address to variable Die map.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:333

Parameters

llvm::DWARFDie Die

virtual ~DWARFUnit()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:285