LLVM
13.0.0git
|
Utility class that carries the DWARF compile/type unit and the debug info entry in an object. More...
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
Classes | |
class | attribute_iterator |
class | iterator |
Public Member Functions | |
DWARFDie ()=default | |
DWARFDie (DWARFUnit *Unit, const DWARFDebugInfoEntry *D) | |
bool | isValid () const |
operator bool () const | |
const DWARFDebugInfoEntry * | getDebugInfoEntry () const |
DWARFUnit * | getDwarfUnit () const |
const DWARFAbbreviationDeclaration * | getAbbreviationDeclarationPtr () const |
Get the abbreviation declaration for this DIE. More... | |
uint64_t | getOffset () const |
Get the absolute offset into the debug info or types section. More... | |
dwarf::Tag | getTag () const |
bool | hasChildren () const |
bool | isNULL () const |
Returns true for a valid DIE that terminates a sibling chain. More... | |
bool | isSubprogramDIE () const |
Returns true if DIE represents a subprogram (not inlined). More... | |
bool | isSubroutineDIE () const |
Returns true if DIE represents a subprogram or an inlined subroutine. More... | |
DWARFDie | getParent () const |
Get the parent of this DIE object. More... | |
DWARFDie | getSibling () const |
Get the sibling of this DIE object. More... | |
DWARFDie | getPreviousSibling () const |
Get the previous sibling of this DIE object. More... | |
DWARFDie | getFirstChild () const |
Get the first child of this DIE object. More... | |
DWARFDie | getLastChild () const |
Get the last child of this DIE object. More... | |
void | dump (raw_ostream &OS, unsigned indent=0, DIDumpOptions DumpOpts=DIDumpOptions()) const |
Dump the DIE and all of its attributes to the supplied stream. More... | |
LLVM_DUMP_METHOD void | dump () const |
Convenience zero-argument overload for debugging. More... | |
Optional< DWARFFormValue > | find (dwarf::Attribute Attr) const |
Extract the specified attribute from this DIE. More... | |
Optional< DWARFFormValue > | find (ArrayRef< dwarf::Attribute > Attrs) const |
Extract the first value of any attribute in Attrs from this DIE. More... | |
Optional< DWARFFormValue > | findRecursively (ArrayRef< dwarf::Attribute > Attrs) const |
Extract the first value of any attribute in Attrs from this DIE and recurse into any DW_AT_specification or DW_AT_abstract_origin referenced DIEs. More... | |
DWARFDie | getAttributeValueAsReferencedDie (dwarf::Attribute Attr) const |
Extract the specified attribute from this DIE as the referenced DIE. More... | |
DWARFDie | getAttributeValueAsReferencedDie (const DWARFFormValue &V) const |
Optional< uint64_t > | getRangesBaseAttribute () const |
Extract the range base attribute from this DIE as absolute section offset. More... | |
Optional< uint64_t > | getLocBaseAttribute () const |
Optional< uint64_t > | getHighPC (uint64_t LowPC) const |
Get the DW_AT_high_pc attribute value as an address. More... | |
bool | getLowAndHighPC (uint64_t &LowPC, uint64_t &HighPC, uint64_t &SectionIndex) const |
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU. More... | |
Expected< DWARFAddressRangesVector > | getAddressRanges () const |
Get the address ranges for this DIE. More... | |
void | collectChildrenAddressRanges (DWARFAddressRangesVector &Ranges) const |
Get all address ranges for any DW_TAG_subprogram DIEs in this DIE or any of its children. More... | |
bool | addressRangeContainsAddress (const uint64_t Address) const |
Expected< DWARFLocationExpressionsVector > | getLocations (dwarf::Attribute Attr) const |
const char * | getSubroutineName (DINameKind Kind) const |
If a DIE represents a subprogram (or inlined subroutine), returns its mangled name (or short name, if mangled is missing). More... | |
const char * | getName (DINameKind Kind) const |
Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. More... | |
const char * | getShortName () const |
Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. More... | |
const char * | getLinkageName () const |
Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. More... | |
uint64_t | getDeclLine () const |
Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram. More... | |
std::string | getDeclFile (DILineInfoSpecifier::FileLineInfoKind Kind) const |
void | getCallerFrame (uint32_t &CallFile, uint32_t &CallLine, uint32_t &CallColumn, uint32_t &CallDiscriminator) const |
Retrieves values of DW_AT_call_file, DW_AT_call_line and DW_AT_call_column from DIE (or zeroes if they are missing). More... | |
iterator_range< attribute_iterator > | attributes () const |
Get an iterator range to all attributes in the current DIE only. More... | |
iterator | begin () const |
iterator | end () const |
std::reverse_iterator< iterator > | rbegin () const |
std::reverse_iterator< iterator > | rend () const |
iterator_range< iterator > | children () const |
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
When accessing information from a debug info entry we always need to DWARF compile/type unit in order to extract the info correctly as some information is relative to the compile/type unit. Prior to this class the DWARFUnit and the DWARFDebugInfoEntry was passed around separately and there was the possibility for error if the wrong DWARFUnit was used to extract a unit relative offset. This class helps to ensure that this doesn't happen and also simplifies the attribute extraction calls by not having to specify the DWARFUnit for each call.
Definition at line 43 of file DWARFDie.h.
|
default |
|
inline |
Definition at line 49 of file DWARFDie.h.
bool llvm::DWARFDie::addressRangeContainsAddress | ( | const uint64_t | Address | ) | const |
iterator_range<attribute_iterator> llvm::DWARFDie::attributes | ( | ) | const |
|
inline |
Definition at line 387 of file DWARFDie.h.
References getFirstChild().
Referenced by children(), and rend().
|
inline |
Definition at line 395 of file DWARFDie.h.
References begin(), end(), and llvm::make_range().
Referenced by llvm::analyzeContextInfo(), hasInlineInfo(), and parseInlineInfo().
void llvm::DWARFDie::collectChildrenAddressRanges | ( | DWARFAddressRangesVector & | Ranges | ) | const |
Get all address ranges for any DW_TAG_subprogram DIEs in this DIE or any of its children.
Get the hi/low PC range if both attributes are available or exrtracts the non-contiguous address ranges from the DW_AT_ranges attribute for this DIE and all children.
Ranges | the addres range vector to fill in. |
LLVM_DUMP_METHOD void llvm::DWARFDie::dump | ( | ) | const |
Convenience zero-argument overload for debugging.
void llvm::DWARFDie::dump | ( | raw_ostream & | OS, |
unsigned | indent = 0 , |
||
DIDumpOptions | DumpOpts = DIDumpOptions() |
||
) | const |
Dump the DIE and all of its attributes to the supplied stream.
OS | the stream to use for output. |
indent | the number of characters to indent each line that is output. |
Referenced by convertFunctionLineTable().
|
inline |
Definition at line 391 of file DWARFDie.h.
References getLastChild().
Referenced by children(), and rbegin().
Optional<DWARFFormValue> llvm::DWARFDie::find | ( | ArrayRef< dwarf::Attribute > | Attrs | ) | const |
Extract the first value of any attribute in Attrs from this DIE.
Extract the first attribute that matches from this DIE only. This call doesn't look for the attribute value in any DW_AT_specification or DW_AT_abstract_origin referenced DIEs. The attributes will be searched linearly in the order they are specified within Attrs.
Attrs | an array of DWARF attribute to look for. |
Optional<DWARFFormValue> llvm::DWARFDie::find | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE.
Extract an attribute value from this DIE only. This call doesn't look for the attribute value in any DW_AT_specification or DW_AT_abstract_origin referenced DIEs.
Attr | the attribute to extract. |
Referenced by llvm::analyzeContextInfo(), llvm::gsym::CUInfo::CUInfo(), llvm::DWARFUnit::getBaseAddress(), llvm::getDwoId(), parseInlineInfo(), llvm::DWARFUnit::tryExtractDIEsIfNeeded(), and llvm::updatePruning().
Optional<DWARFFormValue> llvm::DWARFDie::findRecursively | ( | ArrayRef< dwarf::Attribute > | Attrs | ) | const |
Extract the first value of any attribute in Attrs from this DIE and recurse into any DW_AT_specification or DW_AT_abstract_origin referenced DIEs.
Attrs | an array of DWARF attribute to look for. |
Referenced by convertFunctionLineTable(), and getQualifiedNameIndex().
|
inline |
Get the abbreviation declaration for this DIE.
Definition at line 59 of file DWARFDie.h.
References assert(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), and isValid().
Expected<DWARFAddressRangesVector> llvm::DWARFDie::getAddressRanges | ( | ) | const |
Get the address ranges for this DIE.
Get the hi/low PC range if both attributes are available or exrtracts the non-contiguous address ranges from the DW_AT_ranges attribute.
Extracts the range information from this DIE only. This call doesn't look for the range in any DW_AT_specification or DW_AT_abstract_origin DIEs.
Referenced by llvm::DWARFUnit::collectAddressRanges(), parseInlineInfo(), and llvm::DWARFUnit::updateAddressDieMap().
DWARFDie llvm::DWARFDie::getAttributeValueAsReferencedDie | ( | const DWARFFormValue & | V | ) | const |
DWARFDie llvm::DWARFDie::getAttributeValueAsReferencedDie | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as the referenced DIE.
Regardless of the reference type, return the correct DWARFDie instance if the attribute exists. The returned DWARFDie object might be from another DWARFUnit, but that is all encapsulated in the new DWARFDie object.
Extract an attribute value from this DIE only. This call doesn't look for the attribute value in any DW_AT_specification or DW_AT_abstract_origin referenced DIEs.
Attr | the attribute to extract. |
Referenced by GetParentDeclContextDIE().
void llvm::DWARFDie::getCallerFrame | ( | uint32_t & | CallFile, |
uint32_t & | CallLine, | ||
uint32_t & | CallColumn, | ||
uint32_t & | CallDiscriminator | ||
) | const |
Retrieves values of DW_AT_call_file, DW_AT_call_line and DW_AT_call_column from DIE (or zeroes if they are missing).
This function looks for DW_AT_call attributes in this DIE only, it will not resolve the attribute values in any DW_AT_specification or DW_AT_abstract_origin DIEs.
CallFile | filled in with non-zero if successful, zero if there is no DW_AT_call_file attribute in this DIE. |
CallLine | filled in with non-zero if successful, zero if there is no DW_AT_call_line attribute in this DIE. |
CallColumn | filled in with non-zero if successful, zero if there is no DW_AT_call_column attribute in this DIE. |
CallDiscriminator | filled in with non-zero if successful, zero if there is no DW_AT_GNU_discriminator attribute in this DIE. |
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
|
inline |
Definition at line 53 of file DWARFDie.h.
Referenced by llvm::operator==().
std::string llvm::DWARFDie::getDeclFile | ( | DILineInfoSpecifier::FileLineInfoKind | Kind | ) | const |
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
uint64_t llvm::DWARFDie::getDeclLine | ( | ) | const |
Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram.
This may be fetched from specification or abstract origin for this subprogram by resolving DW_AT_sepcification or DW_AT_abstract_origin references if necessary.
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
|
inline |
Definition at line 54 of file DWARFDie.h.
Referenced by isVariableIndexable(), and llvm::operator==().
DWARFDie llvm::DWARFDie::getFirstChild | ( | ) | const |
Get the first child of this DIE object.
Referenced by begin(), and llvm::DWARFUnit::updateAddressDieMap().
Optional<uint64_t> llvm::DWARFDie::getHighPC | ( | uint64_t | LowPC | ) | const |
Get the DW_AT_high_pc attribute value as an address.
In DWARF version 4 and later the high PC can be encoded as an offset from the DW_AT_low_pc. This function takes care of extracting the value as an address or offset and adds it to the low PC if needed and returns the value as an optional in case the DIE doesn't have a DW_AT_high_pc attribute.
LowPC | the low PC that might be needed to calculate the high PC. |
DWARFDie llvm::DWARFDie::getLastChild | ( | ) | const |
const char* llvm::DWARFDie::getLinkageName | ( | ) | const |
Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
Returns null if no name is found.
Expected<DWARFLocationExpressionsVector> llvm::DWARFDie::getLocations | ( | dwarf::Attribute | Attr | ) | const |
Referenced by isVariableIndexable().
Optional<uint64_t> llvm::DWARFDie::getLocBaseAttribute | ( | ) | const |
bool llvm::DWARFDie::getLowAndHighPC | ( | uint64_t & | LowPC, |
uint64_t & | HighPC, | ||
uint64_t & | SectionIndex | ||
) | const |
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
Returns true if both attributes are present.
const char* llvm::DWARFDie::getName | ( | DINameKind | Kind | ) | const |
Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
For the LinkageName case it additionaly searches for ShortName if LinkageName is not found. Returns null if no name is found.
Referenced by llvm::DWARFTypeUnit::dump(), and getQualifiedNameIndex().
|
inline |
Get the absolute offset into the debug info or types section.
Definition at line 67 of file DWARFDie.h.
References assert(), llvm::DWARFDebugInfoEntry::getOffset(), and isValid().
Referenced by llvm::operator<().
DWARFDie llvm::DWARFDie::getParent | ( | ) | const |
Get the parent of this DIE object.
Referenced by llvm::DWARFUnit::getInlinedChainForAddress(), and GetParentDeclContextDIE().
DWARFDie llvm::DWARFDie::getPreviousSibling | ( | ) | const |
Get the previous sibling of this DIE object.
Referenced by std::reverse_iterator< llvm::DWARFDie::iterator >::operator++(), llvm::DWARFDie::iterator::operator--(), and std::reverse_iterator< llvm::DWARFDie::iterator >::reverse_iterator().
Optional<uint64_t> llvm::DWARFDie::getRangesBaseAttribute | ( | ) | const |
Extract the range base attribute from this DIE as absolute section offset.
This is a utility function that checks for either the DW_AT_rnglists_base or DW_AT_GNU_ranges_base attribute.
const char* llvm::DWARFDie::getShortName | ( | ) | const |
Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
Returns null if no name is found.
DWARFDie llvm::DWARFDie::getSibling | ( | ) | const |
Get the sibling of this DIE object.
Referenced by std::reverse_iterator< llvm::DWARFDie::iterator >::base(), llvm::DWARFDie::iterator::operator++(), std::reverse_iterator< llvm::DWARFDie::iterator >::operator--(), and llvm::DWARFUnit::updateAddressDieMap().
const char* llvm::DWARFDie::getSubroutineName | ( | DINameKind | Kind | ) | const |
If a DIE represents a subprogram (or inlined subroutine), returns its mangled name (or short name, if mangled is missing).
This name may be fetched from specification or abstract origin for this subprogram. Returns null if no name is found.
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
|
inline |
Definition at line 72 of file DWARFDie.h.
References getAbbreviationDeclarationPtr().
Referenced by llvm::analyzeContextInfo(), llvm::CompileUnit::createOutputDIE(), llvm::DWARFUnit::getInlinedChainForAddress(), GetParentDeclContextDIE(), hasInlineInfo(), llvm::inFunctionScope(), parseInlineInfo(), llvm::updateChildIncompleteness(), llvm::updatePruning(), and llvm::updateRefIncompleteness().
|
inline |
Definition at line 79 of file DWARFDie.h.
References assert(), llvm::DWARFDebugInfoEntry::hasChildren(), and isValid().
|
inline |
Returns true for a valid DIE that terminates a sibling chain.
Definition at line 85 of file DWARFDie.h.
References getAbbreviationDeclarationPtr().
Referenced by std::reverse_iterator< llvm::DWARFDie::iterator >::operator--().
bool llvm::DWARFDie::isSubprogramDIE | ( | ) | const |
Returns true if DIE represents a subprogram (not inlined).
Referenced by llvm::DWARFUnit::getInlinedChainForAddress().
bool llvm::DWARFDie::isSubroutineDIE | ( | ) | const |
Returns true if DIE represents a subprogram or an inlined subroutine.
Referenced by llvm::DWARFUnit::updateAddressDieMap().
|
inline |
Definition at line 51 of file DWARFDie.h.
Referenced by getAbbreviationDeclarationPtr(), llvm::DWARFContext::getLocalsForAddress(), getOffset(), hasChildren(), operator bool(), and std::reverse_iterator< llvm::DWARFDie::iterator >::operator*().
|
inlineexplicit |
Definition at line 52 of file DWARFDie.h.
References isValid().
|
inline |
Definition at line 471 of file DWARFDie.h.
References end(), and llvm::make_reverse_iterator().
|
inline |
Definition at line 475 of file DWARFDie.h.
References begin(), and llvm::make_reverse_iterator().