Class DWARFAttributeDef<E extends Enum<E>>

java.lang.Object
ghidra.app.util.bin.format.dwarf.attribs.DWARFAttributeDef<E>
Type Parameters:
E - attribute id enum type
Direct Known Subclasses:
DWARFAttribute.AttrDef, DWARFLineContentType.Def

public class DWARFAttributeDef<E extends Enum<E>> extends Object
Information about a single DWARF attribute, as specified in a abbreviation.

This class handles the case where a specified attribute id is unknown to us (therefore not listed in the attribute enum class), as well as the case where the form is customized with an implicitValue.

Unknown forms are not supported and cause an exception.

  • Field Details

    • attributeId

      protected final E extends Enum<E> attributeId
    • attributeForm

      protected final DWARFForm attributeForm
    • rawAttributeId

      protected final int rawAttributeId
    • implicitValue

      protected final long implicitValue
  • Constructor Details

    • DWARFAttributeDef

      public DWARFAttributeDef(E attributeId, int rawAttributeId, DWARFForm attributeForm, long implicitValue)
  • Method Details

    • read

      public static <E extends Enum<E>> DWARFAttributeDef<E> read(BinaryReader reader, Function<Integer,E> mapper) throws IOException
      Reads a DWARFAttributeDef instance from the reader.

      Returns a null if its a end-of-list marker (which is only used by an attributespec list).

      Type Parameters:
      E - attribute id enum type
      Parameters:
      reader - BinaryReader
      mapper - func that converts an attribute id int into its enum
      Returns:
      DWARFAttributeDef instance, or null if EOL marker was read from the stream
      Throws:
      IOException - if error reading
    • getAttributeId

      public E getAttributeId()
      Get the attribute id of the attribute specification.
      Returns:
      the attribute value
    • getRawAttributeId

      public int getRawAttributeId()
    • getAttributeName

      public String getAttributeName()
    • getRawAttributeIdDescription

      protected String getRawAttributeIdDescription()
    • getAttributeForm

      public DWARFForm getAttributeForm()
      Get the form of the attribute specification.
      Returns:
      the form value
    • isImplicit

      public boolean isImplicit()
    • getImplicitValue

      public long getImplicitValue()
    • withForm

      public DWARFAttributeDef<E> withForm(DWARFForm newForm)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object