LLVM: llvm::DWARFDie Class Reference (original) (raw)
Utility class that carries the DWARF compile/type unit and the debug info entry in an object. More...
#include "[llvm/DebugInfo/DWARF/DWARFDie.h](DWARFDie%5F8h%5Fsource.html)"
| 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. | |
| uint64_t | getOffset () const |
| Get the absolute offset into the debug info or types section. | |
| dwarf::Tag | getTag () const |
| bool | hasChildren () const |
| bool | isNULL () const |
| Returns true for a valid DIE that terminates a sibling chain. | |
| LLVM_ABI bool | isSubprogramDIE () const |
| Returns true if DIE represents a subprogram (not inlined). | |
| LLVM_ABI bool | isSubroutineDIE () const |
| Returns true if DIE represents a subprogram or an inlined subroutine. | |
| LLVM_ABI DWARFDie | getParent () const |
| Get the parent of this DIE object. | |
| LLVM_ABI DWARFDie | getSibling () const |
| Get the sibling of this DIE object. | |
| LLVM_ABI DWARFDie | getPreviousSibling () const |
| Get the previous sibling of this DIE object. | |
| LLVM_ABI DWARFDie | getFirstChild () const |
| Get the first child of this DIE object. | |
| LLVM_ABI DWARFDie | getLastChild () const |
| Get the last child of this DIE object. | |
| LLVM_ABI void | dump (raw_ostream &OS, unsigned indent=0, DIDumpOptions DumpOpts=DIDumpOptions()) const |
| Dump the DIE and all of its attributes to the supplied stream. | |
| LLVM_ABI LLVM_DUMP_METHOD void | dump () const |
| Convenience zero-argument overload for debugging. | |
| LLVM_ABI std::optional< DWARFFormValue > | find (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE. | |
| LLVM_ABI std::optional< DWARFFormValue > | find (ArrayRef< dwarf::Attribute > Attrs) const |
| Extract the first value of any attribute in Attrs from this DIE. | |
| LLVM_ABI std::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. | |
| LLVM_ABI DWARFDie | getAttributeValueAsReferencedDie (dwarf::Attribute Attr) const |
| Extract the specified attribute from this DIE as the referenced DIE. | |
| LLVM_ABI DWARFDie | getAttributeValueAsReferencedDie (const DWARFFormValue &V) const |
| LLVM_ABI DWARFDie | resolveTypeUnitReference () const |
| LLVM_ABI DWARFDie | resolveReferencedType (dwarf::Attribute Attr) const |
| LLVM_ABI DWARFDie | resolveReferencedType (const DWARFFormValue &V) const |
| LLVM_ABI std::optional< uint64_t > | getRangesBaseAttribute () const |
| Extract the range base attribute from this DIE as absolute section offset. | |
| LLVM_ABI std::optional< uint64_t > | getLocBaseAttribute () const |
| LLVM_ABI std::optional< uint64_t > | getHighPC (uint64_t LowPC) const |
| Get the DW_AT_high_pc attribute value as an address. | |
| LLVM_ABI bool | getLowAndHighPC (uint64_t &LowPC, uint64_t &HighPC, uint64_t &SectionIndex) const |
| Retrieves DW_AT_low_pc and DW_AT_high_pc from CU. | |
| LLVM_ABI Expected< DWARFAddressRangesVector > | getAddressRanges () const |
| Get the address ranges for this DIE. | |
| LLVM_ABI bool | addressRangeContainsAddress (const uint64_t Address) const |
| LLVM_ABI std::optional< uint64_t > | getLanguage () const |
| LLVM_ABI Expected< DWARFLocationExpressionsVector > | getLocations (dwarf::Attribute Attr) const |
| LLVM_ABI 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). | |
| LLVM_ABI const char * | getName (DINameKind Kind) const |
| Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. | |
| LLVM_ABI void | getFullName (raw_string_ostream &, std::string *OriginalFullName=nullptr) const |
| LLVM_ABI const char * | getShortName () const |
| Return the DIE short name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. | |
| LLVM_ABI const char * | getLinkageName () const |
| Return the DIE linkage name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary. | |
| LLVM_ABI uint64_t | getDeclLine () const |
| Returns the declaration line (start line) for a DIE, assuming it specifies a subprogram. | |
| LLVM_ABI std::string | getDeclFile (DILineInfoSpecifier::FileLineInfoKind Kind) const |
| LLVM_ABI 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). | |
| LLVM_ABI iterator_range< attribute_iterator > | attributes () const |
| Get an iterator range to all attributes in the current DIE only. | |
| LLVM_ABI std::optional< uint64_t > | getTypeSize (uint64_t PointerSize) |
| Gets the type size (in bytes) for this DIE. | |
| 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.
◆ DWARFFormValue
◆ DWARFDie() [1/2]
| llvm::DWARFDie::DWARFDie ( ) | default |
|---|
Referenced by llvm::DWARFDie::attribute_iterator::attribute_iterator(), llvm::DWARFDie::attribute_iterator::attribute_iterator(), dump(), findRecursively(), getAttributeValueAsReferencedDie(), getAttributeValueAsReferencedDie(), getFirstChild(), getLastChild(), getParent(), getPreviousSibling(), getSibling(), llvm::DWARFDie::iterator::iterator(), llvm::DWARFDie::iterator::operator*(), resolveReferencedType(), resolveReferencedType(), and resolveTypeUnitReference().
◆ DWARFDie() [2/2]
◆ addressRangeContainsAddress()
◆ attributes()
Get an iterator range to all attributes in the current DIE only.
Returns
an iterator range for the attributes of the current DIE.
Definition at line 754 of file DWARFDie.cpp.
References llvm::make_range().
Referenced by dump().
◆ begin()
◆ children()
◆ dump() [1/2]
◆ dump() [2/2]
Dump the DIE and all of its attributes to the supplied stream.
Parameters
| OS | the stream to use for output. |
|---|---|
| indent | the number of characters to indent each line that is output. |
Definition at line 662 of file DWARFDie.cpp.
References llvm::Address, attributes(), llvm::DIDumpOptions::ChildRecurseDepth, dump(), dumpAttribute(), dumpParentChain(), DWARFDie(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::DIDumpOptions::FilterChildTag, llvm::format(), llvm::formatv(), llvm::WithColor::get(), getAbbreviationDeclarationPtr(), getFirstChild(), getOffset(), getParent(), getSibling(), getTag(), llvm::DataExtractor::getULEB128(), llvm::raw_ostream::indent(), llvm::is_contained(), isValid(), llvm::DataExtractor::isValidOffset(), llvm::Offset, llvm::DIDumpOptions::ShowAddresses, llvm::DIDumpOptions::ShowChildren, llvm::DIDumpOptions::ShowParents, llvm::Tag, and llvm::DIDumpOptions::Verbose.
Referenced by convertFunctionLineTable(), llvm::DWARFCompileUnit::dump(), llvm::DWARFContext::dump(), dump(), and dumpParentChain().
◆ end()
◆ find() [1/2]
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.
Parameters
| Attrs | an array of DWARF attribute to look for. |
|---|
Returns
an optional that has a valid DWARFFormValue for the first matching attribute in Attrs, or std::nullopt if none of the attributes in Attrs exist in this DIE.
Definition at line 327 of file DWARFDie.cpp.
References getAbbreviationDeclarationPtr(), getOffset(), and isValid().
◆ find() [2/2]
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.
Parameters
| Attr | the attribute to extract. |
|---|
Returns
an optional DWARFFormValue that will have the form value if the attribute was successfully extracted.
Definition at line 317 of file DWARFDie.cpp.
References getAbbreviationDeclarationPtr(), getOffset(), and isValid().
Referenced by llvm::analyzeContextInfo(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitDebugMacro(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), convertFunctionLineTable(), llvm::logicalview::LVDWARFReader::createScopes(), llvm::gsym::CUInfo::CUInfo(), getAddressRanges(), getApplePropertyName(), getAttributeValueAsReferencedDie(), llvm::DWARFUnit::getBaseAddress(), getCallerFrame(), getDwoId(), llvm::getDwoId(), getHighPC(), llvm::DWARFContext::getInliningInfoForAddress(), getLocations(), getLocBaseAttribute(), getLowAndHighPC(), getPCMFile(), llvm::getPCMFile(), getRangesBaseAttribute(), getTypeSizeImpl(), hashFullyQualifiedName(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::isClangModuleRef(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), parseInlineInfo(), prettyLanguageVersionString(), resolveTypeUnitReference(), llvm::dwarf_linker::parallel::AcceleratorRecordsSaver::save(), llvm::DWARFUnit::tryExtractDIEsIfNeeded(), and llvm::updatePruning().
◆ findRecursively()
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.
Parameters
| Attrs | an array of DWARF attribute to look for. |
|---|
Returns
an optional that has a valid DWARFFormValue for the first matching attribute in Attrs, or std::nullopt if none of the attributes in Attrs exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin DIEs.
Definition at line 341 of file DWARFDie.cpp.
References D(), DWARFDie(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SmallSet< T, N, C >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by convertFunctionLineTable(), getDeclFile(), getDeclLine(), getLinkageName(), getShortName(), and parseInlineInfo().
◆ getAbbreviationDeclarationPtr()
◆ getAddressRanges()
◆ getAttributeValueAsReferencedDie() [1/2]
◆ getAttributeValueAsReferencedDie() [2/2]
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.
Parameters
| Attr | the attribute to extract. |
|---|
Returns
a valid DWARFDie instance if the attribute exists, or an invalid DWARFDie object if it doesn't.
Definition at line 373 of file DWARFDie.cpp.
References DWARFDie(), F, find(), and getAttributeValueAsReferencedDie().
Referenced by dumpAttribute(), getAttributeValueAsReferencedDie(), GetParentDeclContextDIE(), getTypeSizeImpl(), resolveReferencedType(), resolveReferencedType(), and llvm::DWARFUnit::updateVariableDieMap().
◆ getCallerFrame()
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.
Parameters
| 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. |
Definition at line 569 of file DWARFDie.cpp.
References find(), and llvm::dwarf::toUnsigned().
Referenced by llvm::DWARFContext::getInliningInfoForAddress().
◆ getDebugInfoEntry()
◆ getDeclFile()
◆ getDeclLine()
| uint64_t DWARFDie::getDeclLine | ( | ) | const |
|---|
◆ getDwarfUnit()
| DWARFUnit * llvm::DWARFDie::getDwarfUnit ( ) const | inline |
|---|
◆ getFirstChild()
| DWARFDie DWARFDie::getFirstChild | ( | ) | const |
|---|
◆ getFullName()
| void DWARFDie::getFullName | ( | raw_string_ostream & | OS, |
|---|---|---|---|
| std::string * | OriginalFullName = nullptr ) const |
◆ getHighPC()
◆ getLanguage()
| std::optional< uint64_t > DWARFDie::getLanguage | ( | ) | const |
|---|
◆ getLastChild()
| DWARFDie DWARFDie::getLastChild | ( | ) | const |
|---|
◆ getLinkageName()
| const char * DWARFDie::getLinkageName | ( | ) | const |
|---|
◆ getLocations()
◆ getLocBaseAttribute()
| std::optional< uint64_t > DWARFDie::getLocBaseAttribute | ( | ) | const |
|---|
◆ getLowAndHighPC()
◆ getName()
◆ getOffset()
| uint64_t llvm::DWARFDie::getOffset ( ) const | inline |
|---|
◆ getParent()
◆ getPreviousSibling()
| DWARFDie DWARFDie::getPreviousSibling | ( | ) | const |
|---|
◆ getRangesBaseAttribute()
| std::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.
Returns
anm optional absolute section offset value for the attribute.
Definition at line 414 of file DWARFDie.cpp.
References find(), and llvm::dwarf::toSectionOffset().
◆ getShortName()
| const char * DWARFDie::getShortName | ( | ) | const |
|---|
◆ getSibling()
◆ getSubroutineName()
◆ getTag()
| dwarf::Tag llvm::DWARFDie::getTag ( ) const | inline |
|---|
Definition at line 73 of file DWARFDie.h.
References getAbbreviationDeclarationPtr().
Referenced by llvm::analyzeContextInfo(), dump(), getApplePropertyName(), getFullName(), llvm::DWARFUnit::getInlinedChainForAddress(), GetParentDeclContextDIE(), getTypeSizeImpl(), hashFullyQualifiedName(), hasInlineInfo(), llvm::isODRCanonicalCandidate(), isSubprogramDIE(), isSubroutineDIE(), parseInlineInfo(), llvm::updateChildIncompleteness(), llvm::updatePruning(), llvm::updateRefIncompleteness(), and llvm::DWARFUnit::updateVariableDieMap().
◆ getTypeSize()
◆ hasChildren()
| bool llvm::DWARFDie::hasChildren ( ) const | inline |
|---|
◆ isNULL()
| bool llvm::DWARFDie::isNULL ( ) const | inline |
|---|
◆ isSubprogramDIE()
| bool DWARFDie::isSubprogramDIE | ( | ) | const |
|---|
◆ isSubroutineDIE()
| bool DWARFDie::isSubroutineDIE | ( | ) | const |
|---|
◆ isValid()
| bool llvm::DWARFDie::isValid ( ) const | inline |
|---|
Definition at line 52 of file DWARFDie.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::logicalview::LVDWARFReader::createScopes(), dump(), dumpAttribute(), find(), find(), getAbbreviationDeclarationPtr(), getFirstChild(), getLanguage(), getLastChild(), getLinkageName(), llvm::DWARFContext::getLocalsForAddress(), getName(), getOffset(), getParent(), getPreviousSibling(), getShortName(), getSibling(), hasChildren(), hashFullyQualifiedName(), operator bool(), and llvm::dwarf_linker::parallel::DependencyTracker::verifyKeepChain().
◆ operator bool()
| llvm::DWARFDie::operator bool ( ) const | inlineexplicit |
|---|
◆ rbegin()
◆ rend()
◆ resolveReferencedType() [1/2]
◆ resolveReferencedType() [2/2]
◆ resolveTypeUnitReference()
| DWARFDie DWARFDie::resolveTypeUnitReference | ( | ) | const |
|---|
The documentation for this class was generated from the following files:
- include/llvm/DebugInfo/DWARF/DWARFDie.h
- lib/DebugInfo/DWARF/DWARFDie.cpp