Class UnionFacetSymbol

java.lang.Object
ghidra.program.model.pcode.HighSymbol
ghidra.program.model.pcode.UnionFacetSymbol

public class UnionFacetSymbol extends HighSymbol
A specialized HighSymbol that directs the decompiler to use a specific field of a union, when interpreting a particular PcodeOp that accesses a Varnode whose data-type involves the union. The symbol is stored as a dynamic variable annotation. The data-type must either be the union itself or a pointer to the union. The firstUseOffset and dynamic hash identify the particular PcodeOp and Varnode affected. The field number is the ordinal of the desired field (DataTypeComponent) within the union. It is currently stored by encoding it in the symbol name.
  • Field Details

    • BASENAME

      public static String BASENAME
  • Constructor Details

  • Method Details

    • encode

      public void encode(Encoder encoder) throws IOException
      Description copied from class: HighSymbol
      Encode the symbol description as an element to the stream. This does NOT save the mappings.
      Overrides:
      encode in class HighSymbol
      Parameters:
      encoder - is the stream encoder
      Throws:
      IOException - for errors in the underlying stream
    • buildSymbolName

      public static String buildSymbolName(int fldNum, Address addr)
      Generate an automatic symbol name, given a field number and address
      Parameters:
      fldNum - is the field number
      addr - is the Address
      Returns:
      the name
    • extractFieldNumber

      public static int extractFieldNumber(String nm)
      The actual field number is encoded in the symbol name
      Parameters:
      nm - is the symbol name
      Returns:
      the field number or -1 if we cannot parse
    • isUnionType

      public static boolean isUnionType(DataType dt)
      Return true if the given data-type is either a union or a pointer to a union and is suitable for being the data-type of UnionFacetSymbol
      Parameters:
      dt - is the given data-type
      Returns:
      true if the data-type is a union or a pointer to a union