LLVM  5.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
llvm::DWARFUnit Class Reference

#include "llvm/DebugInfo/DWARF/DWARFUnit.h"

Inheritance diagram for llvm::DWARFUnit:
[legend]

Public Member Functions

 DWARFUnit (DWARFContext &Context, const DWARFSection &Section, const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection, const DWARFUnitIndex::Entry *IndexEntry=nullptr)
 
virtual ~DWARFUnit ()
 
DWARFContext & getContext () const
 
const DWARFSection & getLineSection () const
 
StringRef getStringSection () const
 
const DWARFSection & getStringOffsetSection () const
 
void setAddrOffsetSection (const DWARFSection *AOS, uint32_t Base)
 
void updateAddressDieMap (DWARFDie Die)
 Recursively update address to Die map. More...
 
void setRangesSection (const DWARFSection *RS, uint32_t Base)
 
bool getAddrOffsetSectionItem (uint32_t Index, uint64_t &Result) const
 
bool getStringOffsetSectionItem (uint32_t Index, uint64_t &Result) const
 
DWARFDataExtractor getDebugInfoExtractor () const
 
DataExtractor getStringExtractor () const
 
const RelocAddrMap * getRelocMap () const
 
const RelocAddrMap & getStringOffsetsRelocMap () const
 
bool extract (DataExtractor debug_info, uint32_t *offset_ptr)
 
bool extractRangeList (uint32_t RangeListOffset, DWARFDebugRangeList &RangeList) const
 extractRangeList - extracts the range list referenced by this compile unit from .debug_ranges section. More...
 
void clear ()
 
uint32_t getOffset () const
 
uint32_t getNextUnitOffset () const
 
uint32_t getLength () const
 
const DWARFFormParams & getFormParams () const
 
uint16_t getVersion () const
 
dwarf::DwarfFormat getFormat () const
 
uint8_t getAddressByteSize () const
 
uint8_t getRefAddrByteSize () const
 
uint8_t getDwarfOffsetByteSize () const
 
const
DWARFAbbreviationDeclarationSet * 
getAbbreviations () const
 
uint8_t getUnitType () const
 
uint64_t getBaseAddress () const
 
void setBaseAddress (uint64_t base_addr)
 
DWARFDie getUnitDIE (bool ExtractUnitDIEOnly=true)
 
const char * getCompilationDir ()
 
Optional< uint64_t > getDWOId ()
 
void collectAddressRanges (DWARFAddressRangesVector &CURanges)
 
void getInlinedChainForAddress (uint64_t Address, SmallVectorImpl< DWARFDie > &InlinedChain)
 getInlinedChainForAddress - fetches inlined chain for a given address. More...
 
const DWARFUnitSectionBase & getUnitSection () const
 getUnitSection - Return the DWARFUnitSection containing this unit. More...
 
unsigned getNumDIEs ()
 Returns the number of DIEs in the unit. More...
 
uint32_t getDIEIndex (const DWARFDie &D)
 Return the index of a DIE inside the unit's DIE vector. More...
 
DWARFDie getDIEAtIndex (unsigned Index)
 Return the DIE object at the given index. More...
 
DWARFDie getParent (const DWARFDebugInfoEntry *Die)
 
DWARFDie getSibling (const DWARFDebugInfoEntry *Die)
 
DWARFDie getDIEForOffset (uint32_t Offset)
 Return the DIE object for a given offset inside the unit's DIE vector. More...
 
uint32_t getLineTableOffset () const
 
die_iterator_range dies ()
 

Static Public Member Functions

static bool isValidUnitType (uint8_t UnitType)
 
static uint32_t getDWARF5HeaderSize (uint8_t UnitType)
 Return the number of bytes for the header of a unit of UnitType type. More...
 

Protected Member Functions

virtual bool extractImpl (DataExtractor debug_info, uint32_t *offset_ptr)
 
virtual uint32_t getHeaderSize () const
 Size in bytes of the unit header. More...
 

Detailed Description

Definition at line 113 of file DWARFUnit.h.

Constructor & Destructor Documentation

DWARFUnit::DWARFUnit ( DWARFContext &  Context,
const DWARFSection &  Section,
const DWARFDebugAbbrev *  DA,
const DWARFSection *  RS,
StringRef  SS,
const DWARFSection &  SOS,
const DWARFSection *  AOS,
const DWARFSection &  LS,
bool  LE,
bool  IsDWO,
const DWARFUnitSectionBase &  UnitSection,
const DWARFUnitIndex::Entry *  IndexEntry = nullptr 
)

