|
LLVM
4.0.0
|
Utility class that carries the DWARF compile/type unit and the debug info entry in an object. More...
#include <DWARFDie.h>
Classes | |
| class | iterator |
Public Member Functions | |
| DWARFDie () | |
| 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... | |
| uint32_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 | getFirstChild () const |
| Get the first child of this DIE object. More... | |
| void | dump (raw_ostream &OS, unsigned recurseDepth, unsigned indent=0) const |
| Dump the DIE and all of its attributes to the supplied stream. More... | |
| Optional< DWARFFormValue > | getAttributeValue (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE. More... | |
| const char * | getAttributeValueAsString (dwarf::Attribute Attr, const char *FailValue) const |
| Extract the specified attribute from this DIE as a C string. More... | |
| Optional< uint64_t > | getAttributeValueAsAddress (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as an address. More... | |
| Optional< int64_t > | getAttributeValueAsSignedConstant (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as a signed integer. More... | |
| Optional< uint64_t > | getAttributeValueAsUnsignedConstant (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as an unsigned integer. More... | |
| Optional< uint64_t > | getAttributeValueAsReference (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as absolute DIE Offset. More... | |
| Optional< uint64_t > | getAttributeValueAsSectionOffset (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as absolute section offset. More... | |
| DWARFDie | getAttributeValueAsReferencedDie (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as the referenced DIE. More... | |
| Optional< uint64_t > | getRangesBaseAttribute () const |
| Extract the range base attribute from this DIE as absolute section offset. More... | |
| 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) const |
| Retrieves DW_AT_low_pc and DW_AT_high_pc from CU. More... | |
| 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 |
| 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_sepcification or DW_AT_abstract_origin references if necessary. More... | |
| void | getCallerFrame (uint32_t &CallFile, uint32_t &CallLine, uint32_t &CallColumn) 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... | |
| void | getInlinedChainForAddress (const uint64_t Address, SmallVectorImpl< DWARFDie > &InlinedChain) const |
| Get inlined chain for a given address, rooted at the current DIE. More... | |
| iterator | begin () const |
| iterator | end () 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 36 of file DWARFDie.h.
|
inline |
Definition at line 40 of file DWARFDie.h.
Referenced by getFirstChild().
|
inline |
Definition at line 41 of file DWARFDie.h.
Definition at line 268 of file DWARFDie.cpp.
Referenced by getInlinedChainForAddress().
|
inline |
|
inline |
Definition at line 341 of file DWARFDie.h.
References begin(), end(), and llvm::make_range().
| void 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. |
Definition at line 256 of file DWARFDie.cpp.
Referenced by llvm::DWARFUnit::collectAddressRanges().
| void DWARFDie::dump | ( | raw_ostream & | OS, |
| unsigned | recurseDepth, | ||
| unsigned | indent = 0 |
||
| ) | const |
Dump the DIE and all of its attributes to the supplied stream.
| OS | the stream to use for output. |
| recurseDepth | the depth to recurse to when dumping this DIE and its children. |
| indent | the number of characters to indent each line that is output. |
Definition at line 316 of file DWARFDie.cpp.
References llvm::dwarf::syntax::Address, dump(), llvm::format(), llvm::dwarf::syntax::WithColor::get(), llvm::DWARFUnit::getDebugInfoExtractor(), llvm::getOffset(), getSibling(), llvm::dwarf::getTag(), llvm::DataExtractor::getULEB128(), llvm::raw_ostream::indent(), isValid(), llvm::DataExtractor::isValidOffset(), Offset, llvm::dwarf::syntax::Tag, and llvm::dwarf::TagString().
Referenced by dump().
|
inline |
Definition at line 337 of file DWARFDie.h.
Referenced by children().
|
inline |
Get the abbreviation declaration for this DIE.
Definition at line 52 of file DWARFDie.h.
References assert(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), and isValid().
| DWARFAddressRangesVector 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.
Definition at line 237 of file DWARFDie.cpp.
References llvm::DWARFUnit::extractRangeList(), llvm::DWARFDebugRangeList::getAbsoluteRanges(), and llvm::DWARFUnit::getBaseAddress().
Referenced by llvm::DWARFUnit::collectAddressRanges().
| Optional< DWARFFormValue > DWARFDie::getAttributeValue | ( | 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. |
Definition at line 137 of file DWARFDie.cpp.
References llvm::getOffset(), isValid(), and llvm::None.
| Optional< uint64_t > DWARFDie::getAttributeValueAsAddress | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as an address.
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. |
Definition at line 156 of file DWARFDie.cpp.
References llvm::None.
| Optional< uint64_t > DWARFDie::getAttributeValueAsReference | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as absolute DIE Offset.
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. |
Definition at line 177 of file DWARFDie.cpp.
References llvm::None.
| DWARFDie 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. |
Definition at line 192 of file DWARFDie.cpp.
References llvm::DWARFUnit::getDIEForOffset(), llvm::DWARFUnitSectionBase::getUnitForOffset(), and llvm::DWARFUnit::getUnitSection().
| Optional< uint64_t > DWARFDie::getAttributeValueAsSectionOffset | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as absolute section offset.
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. |
Definition at line 184 of file DWARFDie.cpp.
References llvm::None.
| Optional< int64_t > DWARFDie::getAttributeValueAsSignedConstant | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as a signed integer.
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. |
Definition at line 163 of file DWARFDie.cpp.
References llvm::None.
| const char * DWARFDie::getAttributeValueAsString | ( | dwarf::Attribute | Attr, |
| const char * | FailValue | ||
| ) | const |
Extract the specified attribute from this DIE as a C string.
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. |
| FailValue | the value to return if this DIE doesn't have this attribute. |
Definition at line 146 of file DWARFDie.cpp.
References llvm::Optional< T >::getValue(), and llvm::Optional< T >::hasValue().
Referenced by llvm::DWARFTypeUnit::dump(), and llvm::DWARFUnit::getCompilationDir().
| Optional< uint64_t > DWARFDie::getAttributeValueAsUnsignedConstant | ( | dwarf::Attribute | Attr | ) | const |
Extract the specified attribute from this DIE as an unsigned integer.
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. |
Definition at line 170 of file DWARFDie.cpp.
References llvm::None.
Referenced by llvm::DWARFUnit::getDWOId().
| void DWARFDie::getCallerFrame | ( | uint32_t & | CallFile, |
| uint32_t & | CallLine, | ||
| uint32_t & | CallColumn | ||
| ) | 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. |
Definition at line 308 of file DWARFDie.cpp.
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
|
inline |
Definition at line 45 of file DWARFDie.h.
Referenced by llvm::DWARFUnit::getDIEIndex(), and llvm::operator==().
|
inline |
Definition at line 46 of file DWARFDie.h.
Referenced by llvm::operator==().
|
inline |
Get the first child of this DIE object.
Definition at line 103 of file DWARFDie.h.
References DWARFDie(), llvm::DWARFDebugInfoEntry::hasChildren(), and isValid().
Referenced by begin(), and getInlinedChainForAddress().
| Optional< uint64_t > 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. |
Definition at line 210 of file DWARFDie.cpp.
References llvm::dwarf::syntax::Address, llvm::None, and Offset.
| void DWARFDie::getInlinedChainForAddress | ( | const uint64_t | Address, |
| SmallVectorImpl< DWARFDie > & | InlinedChain | ||
| ) | const |
Get inlined chain for a given address, rooted at the current DIE.
Returns empty chain if address is not contained in address range of current DIE.
Definition at line 365 of file DWARFDie.cpp.
References addressRangeContainsAddress(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), getFirstChild(), getSibling(), isSubroutineDIE(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::reverse().
Referenced by llvm::DWARFUnit::getInlinedChainForAddress().
| bool DWARFDie::getLowAndHighPC | ( | uint64_t & | LowPC, |
| uint64_t & | HighPC | ||
| ) | const |
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
Returns true if both attributes are present.
Definition at line 224 of file DWARFDie.cpp.
| const char * DWARFDie::getName | ( | DINameKind | Kind | ) | const |
Return the DIE name resolving DW_AT_sepcification or DW_AT_abstract_origin references if necessary.
Returns null if no name is found.
Definition at line 284 of file DWARFDie.cpp.
References getName(), isValid(), llvm::LinkageName, name, and llvm::None.
Referenced by getName().
|
inline |
Get the absolute offset into the debug info or types section.
Definition at line 60 of file DWARFDie.h.
References assert(), llvm::DWARFDebugInfoEntry::getOffset(), and isValid().
| DWARFDie DWARFDie::getParent | ( | ) | const |
Get the parent of this DIE object.
Definition at line 391 of file DWARFDie.cpp.
References llvm::DWARFUnit::getParent(), and isValid().
| Optional< uint64_t > 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.
Definition at line 203 of file DWARFDie.cpp.
| DWARFDie DWARFDie::getSibling | ( | ) | const |
Get the sibling of this DIE object.
Definition at line 397 of file DWARFDie.cpp.
References llvm::DWARFUnit::getSibling(), and isValid().
Referenced by dump(), getInlinedChainForAddress(), and llvm::DWARFDie::iterator::operator++().
| const char * 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.
Definition at line 277 of file DWARFDie.cpp.
References getName().
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
|
inline |
Definition at line 65 of file DWARFDie.h.
References getAbbreviationDeclarationPtr().
|
inline |
Definition at line 72 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 78 of file DWARFDie.h.
References getAbbreviationDeclarationPtr().
| bool DWARFDie::isSubprogramDIE | ( | ) | const |
Returns true if DIE represents a subprogram (not inlined).
Definition at line 127 of file DWARFDie.cpp.
References llvm::dwarf::getTag().
| bool DWARFDie::isSubroutineDIE | ( | ) | const |
Returns true if DIE represents a subprogram or an inlined subroutine.
Definition at line 131 of file DWARFDie.cpp.
References llvm::dwarf::getTag().
Referenced by getInlinedChainForAddress().
|
inline |
Definition at line 43 of file DWARFDie.h.
Referenced by getAbbreviationDeclarationPtr(), getFirstChild(), getOffset(), hasChildren(), operator bool(), and llvm::DWARFDie::iterator::operator bool().
|
inlineexplicit |
Definition at line 44 of file DWARFDie.h.
References isValid().
1.8.6