Class DWARFNumericAttribute

java.lang.Object
ghidra.app.util.bin.format.dwarf.attribs.DWARFAttributeValue
ghidra.app.util.bin.format.dwarf.attribs.DWARFNumericAttribute
Direct Known Subclasses:
DWARFIndirectAttribute

public class DWARFNumericAttribute extends DWARFAttributeValue
DWARF numeric attribute.
  • Constructor Details

    • DWARFNumericAttribute

      public DWARFNumericAttribute(long value, DWARFAttributeDef<?> def)
      Creates a new numeric value, using 64 bits and marked as signed
      Parameters:
      value - long 64 bit value
      def - attribute id and form of this value
    • DWARFNumericAttribute

      public DWARFNumericAttribute(int bitLength, long value, boolean signed, DWARFAttributeDef<?> def)
      Creates a new numeric value, using the specific bitLength and value.
      Parameters:
      bitLength - number of bits, valid values are 1..64, or 0 if value is also 0
      value - value of the scalar, any bits that are set above bitLength will be ignored
      signed - true for a signed value, false for an unsigned value.
      def - attribute id and form of this value
    • DWARFNumericAttribute

      public DWARFNumericAttribute(int bitLength, long value, boolean signed, boolean ambiguous, DWARFAttributeDef<?> def)
      Creates a new numeric value, using the specific bitLength and value.
      Parameters:
      bitLength - number of bits, valid values are 1..64, or 0 if value is also 0
      value - value of the scalar, any bits that are set above bitLength will be ignored
      signed - true for a signed value, false for an unsigned value.
      ambiguous - true for value with ambiguous signedness (signed parameter should not be trusted), false for value where the signed parameter is known to be correct
      def - attribute id and form of this value
  • Method Details

    • isAmbiguousSignedness

      public boolean isAmbiguousSignedness()
      Returns boolean flag, if true this value's signedness is up to the user of the value, if false the signedness was determined when the value was constructed.
      Returns:
      boolean flag, if true this value's signedness is up to the user of the value, if false the signedness was determined when the value was constructed
    • getValueWithSignednessHint

      public long getValueWithSignednessHint(boolean signednessHint)
      Returns the value, forcing the signedness of ambiguous values using the specified hint.
      Parameters:
      signednessHint - true to default to a signed value, false to default to an unsigned value
      Returns:
      the value, forcing the signedness of ambiguous values using the specified hint
    • isHighbitSet

      public boolean isHighbitSet()
    • getValue

      public long getValue()
    • getUnsignedValue

      public long getUnsignedValue()
    • getUnsignedIntExact

      public int getUnsignedIntExact() throws IOException
      Throws:
      IOException
    • toElementLocationString

      public String toElementLocationString(String elementType, String sectionName, int index, long offset, int ver)
    • toString

      public String toString(DWARFCompilationUnit cu)
      Overrides:
      toString in class DWARFAttributeValue
    • toString

      public String toString()
      Overrides:
      toString in class Object