Package ghidra.program.model.pcode
Class Varnode
- java.lang.Object
- 
- ghidra.program.model.pcode.Varnode
 
- 
- Direct Known Subclasses:
- VarnodeAST,- VarnodeOperation
 
 public class Varnode extends java.lang.ObjectRawest possible Varnode. Just a variable location and size, not part of a syntax tree. A raw varnode is said to be free, it is not attached to any variable.
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidappendSpaceOffset(java.lang.StringBuilder buf, Address addr)voidbuildXML(java.lang.StringBuilder buf)static java.lang.StringbuildXMLAddress(Address addr)Convert an address into an XML document.static java.lang.StringbuildXMLAddress(Varnode[] varnodes, int logicalsize)Convert a varnode array into an XML document.static voidbuildXMLAddress(java.lang.StringBuilder resBuf, Address addr, int size)Build an XML document representation of a varnode with the given address and size.booleancontains(Address address)Determine if this varnode contains the specified addressbooleanequals(java.lang.Object o)AddressgetAddress()PcodeOpgetDef()java.util.Iterator<PcodeOp>getDescendants()HighVariablegetHigh()PcodeOpgetLoneDescend()If there is only one PcodeOp taking this varnode as input, return it.shortgetMergeGroup()longgetOffset()AddressgetPCAddress()Get the address where this varnode is defined or NO_ADDRESS if this varnode is an inputintgetSize()intgetSpace()longgetWordOffset()Returns the word offset into the address space this is defined within The word size is defined in the Language's .slaspec file with the "WORDSIZE" argument when DEFINEing a memory SPACE (capitalization is for emphasis; the directives are actually lowercase).inthashCode()booleanintersects(AddressSetView set)Determine if this varnode intersects the specified address setbooleanintersects(Varnode varnode)Determine if this varnode intersects another varnode.booleanisAddress()booleanisAddrTied()booleanisConstant()booleanisFree()booleanisHash()booleanisInput()booleanisPersistant()booleanisRegister()booleanisUnaffected()booleanisUnique()static VarnodereadXML(XmlPullParser parser, PcodeFactory factory)Build a varnode from a SAX parse tree nodestatic AddressreadXMLAddress(XmlElement el, AddressFactory addrFactory)Create an address from a SAX parse tree node.static AddressreadXMLAddress(java.lang.String addrstring, AddressFactory addrfactory, AddressSpace refSpace)Parse an XML containing an address.static AddressreadXMLAddress(java.lang.String localName, org.xml.sax.Attributes attr, AddressFactory addrFactory)java.lang.StringtoString()java.lang.StringtoString(Language language)Convert this varnode to an alternate String representation based on a specified language.voidtrim()Trim a varnode in a constant space to the correct starting offset.
 
- 
- 
- 
Method Detail- 
getSizepublic int getSize() - Returns:
- size of the varnode in bytes
 
 - 
getSpacepublic int getSpace() - Returns:
- the space this varnode belongs to (ram, register, ...)
 
 - 
getAddresspublic Address getAddress() - Returns:
- the address this varnode is attached to
 
 - 
getPCAddresspublic Address getPCAddress() Get the address where this varnode is defined or NO_ADDRESS if this varnode is an input- Returns:
- the address
 
 - 
getOffsetpublic long getOffset() - Returns:
- the offset into the address space varnode is defined within
 
 - 
getWordOffsetpublic long getWordOffset() Returns the word offset into the address space this is defined within The word size is defined in the Language's .slaspec file with the "WORDSIZE" argument when DEFINEing a memory SPACE (capitalization is for emphasis; the directives are actually lowercase).- Returns:
- the word offset into the address space this is defined within
 
 - 
isFreepublic boolean isFree() 
 - 
containspublic boolean contains(Address address) Determine if this varnode contains the specified address- Parameters:
- address- the address for which to check
- Returns:
- true if this varnode contains the specified address
 
 - 
intersectspublic boolean intersects(Varnode varnode) Determine if this varnode intersects another varnode.- Parameters:
- varnode- other varnode
- Returns:
- true if this varnode intersects the specified varnode
 
 - 
intersectspublic boolean intersects(AddressSetView set) Determine if this varnode intersects the specified address set- Parameters:
- set- address set
- Returns:
- true if this varnode intersects the specified address set
 
 - 
isAddresspublic boolean isAddress() - Returns:
- true if this varnode exists in a Memory space (vs. register etc...).
 Keep in mind this varnode may also correspond to a defined register 
 if true is returned and isRegister()return false. Memory-based registers may be indirectly addressed which leads to the distinction with registers within the register space.
 
 - 
