Package ghidra.program.model.pcode
Interface PcodeFactory
- All Known Implementing Classes:
HighFunction
,HighParamID
,PcodeSyntaxTree
public interface PcodeFactory
Interface for classes that build PcodeOps and Varnodes
-
Method Summary
Modifier and TypeMethodDescriptionbuildStorage
(Varnode vn) Build a storage object for a particular VarnodegetJoinAddress
(VariableStorage storage) Get the address (in the "join" space) corresponding to the given multi-piece storage.getJoinStorage
(Varnode[] pieces) Create a storage object representing a value split across multiple physical locations.getOpRef
(int refid) Get a PcodeOp given a reference id.getRef
(int refid) Return a Varnode given its reference id, or null if the id is not registered.getSymbol
(long symbolId) Get the high symbol matching the given id that has been registered with this objectnewOp
(SequenceNumber sq, int opc, ArrayList<Varnode> inputs, Varnode output) Create a new PcodeOp given its opcode, sequence number, and input and output VarnodesnewVarnode
(int sz, Address addr) Create a new Varnode with the given size and locationnewVarnode
(int sz, Address addr, int refId) Create a new Varnode with the given size and location.void
setAddrTied
(Varnode vn, boolean val) Mark (or unmark) the given Varnode with the "address tied" propertyvoid
setDataType
(Varnode vn, DataType type) Attach a data-type to the given VarnodeMark (or unmark) the given Varnode as an input (to its function)void
setMergeGroup
(Varnode vn, short val) Associate a specific merge group with the given Varnodevoid
setPersistent
(Varnode vn, boolean val) Mark (or unmark) the given Varnode with the "persistent" propertyvoid
setUnaffected
(Varnode vn, boolean val) Mark (or unmark) the given Varnode with the "unaffected" propertyvoid
setVolatile
(Varnode vn, boolean val) Mark (or unmark) the given Varnode with the "volatile" property
-
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
Create a new Varnode with the given size and location- Parameters:
sz
- size of the Varnodeaddr
- location of the Varnode- Returns:
- a new varnode
-
newVarnode
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 Varnodeaddr
- location of the VarnoderefId
- is the specific reference id- Returns:
- the new Varnode
-
getJoinStorage
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
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
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
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
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
Mark (or unmark) the given Varnode as an input (to its function)- Parameters:
vn
- is the given Varnodeval
- is true if the Varnode should be marked- Returns:
- the altered Varnode, which may not be the same object passed in
-
setAddrTied
Mark (or unmark) the given Varnode with the "address tied" property- Parameters:
vn
- is the given Varnodeval
- is true if the Varnode should be marked
-
setPersistent
Mark (or unmark) the given Varnode with the "persistent" property- Parameters:
vn
- is the given Varnodeval
- is true if the Varnode should be marked
-
setUnaffected
Mark (or unmark) the given Varnode with the "unaffected" property- Parameters:
vn
- is the given Varnodeval
- is true if the Varnode should be marked
-
setVolatile
Mark (or unmark) the given Varnode with the "volatile" property- Parameters:
vn
- is the given Varnodeval
- is true if the Varnode should be marked volatile
-
setMergeGroup
Associate a specific merge group with the given Varnode- Parameters:
vn
- is the given Varnodeval
- is the merge group
-
setDataType
Attach a data-type to the given Varnode- Parameters:
vn
- is the given Varnodetype
- is the data-type
-
newOp
Create a new PcodeOp given its opcode, sequence number, and input and output Varnodes- Parameters:
sq
- is the sequence numberopc
- is the opcodeinputs
- is the array of input Varnodes, which may be emptyoutput
- is the output Varnode, which may be null- Returns:
- the new PcodeOp
-