LLVM  4.0.0
Classes | Public Member Functions | Protected Member Functions | List of all members
llvm::DWARFUnit Class Reference

#include <DWARFUnit.h>

Inheritance diagram for llvm::DWARFUnit:
[legend]

Public Member Functions

 DWARFUnit (DWARFContext &Context, const DWARFSection &Section, const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, StringRef SOS, StringRef AOS, StringRef LS, bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection, const DWARFUnitIndex::Entry *IndexEntry=nullptr)
 
virtual ~DWARFUnit ()
 
DWARFContextgetContext () const
 
StringRef getLineSection () const
 
StringRef getStringSection () const
 
StringRef getStringOffsetSection () const
 
void setAddrOffsetSection (StringRef AOS, uint32_t Base)
 
void setRangesSection (StringRef RS, uint32_t Base)
 
bool getAddrOffsetSectionItem (uint32_t Index, uint64_t &Result) const
 
bool getStringOffsetSectionItem (uint32_t Index, uint32_t &Result) const
 
DataExtractor getDebugInfoExtractor () const
 
DataExtractor getStringExtractor () const
 
const RelocAddrMapgetRelocMap () 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
 
uint16_t getVersion () const
 
dwarf::DwarfFormat getFormat () const
 
const
DWARFAbbreviationDeclarationSet
getAbbreviations () const
 
uint8_t getAddressByteSize () const
 
uint8_t getRefAddrByteSize () const
 
uint8_t getDwarfOffsetByteSize () 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 DWARFUnitSectionBasegetUnitSection () 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 ()
 

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 106 of file DWARFUnit.h.

Constructor & Destructor Documentation

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

Member Function Documentation

void llvm::DWARFUnit::clear ( )

Definition at line 140 of file DWARFUnit.cpp.

Referenced by extract().

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

Definition at line 299 of file DWARFUnit.h.

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

Definition at line 115 of file DWARFUnit.cpp.

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

bool llvm::DWARFUnit::extractImpl ( DataExtractor  debug_info,
uint32_t offset_ptr 
)
protectedvirtual
bool llvm::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 131 of file DWARFUnit.cpp.

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

Referenced by llvm::DWARFDie::getAddressRanges().

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

Definition at line 65 of file DWARFUnit.cpp.

References llvm::DataExtractor::getAddress(), and llvm::StringRef::size().

uint64_t llvm::DWARFUnit::getBaseAddress ( ) const
inline

Definition at line 222 of file DWARFUnit.h.

Referenced by llvm::DWARFDie::getAddressRanges().

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

Definition at line 166 of file DWARFUnit.h.

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

Return the DIE object at the given index.

Definition at line 267 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 279 of file DWARFUnit.h.

References assert().

Referenced by llvm::DWARFTypeUnit::dump(), and llvm::DWARFDie::getAttributeValueAsReferencedDie().

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 262 of file DWARFUnit.h.

References llvm::DWARFDie::getDebugInfoEntry().

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

Definition at line 217 of file DWARFUnit.h.

References llvm::dwarf::DWARF64, and getFormat().

Referenced by getRefAddrByteSize().

Optional< uint64_t > llvm::DWARFUnit::getDWOId ( )
dwarf::DwarfFormat llvm::DWARFUnit::getFormat ( ) const
inline

Definition at line 205 of file DWARFUnit.h.

References llvm::dwarf::DWARF32.

Referenced by getDwarfOffsetByteSize().

virtual uint32_t llvm::DWARFUnit::getHeaderSize ( ) const
inlineprotectedvirtual

Size in bytes of the unit header.

Reimplemented in llvm::DWARFTypeUnit.

Definition at line 155 of file DWARFUnit.h.

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

void llvm::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 358 of file DWARFUnit.cpp.

References llvm::SmallVectorImpl< T >::clear(), and llvm::DWARFDie::getInlinedChainForAddress().

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

uint32_t llvm::DWARFUnit::getLength ( ) const
inline
StringRef llvm::DWARFUnit::getLineSection ( ) const
inline

Definition at line 168 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 251 of file DWARFUnit.h.

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

Definition at line 201 of file DWARFUnit.h.

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

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

Definition at line 385 of file DWARFUnit.cpp.

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

Referenced by llvm::DWARFDie::getParent().

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

Definition at line 212 of file DWARFUnit.h.

References getDwarfOffsetByteSize().

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

Definition at line 191 of file DWARFUnit.h.

References llvm::DWARFSection::Relocs.

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

Definition at line 187 of file DWARFUnit.h.

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

Definition at line 170 of file DWARFUnit.h.

bool llvm::DWARFUnit::getStringOffsetSectionItem ( uint32_t  Index,
uint32_t Result 
) const

Definition at line 75 of file DWARFUnit.cpp.

References llvm::DataExtractor::getU32(), and llvm::StringRef::size().

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

Definition at line 169 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 247 of file DWARFUnit.h.

Referenced by llvm::DWARFDie::getAttributeValueAsReferencedDie().

uint16_t llvm::DWARFUnit::getVersion ( ) const
inline

Definition at line 204 of file DWARFUnit.h.

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

void llvm::DWARFUnit::setAddrOffsetSection ( StringRef  AOS,
uint32_t  Base 
)
inline

Definition at line 171 of file DWARFUnit.h.

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

Definition at line 224 of file DWARFUnit.h.

void llvm::DWARFUnit::setRangesSection ( StringRef  RS,
uint32_t  Base 
)
inline

Definition at line 175 of file DWARFUnit.h.


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