Package ghidra.app.util.bin.format.dwarf
Class DWARFUnitHeader
java.lang.Object
ghidra.app.util.bin.format.dwarf.DWARFUnitHeader
- Direct Known Subclasses:
DWARFCompilationUnit
The base class for a set of headers that share a common field layout.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DWARFProgram
Reference to the owningDWARFProgram
.protected final short
Version number, as read from the header.protected final long
Offset in the section of the end of this header.protected final int
size of integers, 4=int32 or 8=int64protected final long
Offset in the section of this headerprotected final int
Sequential number of this unit -
Constructor Summary
ModifierConstructorDescriptionprotected
DWARFUnitHeader
(DWARFProgram dprog, long startOffset, long endOffset, int intSize, short version, int unitNumber) protected
DWARFUnitHeader
(DWARFUnitHeader other) -
Method Summary
Modifier and TypeMethodDescriptionshort
long
Returns the byte offset to the end of this unit.int
Returns either 4 (for DWARF_32) or 8 (for DWARF_64) depending on the current unit formatlong
Returns the byte offset to the start of this unit.int
Return the ordinal number of this unitstatic DWARFUnitHeader
read
(DWARFProgram dprog, BinaryReader reader, BinaryReader abbrReader, int unitNumber, TaskMonitor monitor) Reads the initial fields found in a unit header.
-
Field Details
-
dprog
Reference to the owningDWARFProgram
. -
startOffset
protected final long startOffsetOffset in the section of this header -
endOffset
protected final long endOffsetOffset in the section of the end of this header. (exclusive) -
intSize
protected final int intSizesize of integers, 4=int32 or 8=int64 -
dwarfVersion
protected final short dwarfVersionVersion number, as read from the header. Note: Some header types use version numbers that do not match the general dwarfVersion. -
unitNumber
protected final int unitNumberSequential number of this unit
-
-
Constructor Details
-
DWARFUnitHeader
-
DWARFUnitHeader
protected DWARFUnitHeader(DWARFProgram dprog, long startOffset, long endOffset, int intSize, short version, int unitNumber)
-
-
Method Details
-
read
public static DWARFUnitHeader read(DWARFProgram dprog, BinaryReader reader, BinaryReader abbrReader, int unitNumber, TaskMonitor monitor) throws DWARFException, IOException, CancelledException Reads the initial fields found in a unit header.- Parameters:
dprog
-DWARFProgram
reader
-BinaryReader
streamabbrReader
-BinaryReader
.debug_abbr streamunitNumber
- ordinal of this itemmonitor
-TaskMonitor
- Returns:
- a unit header (only comp units for now), or null if at end-of-list
- Throws:
DWARFException
- if invalid dwarf dataIOException
- if error reading dataCancelledException
- if cancelled
-
getProgram
-
getDWARFVersion
public short getDWARFVersion() -
getStartOffset
public long getStartOffset()Returns the byte offset to the start of this unit.- Returns:
- the byte offset to the start of this unit
-
getEndOffset
public long getEndOffset()Returns the byte offset to the end of this unit.- Returns:
- the byte offset to the end of this unit
-
getIntSize
public int getIntSize()Returns either 4 (for DWARF_32) or 8 (for DWARF_64) depending on the current unit format- Returns:
- size of ints in this unit (4 or 8)
-
getUnitNumber
public int getUnitNumber()Return the ordinal number of this unit- Returns:
- ordinal of this unit
-