Definition at line 47 of file DWARFUnit.cpp.

References clear().

DWARFUnit::~DWARFUnit ( )
virtualdefault

Member Function Documentation

void DWARFUnit::clear ( )

Definition at line 150 of file DWARFUnit.cpp.

References llvm::dwarf::DWARF32.

Referenced by DWARFUnit(), and extract().

void DWARFUnit::collectAddressRanges ( DWARFAddressRangesVector &  CURanges)
die_iterator_range llvm::DWARFUnit::dies ( )
inline

Definition at line 346 of file DWARFUnit.h.

bool DWARFUnit::extract ( DataExtractor  debug_info,
uint32_t *  offset_ptr 
)

Definition at line 124 of file DWARFUnit.cpp.

References clear(), extractImpl(), and llvm::DataExtractor::isValidOffset().

bool DWARFUnit::extractImpl ( DataExtractor  debug_info,
uint32_t *  offset_ptr 
)
protectedvirtual
bool DWARFUnit::extractRangeList ( uint32_t  RangeListOffset,
DWARFDebugRangeList &  RangeList 
) const

extractRangeList - extracts the range list referenced by this compile unit from .debug_ranges section.

Returns true on success. Requires that compile unit is already extracted.

Definition at line 140 of file DWARFUnit.cpp.

References assert(), llvm::DWARFDebugRangeList::extract(), and getAddressByteSize().

const DWARFAbbreviationDeclarationSet* llvm::DWARFUnit::getAbbreviations ( ) const
inline
uint8_t llvm::DWARFUnit::getAddressByteSize ( ) const
inline
bool DWARFUnit::getAddrOffsetSectionItem ( uint32_t  Index,
uint64_t &  Result 
) const
uint64_t llvm::DWARFUnit::getBaseAddress ( ) const
inline

Definition at line 269 of file DWARFUnit.h.

const char * DWARFUnit::getCompilationDir ( )
DWARFContext& llvm::DWARFUnit::getContext ( ) const
inline

Definition at line 176 of file DWARFUnit.h.

Referenced by dumpAttribute().

DWARFDataExtractor llvm::DWARFUnit::getDebugInfoExtractor ( ) const
inline
DWARFDie llvm::DWARFUnit::getDIEAtIndex ( unsigned  Index)
inline

Return the DIE object at the given index.

Definition at line 314 of file DWARFUnit.h.

References assert().

DWARFDie llvm::DWARFUnit::getDIEForOffset ( uint32_t  Offset)
inline

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.

Definition at line 326 of file DWARFUnit.h.

References assert().

Referenced by llvm::DWARFTypeUnit::dump().

uint32_t llvm::DWARFUnit::getDIEIndex ( const DWARFDie &  D)
inline

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().

Definition at line 309 of file DWARFUnit.h.

References llvm::DWARFDie::getDebugInfoEntry().

static uint32_t llvm::DWARFUnit::getDWARF5HeaderSize ( uint8_t  UnitType)
inlinestatic

Return the number of bytes for the header of a unit of UnitType type.

This function must be called with a valid unit type which in DWARF5 is defined as one of the following six types.

Definition at line 254 of file DWARFUnit.h.

References llvm_unreachable().

uint8_t llvm::DWARFUnit::getDwarfOffsetByteSize ( ) const
inline

Definition at line 231 of file DWARFUnit.h.

References llvm::DWARFFormParams::getDwarfOffsetByteSize().

Referenced by getStringOffsetSectionItem().

Optional< uint64_t > DWARFUnit::getDWOId ( )

Definition at line 166 of file DWARFUnit.cpp.

References llvm::find(), getUnitDIE(), and llvm::dwarf::toUnsigned().

dwarf::DwarfFormat llvm::DWARFUnit::getFormat ( ) const
inline

Definition at line 228 of file DWARFUnit.h.

References llvm::DWARFFormParams::Format.

const DWARFFormParams& llvm::DWARFUnit::getFormParams ( ) const
inline
virtual uint32_t llvm::DWARFUnit::getHeaderSize ( ) const
inlineprotectedvirtual

