Interface PcodeFactory

All Known Implementing Classes:
HighFunction, HighParamID, PcodeSyntaxTree

public interface PcodeFactory
Interface for classes that build PcodeOps and Varnodes
  • Method Details

    • getAddressFactory

      AddressFactory getAddressFactory()
      Returns:
      Address factory
    • getDataTypeManager

      PcodeDataTypeManager getDataTypeManager()
      Returns:
      pcode data type manager used to convert strings to Ghidra data types
    • newVarnode

      Varnode newVarnode(int sz, Address addr)
      Create a new Varnode with the given size and location
      Parameters:
      sz - size of the Varnode
      addr - location of the Varnode
      Returns:
      a new varnode
    • newVarnode

      Varnode newVarnode(int sz, Address addr, int refId)
      Create a new Varnode with the given size and location. Associate the Varnode with a specific reference id so that it can be retrieved, using just the id, via getRef();
      Parameters:
      sz - size of the Varnode
      addr - location of the Varnode
      refId - is the specific reference id
      Returns:
      the new Varnode
    • getJoinStorage

      VariableStorage getJoinStorage(Varnode[] pieces) throws InvalidInputException
      Create a storage object representing a value split across multiple physical locations. The sequence of physical locations are passed in as an array of Varnodes and the storage object is returned. The storage is also assigned an Address in the join address space, which can be retrieved by calling the getJoinAddress() method. The join Address can be used to create a Varnode that represents the logical whole created by concatenating the Varnode pieces.
      Parameters:
      pieces - is the array of Varnode pieces to join
      Returns:
      the VariableStorage representing the whole
      Throws:
      InvalidInputException - if a valid storage object cannot be created
    • getJoinAddress

      Address getJoinAddress(VariableStorage storage)
      Get the address (in the "join" space) corresponding to the given multi-piece storage. The storage must have been previously registered by a previous call to getJoinStorage(). If the storage is not multi-piece or was not registered, null is returned.
      Parameters:
      storage - is the multi-piece storage
      Returns:
      the corresponding "join" address
    • buildStorage

      Build a storage object for a particular Varnode
      Parameters:
      vn - is the Varnode
      Returns:
      the storage object
      Throws:
      InvalidInputException - if valid storage cannot be created
    • getRef

      Varnode getRef(int refid)
      Return a Varnode given its reference id, or null if the id is not registered. The id must have previously been registered via newVarnode().
      Parameters:
      refid - is the reference id
      Returns:
      the matching Varnode or null
    • getOpRef

      PcodeOp getOpRef(int refid)
      Get a PcodeOp given a reference id. The reference id corresponds to the op's SequenceNumber.getTime() field. Return null if no op matching the id has been registered via newOp().
      Parameters:
      refid - is the reference id
      Returns:
      the matching PcodeOp or null
    • getSymbol

      HighSymbol getSymbol(long symbolId)
      Get the high symbol matching the given id that has been registered with this object
      Parameters:
      symbolId - is the given id
      Returns:
      the matching HighSymbol or null
    • setInput

      Varnode setInput(Varnode vn, boolean val)
      Mark (or unmark) the given Varnode as an input (to its function)
      Parameters:
      vn - is the given Varnode
      val - is true if the Varnode should be marked
      Returns:
      the altered Varnode, which may not be the same object passed in
    • setAddrTied

      void setAddrTied(Varnode vn, boolean val)
      Mark (or unmark) the given Varnode with the "address tied" property
      Parameters:
      vn - is the given Varnode
      val - is true if the Varnode should be marked
    • setPersistent

      void setPersistent(Varnode vn, boolean val)
      Mark (or unmark) the given Varnode with the "persistent" property
      Parameters:
      vn - is the given Varnode
      val - is true if the Varnode should be marked
    • setUnaffected

      void setUnaffected(Varnode vn, boolean val)
      Mark (or unmark) the given Varnode with the "unaffected" property
      Parameters:
      vn - is the given Varnode
      val - is true if the Varnode should be marked
    • setVolatile

      void setVolatile(Varnode vn, boolean val)
      Mark (or unmark) the given Varnode with the "volatile" property
      Parameters:
      vn - is the given Varnode
      val - is true if the Varnode should be marked volatile
    • setMergeGroup

      void setMergeGroup(Varnode vn, short val)
      Associate a specific merge group with the given Varnode
      Parameters:
      vn - is the given Varnode
      val - is the merge group
    • setDataType

      void setDataType(Varnode vn, DataType type)
      Attach a data-type to the given Varnode
      Parameters:
      vn - is the given Varnode
      type - is the data-type
    • newOp

      PcodeOp newOp(SequenceNumber sq, int opc, ArrayList<Varnode> inputs, Varnode output)
      Create a new PcodeOp given its opcode, sequence number, and input and output Varnodes
      Parameters:
      sq - is the sequence number
      opc - is the opcode
      inputs - is the array of input Varnodes, which may be empty
      output - is the output Varnode, which may be null
      Returns:
      the new PcodeOp