Class DWARFUnitHeader

java.lang.Object
ghidra.app.util.bin.format.dwarf.DWARFUnitHeader
Direct Known Subclasses:
DWARFCompilationUnit

public class DWARFUnitHeader extends Object
The base class for a set of headers that share a common field layout.
  • Field Details

    • dprog

      protected final DWARFProgram dprog
      Reference to the owning DWARFProgram.
    • startOffset

      protected final long startOffset
      Offset in the section of this header
    • endOffset

      protected final long endOffset
      Offset in the section of the end of this header. (exclusive)
    • intSize

      protected final int intSize
      size of integers, 4=int32 or 8=int64
    • dwarfVersion

      protected final short dwarfVersion
      Version number, as read from the header. Note: Some header types use version numbers that do not match the general dwarfVersion.
    • unitNumber

      protected final int unitNumber
      Sequential number of this unit
  • Constructor Details

    • DWARFUnitHeader

      protected DWARFUnitHeader(DWARFUnitHeader other)
    • 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 stream
      abbrReader - BinaryReader .debug_abbr stream
      unitNumber - ordinal of this item
      monitor - TaskMonitor
      Returns:
      a unit header (only comp units for now), or null if at end-of-list
      Throws:
      DWARFException - if invalid dwarf data
      IOException - if error reading data
      CancelledException - if cancelled
    • getProgram

      public DWARFProgram 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