Package ghidra.app.util.bin.format.dwarf
Class DebugInfoEntry
java.lang.Object
ghidra.app.util.bin.format.dwarf.DebugInfoEntry
A DWARF Debug Info Entry is a collection of
attributes
in a hierarchical structure (see getParent()
, getChildren()
).
This class is a lower-level class and DIEAggregate
should be used instead in most
cases when examining information from the DWARF system.
-
Constructor Summary
ConstructorDescriptionDebugInfoEntry
(DWARFCompilationUnit cu, long offset, int dieIndex, DWARFAbbreviation abbreviation, int[] attrOffsets) Creates a DIE. -
Method Summary
Modifier and TypeMethodDescriptionboolean
findAttribute
(DWARFAttribute attributeId) Searches the list of attributes for a specific attribute, by id.Get the abbreviation of this DIE.int
Returns the number of attributes in this DIE.getAttributeValue
(int attribIndex) Returns the indexed attribute value.Return a list of the child DIE's.getChildren
(DWARFTag childTag) Return a list of children that are of a specific DWARF type.int
getDepth()
int
getIndex()
Returns the index of this DIE in the entire dwarf program.long
Get the offset of this DIE from the beginning of the debug_info section.Get the parent DIE of this DIE.int
Returns the ordinal position of this DIE record in its parent's list of children.getTag()
Get the DWARFTag value of this DIE.int
hashCode()
boolean
Check to see if the DIE is a terminator.static DebugInfoEntry
read
(BinaryReader reader, DWARFCompilationUnit cu, int dieIndex) Read a DIE record.void
setAttributeValue
(int index, DWARFAttributeValue attrVal) toString()
-
Constructor Details
-
DebugInfoEntry
public DebugInfoEntry(DWARFCompilationUnit cu, long offset, int dieIndex, DWARFAbbreviation abbreviation, int[] attrOffsets) Creates a DIE.- Parameters:
cu
- compunit containing the DIEoffset
- offset of the DIEdieIndex
- index of the DIEabbreviation
- that defines the schema of this DIE recordattrOffsets
- offset (from the die offset) of each attribute value
-
-
Method Details
-
read
public static DebugInfoEntry read(BinaryReader reader, DWARFCompilationUnit cu, int dieIndex) throws IOException Read a DIE record.- Parameters:
reader
-BinaryReader
positioned at the start of a DIE recordcu
- the compunit that contains the DIEdieIndex
- the index of the DIE- Returns:
- new DIE instance
- Throws:
IOException
- if error reading data, or bad DWARF
-
getIndex
public int getIndex()Returns the index of this DIE in the entire dwarf program.- Returns:
- index of this DIE
-
getChildren
Return a list of the child DIE's.- Returns:
- list of child DIE's
-
getChildren
Return a list of children that are of a specific DWARF type.- Parameters:
childTag
- DIE tag used to filter the child DIEs- Returns:
- list of matching child DIE records
-
getParent
Get the parent DIE of this DIE.- Returns:
- the parent DIE, or null if this DIE is the root of the compilation unit
-
getOffset
public long getOffset()Get the offset of this DIE from the beginning of the debug_info section.- Returns:
- the offset of this DIE from the beginning of the debug_info section
-
getTag
Get the DWARFTag value of this DIE.- Returns:
- the DWARFTag value of this DIE
-
getAttributeCount
public int getAttributeCount()Returns the number of attributes in this DIE.- Returns:
- number of attribute values in this DIE
-
getAttributeValue
Returns the indexed attribute value.- Parameters:
attribIndex
- index (0..count)- Returns:
DWARFAttributeValue
- Throws:
IOException
- if error reading the value
-
setAttributeValue
-
findAttribute
Searches the list of attributes for a specific attribute, by id.- Parameters:
attributeId
-DWARFAttribute
- Returns:
DWARFAttributeValue
, or null if not found
-
getAbbreviation
Get the abbreviation of this DIE.- Returns:
- the abbreviation of this DIE
-
isTerminator
public boolean isTerminator()Check to see if the DIE is a terminator.- Returns:
- true if the DIE is a terminator and false otherwise
-
getPositionInParent
public int getPositionInParent()Returns the ordinal position of this DIE record in its parent's list of children.- Returns:
- index of ourself in our parent, or -1 if root DIE
-
getCompilationUnit
-
getProgram
-
getDepth
public int getDepth() -
hashCode
public int hashCode() -
equals
-
toString
-