isRegisterpublic boolean isRegister() - Returns:
- true if this varnode exists in a Register type space. If false is returned, keep in mind this varnode may still correspond to a defined register within a memory space. Memory-based registers may be indirectly addressed which leads to the distinction with registers within the register space.
 
 - 
isConstantpublic boolean isConstant() - Returns:
- true if this varnode is just a constant number
 
 - 
isUniquepublic boolean isUnique() - Returns:
- true if this varnode doesn't exist anywhere. A temporary variable.
 
 - 
isHashpublic boolean isHash() 
 - 
isInputpublic boolean isInput() - Returns:
- is input to a pcode op
 
 - 
isPersistantpublic boolean isPersistant() - Returns:
- is persistant
 
 - 
isAddrTiedpublic boolean isAddrTied() - Returns:
- is mapped to an address
 
 - 
isUnaffectedpublic boolean isUnaffected() 
 - 
getDefpublic PcodeOp getDef() - Returns:
- get the pcode op this varnode belongs to
 
 - 
getDescendantspublic java.util.Iterator<PcodeOp> getDescendants() - Returns:
- iterator to all PcodeOp s that take this as input
 
 - 
getLoneDescendpublic PcodeOp getLoneDescend() If there is only one PcodeOp taking this varnode as input, return it. Otherwise return null- Returns:
- the lone descendant PcodeOp
 
 - 
getHighpublic HighVariable getHigh() - Returns:
- the high level variable this varnode represents
 
 - 
getMergeGrouppublic short getMergeGroup() - Returns:
- the index of the group, within the high containing this, that are forced merged with this
 
 - 
buildXMLpublic void buildXML(java.lang.StringBuilder buf) - Parameters:
- buf- is the builder to which to append XML
 
 - 
buildXMLAddresspublic static void buildXMLAddress(java.lang.StringBuilder resBuf, Address addr, int size)Build an XML document representation of a varnode with the given address and size.- Parameters:
- resBuf- is the builder to which to append the XML
- addr- location varnode is defined at
- size- size of the varnode.
 
 - 
buildXMLAddresspublic static java.lang.String buildXMLAddress(Address addr) Convert an address into an XML document.- Parameters:
- addr- -- Address to convert to XML
- Returns:
- XML string
 
 - 
buildXMLAddresspublic static java.lang.String buildXMLAddress(Varnode[] varnodes, int logicalsize) Convert a varnode array into an XML document.- Parameters:
- varnodes- sequence of storage varnodes
- logicalsize- the logical size value of the varnode
- Returns:
- XML string
 
 - 
appendSpaceOffsetpublic static void appendSpaceOffset(java.lang.StringBuilder buf, Address addr)
 - 
readXMLpublic static Varnode readXML(XmlPullParser parser, PcodeFactory factory) throws PcodeXMLException Build a varnode from a SAX parse tree node- Parameters:
- parser- the parser
- factory- pcode factory used to create valid pcode
- Returns:
- new varnode element based on info in the XML.
- Throws:
- PcodeXMLException
 
 - 
trimpublic void trim() Trim a varnode in a constant space to the correct starting offset. Constant handles may contain constants of indeterminate size. This is where the size gets fixed, i.e. we mask off the constant to its proper size. A varnode that is ends up in pcode should call this method to ensure that varnodes always contains raw data. On the other hand, varnodes in handles are allowed to have offsets that violate size restrictions.
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString(Language language) Convert this varnode to an alternate String representation based on a specified language.- Parameters:
- language-
- Returns:
- string representation
 
 - 
equalspublic boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
readXMLAddresspublic static Address readXMLAddress(XmlElement el, AddressFactory addrFactory) Create an address from a SAX parse tree node.- Parameters:
- el- SAX parse tree element
- addrFactory- address factory used to create valid addresses
- Returns:
- Address created from XML info
 
 - 
readXMLAddresspublic static Address readXMLAddress(java.lang.String localName, org.xml.sax.Attributes attr, AddressFactory addrFactory) 
 - 
readXMLAddresspublic static Address readXMLAddress(java.lang.String addrstring, AddressFactory addrfactory, AddressSpace refSpace) throws PcodeXMLException Parse an XML containing an address. The format options are simple enough that we don't try to invoke an actual XML parser but just walk the string- Parameters:
- addrstring- is the string containing the XML tag
- addrfactory- is the factory that can produce addresses
- refSpace- can be null but is otherwise the reference AddressSpace from which the request is sent.
- Returns:
- the created Address or Address.NO_ADDRESS in some special cases
- Throws:
- PcodeXMLException
 
 
- 
 
-