Package ghidra.program.model.pcode

# Class HighVariable

java.lang.Object
ghidra.program.model.pcode.HighVariable

Direct Known Subclasses:
  `HighConstant`, `HighGlobal`, `HighLocal`, `HighOther`

public abstract class HighVariable extends Object
A High-level variable (as in a high-level language like C/C++) built out of Varnodes (low-level variables). This is a base-class

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected HighFunction`
  `function`
  `protected Varnode[]`
  `instances`
  `protected String`
  `name`
  `protected int`
  `offset`
  `protected Varnode`
  `represent`
  `protected DataType`
  `type`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `HighVariable(HighFunction func)`
  Constructor for use with restoreXml
  `protected`
  `HighVariable(String nm, DataType tp, Varnode rep, Varnode[] inst, HighFunction func)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `attachInstances(Varnode[] inst, Varnode rep)`
  Attach an instance or additional location the variable can be found in.
  `abstract void`
  `decode(Decoder decoder)`
  Decode this HighVariable from a `<high>` element in the stream
  `protected void`
  `decodeInstances(Decoder decoder)`
  Decode the data-type and the Varnode instances of this HighVariable.
  `DataType`
  `getDataType()`
  `HighFunction`
  `getHighFunction()`
  `Varnode[]`
  `getInstances()`
  A variable can reside in different locations at various times.
  `String`
  `getName()`
  `int`
  `getOffset()`
  Get the offset of this variable into its containing HighSymbol.
  `Varnode`
  `getRepresentative()`
  `int`
  `getSize()`
  `abstract HighSymbol`
  `getSymbol()`
  Retrieve any underlying HighSymbol
  `boolean`
  `requiresDynamicStorage()`
  Return true in when the HighVariable should be recorded (in the database) using dynamic storage rather than using the actual address space and offset of the representative varnode.
  `protected void`
  `setHighOnInstances()`
  Link Varnodes directly to this HighVariable

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### name

    protected String name

  - ### type

    protected DataType type

  - ### represent

    protected Varnode represent

  - ### instances

    protected Varnode[] instances

  - ### offset

    protected int offset

  - ### function

    protected HighFunction function

- ## Constructor Details

  - ### HighVariable

    protected HighVariable(HighFunction func)
    Constructor for use with restoreXml
    Parameters:
      `func` - is the HighFunction this variable belongs to

  - ### HighVariable

    protected HighVariable(String nm, DataType tp, Varnode rep, Varnode[] inst, HighFunction func)

- ## Method Details

  - ### setHighOnInstances

    protected void setHighOnInstances()
    Link Varnodes directly to this HighVariable

  - ### getHighFunction

    public HighFunction getHighFunction()
    Returns:
      the high function associated with this variable.

  - ### getName

    public String getName()
    Returns:
      get the name of the variable

  - ### getSize

    public int getSize()
    Returns:
      get the size of the variable

  - ### getDataType

    public DataType getDataType()
    Returns:
      get the data type attached to the variable

  - ### getRepresentative

    public Varnode getRepresentative()
    Returns:
      get the varnode that represents this variable

  - ### getInstances

    public Varnode[] getInstances()
    A variable can reside in different locations at various times. Get all the instances of the variable.
    Returns:
      all the variables instances

  - ### getSymbol

    public abstract HighSymbol getSymbol()
    Retrieve any underlying HighSymbol
    Returns:
      the HighSymbol

  - ### getOffset

    public int getOffset()
    Get the offset of this variable into its containing HighSymbol. If the value is -1, this indicates that this HighVariable matches the size and storage of the symbol.
    Returns:
      the offset

  - ### attachInstances

    public void attachInstances(Varnode[] inst, Varnode rep)
    Attach an instance or additional location the variable can be found in.
    Parameters:
      `inst` - varnode where variable can reside.
      `rep` - location that variable comes into scope.

  - ### decodeInstances

    protected void decodeInstances(Decoder decoder) throws DecoderException
    Decode the data-type and the Varnode instances of this HighVariable. The "representative" Varnode is also populated.
    Parameters:
      `decoder` - is the stream decoder
    Throws:
      `DecoderException` - for invalid encodings

  - ### requiresDynamicStorage

    public boolean requiresDynamicStorage()
    Return true in when the HighVariable should be recorded (in the database) using dynamic storage rather than using the actual address space and offset of the representative varnode. Dynamic storage is typically needed if the actual storage is ephemeral (in the unique space).
    Returns:
      true if this needs dynamic storage

  - ### decode

    public abstract void decode(Decoder decoder) throws DecoderException
    Decode this HighVariable from a `<high>` element in the stream
    Parameters:
      `decoder` - is the stream decoder
    Throws:
      `DecoderException` - for invalid encodings