class DWARFDie
Declaration
class DWARFDie { /* full declaration omitted */ };
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:43
Method Overview
- public DWARFDie(llvm::DWARFUnit * Unit, const llvm::DWARFDebugInfoEntry * D)
- public DWARFDie()
- public bool addressRangeContainsAddress(const uint64_t Address) const
- public iterator_range<llvm::DWARFDie::attribute_iterator> attributes() const
- public llvm::DWARFDie::iterator begin() const
- public iterator_range<llvm::DWARFDie::iterator> children() const
- public void collectChildrenAddressRanges(llvm::DWARFAddressRangesVector & Ranges) const
- public void dump() const
- public void dump(llvm::raw_ostream & OS, unsigned int indent = 0, llvm::DIDumpOptions DumpOpts = llvm::DIDumpOptions()) const
- public llvm::DWARFDie::iterator end() const
- public Optional<llvm::DWARFFormValue> find(ArrayRef<dwarf::Attribute> Attrs) const
- public Optional<llvm::DWARFFormValue> find(dwarf::Attribute Attr) const
- public Optional<llvm::DWARFFormValue> findRecursively(ArrayRef<dwarf::Attribute> Attrs) const
- public const llvm::DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
- public Expected<llvm::DWARFAddressRangesVector> getAddressRanges() const
- public llvm::DWARFDie getAttributeValueAsReferencedDie(const llvm::DWARFFormValue & V) const
- public llvm::DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const
- public void getCallerFrame(uint32_t & CallFile, uint32_t & CallLine, uint32_t & CallColumn, uint32_t & CallDiscriminator) const
- public const llvm::DWARFDebugInfoEntry * getDebugInfoEntry() const
- public uint64_t getDeclLine() const
- public llvm::DWARFUnit * getDwarfUnit() const
- public llvm::DWARFDie getFirstChild() const
- public Optional<uint64_t> getHighPC(uint64_t LowPC) const
- public llvm::DWARFDie getLastChild() const
- public Optional<uint64_t> getLocBaseAttribute() const
- public Expected<llvm::DWARFLocationExpressionsVector> getLocations(dwarf::Attribute Attr) const
- public bool getLowAndHighPC(uint64_t & LowPC, uint64_t & HighPC, uint64_t & SectionIndex) const
- public const char * getName(llvm::DINameKind Kind) const
- public uint64_t getOffset() const
- public llvm::DWARFDie getParent() const
- public llvm::DWARFDie getPreviousSibling() const
- public Optional<uint64_t> getRangesBaseAttribute() const
- public llvm::DWARFDie getSibling() const
- public const char * getSubroutineName(llvm::DINameKind Kind) const
- public dwarf::Tag getTag() const
- public bool hasChildren() const
- public bool isNULL() const
- public bool isSubprogramDIE() const
- public bool isSubroutineDIE() const
- public bool isValid() const
- public bool operator bool() const
- public std::reverse_iterator<iterator> rbegin() const
- public std::reverse_iterator<iterator> rend() const
Methods
¶DWARFDie(llvm::DWARFUnit* Unit,
const llvm::DWARFDebugInfoEntry* D)
DWARFDie(llvm::DWARFUnit* Unit,
const llvm::DWARFDebugInfoEntry* D)
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:49
Parameters
- llvm::DWARFUnit* Unit
- const llvm::DWARFDebugInfoEntry* D
¶DWARFDie()
DWARFDie()
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:48
¶bool addressRangeContainsAddress(
const uint64_t Address) const
bool addressRangeContainsAddress(
const uint64_t Address) const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:233
Parameters
- const uint64_t Address
¶iterator_range<llvm::DWARFDie::attribute_iterator>
attributes() const
iterator_range<llvm::DWARFDie::attribute_iterator>
attributes() const
Description
Get an iterator range to all attributes in the current DIE only.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:274
Returns
an iterator range for the attributes of the current DIE.
¶llvm::DWARFDie::iterator begin() const
llvm::DWARFDie::iterator begin() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:278
¶iterator_range<llvm::DWARFDie::iterator>
children() const
iterator_range<llvm::DWARFDie::iterator>
children() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:284
¶void collectChildrenAddressRanges(
llvm::DWARFAddressRangesVector& Ranges) const
void collectChildrenAddressRanges(
llvm::DWARFAddressRangesVector& Ranges) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:231
Parameters
- llvm::DWARFAddressRangesVector& Ranges
- the addres range vector to fill in.
¶void dump() const
void dump() const
Description
Convenience zero-argument overload for debugging.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:131
¶void dump(llvm::raw_ostream& OS,
unsigned int indent = 0,
llvm::DIDumpOptions DumpOpts =
llvm::DIDumpOptions()) const
void dump(llvm::raw_ostream& OS,
unsigned int indent = 0,
llvm::DIDumpOptions DumpOpts =
llvm::DIDumpOptions()) const
Description
Dump the DIE and all of its attributes to the supplied stream.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:127
Parameters
- llvm::raw_ostream& OS
- the stream to use for output.
- unsigned int indent = 0
- the number of characters to indent each line that is output.
- llvm::DIDumpOptions DumpOpts = llvm::DIDumpOptions()
¶llvm::DWARFDie::iterator end() const
llvm::DWARFDie::iterator end() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:279
¶Optional<llvm::DWARFFormValue> find(
ArrayRef<dwarf::Attribute> Attrs) const
Optional<llvm::DWARFFormValue> find(
ArrayRef<dwarf::Attribute> Attrs) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:155
Parameters
- ArrayRef<dwarf::Attribute> 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 None if none of the attributes in Attrs exist in this DIE.
¶Optional<llvm::DWARFFormValue> find(
dwarf::Attribute Attr) const
Optional<llvm::DWARFFormValue> find(
dwarf::Attribute Attr) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:142
Parameters
- dwarf::Attribute Attr
- the attribute to extract.
Returns
an optional DWARFFormValue that will have the form value if the attribute was successfully extracted.
¶Optional<llvm::DWARFFormValue> findRecursively(
ArrayRef<dwarf::Attribute> Attrs) const
Optional<llvm::DWARFFormValue> findRecursively(
ArrayRef<dwarf::Attribute> Attrs) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:167
Parameters
- ArrayRef<dwarf::Attribute> 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 None if none of the attributes in Attrs exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin DIEs.
¶const llvm::DWARFAbbreviationDeclaration*
getAbbreviationDeclarationPtr() const
const llvm::DWARFAbbreviationDeclaration*
getAbbreviationDeclarationPtr() const
Description
Get the abbreviation declaration for this DIE.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:59
Returns
the abbreviation declaration or NULL for null tags.
¶Expected<llvm::DWARFAddressRangesVector>
getAddressRanges() const
Expected<llvm::DWARFAddressRangesVector>
getAddressRanges() const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:221
Returns
a address range vector that might be empty if no address range information is available.
¶llvm::DWARFDie getAttributeValueAsReferencedDie(
const llvm::DWARFFormValue& V) const
llvm::DWARFDie getAttributeValueAsReferencedDie(
const llvm::DWARFFormValue& V) const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:183
Parameters
- const llvm::DWARFFormValue& V
¶llvm::DWARFDie getAttributeValueAsReferencedDie(
dwarf::Attribute Attr) const
llvm::DWARFDie getAttributeValueAsReferencedDie(
dwarf::Attribute Attr) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:182
Parameters
- dwarf::Attribute Attr
- the attribute to extract.
Returns
a valid DWARFDie instance if the attribute exists, or an invalid DWARFDie object if it doesn't.
¶void getCallerFrame(
uint32_t& CallFile,
uint32_t& CallLine,
uint32_t& CallColumn,
uint32_t& CallDiscriminator) const
void getCallerFrame(
uint32_t& CallFile,
uint32_t& CallLine,
uint32_t& CallColumn,
uint32_t& CallDiscriminator) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:266
Parameters
- uint32_t& CallFile
- filled in with non-zero if successful, zero if there is no DW_AT_call_file attribute in this DIE.
- uint32_t& CallLine
- filled in with non-zero if successful, zero if there is no DW_AT_call_line attribute in this DIE.
- uint32_t& CallColumn
- filled in with non-zero if successful, zero if there is no DW_AT_call_column attribute in this DIE.
- uint32_t& CallDiscriminator
- filled in with non-zero if successful, zero if there is no DW_AT_GNU_discriminator attribute in this DIE.
¶const llvm::DWARFDebugInfoEntry*
getDebugInfoEntry() const
const llvm::DWARFDebugInfoEntry*
getDebugInfoEntry() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:53
¶uint64_t getDeclLine() const
uint64_t getDeclLine() const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:252
¶llvm::DWARFUnit* getDwarfUnit() const
llvm::DWARFUnit* getDwarfUnit() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:54
¶llvm::DWARFDie getFirstChild() const
llvm::DWARFDie getFirstChild() const
Description
Get the first child of this DIE object.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:115
Returns
a valid DWARFDie instance if this object has children or an invalid DWARFDie instance if it doesn't.
¶Optional<uint64_t> getHighPC(uint64_t LowPC) const
Optional<uint64_t> getHighPC(uint64_t LowPC) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:204
Parameters
- uint64_t LowPC
- the low PC that might be needed to calculate the high PC.
Returns
an optional address value for the attribute.
¶llvm::DWARFDie getLastChild() const
llvm::DWARFDie getLastChild() const
Description
Get the last child of this DIE object.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:121
Returns
a valid null DWARFDie instance if this object has children or an invalid DWARFDie instance if it doesn't.
¶Optional<uint64_t> getLocBaseAttribute() const
Optional<uint64_t> getLocBaseAttribute() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:192
¶Expected<llvm::DWARFLocationExpressionsVector>
getLocations(dwarf::Attribute Attr) const
Expected<llvm::DWARFLocationExpressionsVector>
getLocations(dwarf::Attribute Attr) const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:236
Parameters
- dwarf::Attribute Attr
¶bool getLowAndHighPC(uint64_t& LowPC,
uint64_t& HighPC,
uint64_t& SectionIndex) const
bool getLowAndHighPC(uint64_t& LowPC,
uint64_t& HighPC,
uint64_t& SectionIndex) const
Description
Retrieves DW_AT_low_pc and DW_AT_high_pc from CU. Returns true if both attributes are present.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:208
Parameters
- uint64_t& LowPC
- uint64_t& HighPC
- uint64_t& SectionIndex
¶const char* getName(llvm::DINameKind Kind) const
const char* getName(llvm::DINameKind Kind) const
Description
Return the DIE name resolving DW_AT_sepcification or DW_AT_abstract_origin references if necessary. Returns null if no name is found.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:246
Parameters
- llvm::DINameKind Kind
¶uint64_t getOffset() const
uint64_t getOffset() const
Description
Get the absolute offset into the debug info or types section.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:67
Returns
the DIE offset or -1U if invalid.
¶llvm::DWARFDie getParent() const
llvm::DWARFDie getParent() const
Description
Get the parent of this DIE object.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:97
Returns
a valid DWARFDie instance if this object has a parent or an invalid DWARFDie instance if it doesn't.
¶llvm::DWARFDie getPreviousSibling() const
llvm::DWARFDie getPreviousSibling() const
Description
Get the previous sibling of this DIE object.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:109
Returns
a valid DWARFDie instance if this object has a sibling or an invalid DWARFDie instance if it doesn't.
¶Optional<uint64_t> getRangesBaseAttribute() const
Optional<uint64_t> getRangesBaseAttribute() const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:191
Returns
anm optional absolute section offset value for the attribute.
¶llvm::DWARFDie getSibling() const
llvm::DWARFDie getSibling() const
Description
Get the sibling of this DIE object.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:103
Returns
a valid DWARFDie instance if this object has a sibling or an invalid DWARFDie instance if it doesn't.
¶const char* getSubroutineName(
llvm::DINameKind Kind) const
const char* getSubroutineName(
llvm::DINameKind Kind) const
Description
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.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:242
Parameters
- llvm::DINameKind Kind
¶dwarf::Tag getTag() const
dwarf::Tag getTag() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:72
¶bool hasChildren() const
bool hasChildren() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:79
¶bool isNULL() const
bool isNULL() const
Description
Returns true for a valid DIE that terminates a sibling chain.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:85
¶bool isSubprogramDIE() const
bool isSubprogramDIE() const
Description
Returns true if DIE represents a subprogram (not inlined).
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:88
¶bool isSubroutineDIE() const
bool isSubroutineDIE() const
Description
Returns true if DIE represents a subprogram or an inlined subroutine.
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:91
¶bool isValid() const
bool isValid() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:51
¶bool operator bool() const
bool operator bool() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:52
¶std::reverse_iterator<iterator> rbegin() const
std::reverse_iterator<iterator> rbegin() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:281
¶std::reverse_iterator<iterator> rend() const
std::reverse_iterator<iterator> rend() const
Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h:282