Size in bytes of the unit header.

Reimplemented in llvm::DWARFTypeUnit.

Definition at line 164 of file DWARFUnit.h.

References getVersion().

Referenced by llvm::DWARFTypeUnit::getHeaderSize().

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

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.

Definition at line 388 of file DWARFUnit.cpp.

References assert(), llvm::SmallVectorBase::empty(), llvm::DWARFDie::getParent(), llvm::DWARFDie::isSubroutineDIE(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().

Referenced by getFunctionNameAndStartLineForAddress(), and llvm::DWARFContext::getInliningInfoForAddress().

uint32_t llvm::DWARFUnit::getLength ( ) const
inline
const DWARFSection& llvm::DWARFUnit::getLineSection ( ) const
inline

Definition at line 178 of file DWARFUnit.h.

Referenced by llvm::DWARFContext::getLineTableForUnit().

uint32_t llvm::DWARFUnit::getLineTableOffset ( ) const
inline
uint32_t llvm::DWARFUnit::getNextUnitOffset ( ) const
inline
unsigned llvm::DWARFUnit::getNumDIEs ( )
inline

Returns the number of DIEs in the unit.

Parses the unit if necessary.

Definition at line 298 of file DWARFUnit.h.

uint32_t llvm::DWARFUnit::getOffset ( ) const
inline

Definition at line 222 of file DWARFUnit.h.

Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().

DWARFDie DWARFUnit::getParent ( const DWARFDebugInfoEntry *  Die)

Definition at line 413 of file DWARFUnit.cpp.

References llvm::DWARFDebugInfoEntry::getDepth(), getUnitDIE(), and I.

uint8_t llvm::DWARFUnit::getRefAddrByteSize ( ) const
inline

Definition at line 230 of file DWARFUnit.h.

References llvm::DWARFFormParams::getRefAddrByteSize().

const RelocAddrMap* llvm::DWARFUnit::getRelocMap ( ) const
inline

Definition at line 209 of file DWARFUnit.h.

References llvm::DWARFSection::Relocs.

DWARFDie DWARFUnit::getSibling ( const DWARFDebugInfoEntry *  Die)
DataExtractor llvm::DWARFUnit::getStringExtractor ( ) const
inline

Definition at line 205 of file DWARFUnit.h.

const DWARFSection& llvm::DWARFUnit::getStringOffsetSection ( ) const
inline

Definition at line 180 of file DWARFUnit.h.

bool DWARFUnit::getStringOffsetSectionItem ( uint32_t  Index,
uint64_t &  Result 
) const
const RelocAddrMap& llvm::DWARFUnit::getStringOffsetsRelocMap ( ) const
inline

Definition at line 210 of file DWARFUnit.h.

References llvm::DWARFSection::Relocs.

StringRef llvm::DWARFUnit::getStringSection ( ) const
inline

Definition at line 179 of file DWARFUnit.h.

DWARFDie llvm::DWARFUnit::getUnitDIE ( bool  ExtractUnitDIEOnly = true)
inline
const DWARFUnitSectionBase& llvm::DWARFUnit::getUnitSection ( ) const
inline

getUnitSection - Return the DWARFUnitSection containing this unit.

Definition at line 294 of file DWARFUnit.h.

uint8_t llvm::DWARFUnit::getUnitType ( ) const
inline

Definition at line 239 of file DWARFUnit.h.

Referenced by llvm::DWARFCompileUnit::dump(), and llvm::DWARFTypeUnit::dump().

uint16_t llvm::DWARFUnit::getVersion ( ) const
inline
static bool llvm::DWARFUnit::isValidUnitType ( uint8_t  UnitType)
inlinestatic

Definition at line 241 of file DWARFUnit.h.

void llvm::DWARFUnit::setAddrOffsetSection ( const DWARFSection *  AOS,
uint32_t  Base 
)
inline

Definition at line 184 of file DWARFUnit.h.

void llvm::DWARFUnit::setBaseAddress ( uint64_t  base_addr)
inline

Definition at line 271 of file DWARFUnit.h.

void llvm::DWARFUnit::setRangesSection ( const DWARFSection *  RS,
uint32_t  Base 
)
inline

Definition at line 192 of file DWARFUnit.h.

void DWARFUnit::updateAddressDieMap ( DWARFDie  Die)

The documentation for this class was generated from the following files: