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
ConstructorsConstructorDescriptionDebugInfoEntry(DWARFCompilationUnit cu, long offset, int dieIndex, DWARFAbbreviation abbreviation, int[] attrOffsets) Creates a DIE. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfindAttribute(DWARFAttribute attributeId) Searches the list of attributes for a specific attribute, by id.Get the abbreviation of this DIE.intReturns 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.intgetDepth()intgetIndex()Returns the index of this DIE in the entire dwarf program.longGet the offset of this DIE from the beginning of the debug_info section.Get the parent DIE of this DIE.getTag()Get the DWARFTag value of this DIE.inthashCode()booleanCheck to see if the DIE is a terminator.static DebugInfoEntryread(BinaryReader reader, DWARFCompilationUnit cu, int dieIndex) Read a DIE record.voidsetAttributeValue(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-BinaryReaderpositioned 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
-
getCompilationUnit
-
getProgram
-
getDepth
public int getDepth() -
hashCode
public int hashCode() -
equals
-
toString
-