Package ghidra.program.model.listing
Class InstructionStub
- java.lang.Object
- 
- ghidra.program.model.listing.InstructionStub
 
- 
- All Implemented Interfaces:
- ProcessorContext,- ProcessorContextView,- CodeUnit,- Instruction,- MemBuffer
 
 public class InstructionStub extends java.lang.Object implements Instruction InstructionStub can be extended for use by tests. It throws an UnsupportedOperationException for all methods in the Instruction interface. Any method that is needed for your test can then be overridden so it can provide its own test implementation and return value.
- 
- 
Field Summary- 
Fields inherited from interface ghidra.program.model.listing.CodeUnitCOMMENT_PROPERTY, DEFINED_DATA_PROPERTY, EOL_COMMENT, INSTRUCTION_PROPERTY, MNEMONIC, NO_COMMENT, PLATE_COMMENT, POST_COMMENT, PRE_COMMENT, REPEATABLE_COMMENT, SPACE_PROPERTY
 - 
Fields inherited from interface ghidra.program.model.listing.InstructionINVALID_DEPTH_CHANGE
 
- 
 - 
Constructor SummaryConstructors Constructor Description InstructionStub()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMnemonicReference(Address refAddr, RefType refType, SourceType sourceType)Add a reference to the mnemonic for this code unit.voidaddOperandReference(int index, Address refAddr, RefType type, SourceType sourceType)Add a memory reference to the operand at the given index.voidclearFallThroughOverride()Restores this instruction's fallthrough address back to the default fallthrough for this instruction.voidclearRegister(Register register)Clears the register within this context.intcompareTo(Address addr)Compares the given address to the address range of this node.booleancontains(Address testAddr)Returns true if address is contained in the range of this codeUnitAddressgetAddress()Get the Address which corresponds to the offset 0.AddressgetAddress(int opIndex)Get the Address for the given operand index if one exists.java.lang.StringgetAddressString(boolean showBlockName, boolean pad)Get the string representation of the starting address for this code unit.RegistergetBaseContextRegister()java.math.BigIntegergetBigInteger(int offset, int size, boolean signed)returns the value at the given offset, taking into account the endianess.bytegetByte(int offset)Get one byte from memory at the current position plus offset.byte[]getBytes()Get the bytes that make up this code unit.intgetBytes(byte[] b, int memoryBufferOffset)Reads b.length bytes from this memory buffer starting at the address of this memory buffer plus the given memoryBufferOffset from that position.voidgetBytesInCodeUnit(byte[] buffer, int bufferOffset)Copies max(buffer.length, code unit length) bytes into buffer starting at location offset in buffer.java.lang.StringgetComment(int commentType)Get the comment for the given typejava.lang.String[]getCommentAsArray(int commentType)Get the comment for the given type and parse it into an array of strings such that each line is its own string.AddressgetDefaultFallThrough()Get the default fallthrough for this instruction.intgetDefaultFallThroughOffset()Get default fall-through offset in bytes from start of instruction to the fallthrough instruction.Address[]getDefaultFlows()Get an array of Address objects for all default flows established by the underlying instruction prototype.java.lang.StringgetDefaultOperandRepresentation(int opIndex)Get the operand representation for the given operand index without markup.java.util.List<java.lang.Object>getDefaultOperandRepresentationList(int opIndex)Get the operand representation for the given operand index.intgetDelaySlotDepth()Get the number of delay slot instructions for this argument.ExternalReferencegetExternalReference(int opIndex)Gets the external reference (if any) at the opIndexAddressgetFallFrom()Get the Address for the instruction that fell through to this instruction.AddressgetFallThrough()Get the fallthrough for this instruction, factoring in any fallthrough override and delay slotted instructions.FlowOverridegetFlowOverride()Returns the flow override which may have been set on this instruction.Address[]getFlows()Get an array of Address objects for all flows other than a fall-through.FlowTypegetFlowType()Get the flow type of this instruction (how this instruction flows to the next instruction).java.lang.Object[]getInputObjects()Get the Input objects used by this instruction.InstructionContextgetInstructionContext()intgetInt(int offset)returns the int at the given offset, taking into account the endianess.intgetIntProperty(java.lang.String name)Get the int property for name.java.lang.StringgetLabel()Get the label for this code unit.intgetLength()Get length of this code unit.longgetLong(int offset)returns the long at the given offset, taking into account the endianess.AddressgetMaxAddress()Get the ending address for this code unit.MemorygetMemory()Get the Memory object actually used by the MemBuffer.AddressgetMinAddress()Get the starting address for this code unit.Reference[]getMnemonicReferences()Get references for the mnemonic for this code unit.java.lang.StringgetMnemonicString()Get the mnemonic for this code unit, e.g., MOV, JMPInstructiongetNext()Get the instruction following this one in address order.intgetNumOperands()Get the number of operands for this code unit.SaveablegetObjectProperty(java.lang.String name)Get the object property for name; returns null if there is no name property for this code unit.Reference[]getOperandReferences(int index)Get the references for the operand index.RefTypegetOperandRefType(int index)Get the operand reference type for the given operand index.intgetOperandType(int opIndex)Get the type of a specific operand.java.lang.Object[]getOpObjects(int opIndex)Get objects used by this operand (Address, Scalar, Register ...)PcodeOp[]getPcode()Get an array of PCode operations (micro code) that this instruction performs.PcodeOp[]getPcode(boolean includeOverrides)Get an array of PCode operations (micro code) that this instruction performs.PcodeOp[]getPcode(int opIndex)Get an array of PCode operations (micro code) that a particular operand performs to compute its value.InstructiongetPrevious()Get the instruction before this one in address order.ReferencegetPrimaryReference(int index)Get the primary reference for the operand index.SymbolgetPrimarySymbol()Get the Primary Symbol for this code unit.ProgramgetProgram()Returns the program that generated this CodeUnit.InstructionPrototypegetPrototype()Get the prototype for this instruction.ReferenceIteratorgetReferenceIteratorTo()Get an iterator over all references TO this code unit.Reference[]getReferencesFrom()Get ALL memory references FROM this code unit.RegistergetRegister(int opIndex)If operand is a pure Register, return the register.RegistergetRegister(java.lang.String name)Get a Register given the name of a registerRegister[]getRegisters()Returns all the Registers for the processorRegisterValuegetRegisterValue(Register register)Get the RegisterValue for the given register.java.lang.Object[]getResultObjects()Get the Result objects produced/affected by this instruction These would probably only be Register or AddressScalargetScalar(int opIndex)Returns the scalar at the given operand index.java.lang.StringgetSeparator(int opIndex)Get the separator strings between an operand.shortgetShort(int offset)returns the short at the given offset, taking into account the endianess.java.lang.StringgetStringProperty(java.lang.String name)Get the string property for name; returns null if there is no name property for this code unit.Symbol[]getSymbols()Get the Symbols for this code unit.java.math.BigIntegergetValue(Register register, boolean signed)Get the contents of a processor register as a BigInteger objectbooleangetVoidProperty(java.lang.String name)Returns whether this code unit is marked as having the name property.booleanhasFallthrough()Returns true if this instruction has a fall-through flow.booleanhasProperty(java.lang.String name)Returns true if the codeunit has the given property defined.booleanhasValue(Register register)Returns true if a value is defined for the given register.booleanisBigEndian()Returns true if the underlying bytes are in big-endian order, false if they are little endian.booleanisFallthrough()Returns true if this instruction has no execution flow other than fall-through.booleanisFallThroughOverridden()Returns true if this instructions fallthrough has been overriden.booleanisInDelaySlot()Return true if this instruction was disassembled in a delay slotbooleanisSuccessor(CodeUnit codeUnit)Return true if the given CodeUnit follows directly after this code unit.java.util.Iterator<java.lang.String>propertyNames()Get an iterator over the property names.voidremoveExternalReference(int opIndex)Remove external reference (if any) at the given opIndex opIndex the index of the operand from which to remove any external reference.voidremoveMnemonicReference(Address refAddr)Remove a reference to the mnemonic for this code unit.voidremoveOperandReference(int index, Address refAddr)Remove a reference to the operand.voidremoveProperty(java.lang.String name)Remove the property with the given name from this code unit.voidsetComment(int commentType, java.lang.String comment)Set the comment for the given comment type.voidsetCommentAsArray(int commentType, java.lang.String[] comment)Set the comment (with each line in its own string) for the given comment typevoidsetFallThrough(Address addr)Overrides the instruction's default fallthrough address to the given address.voidsetFlowOverride(FlowOverride flowOverride)Set the flow override for this instruction.voidsetPrimaryMemoryReference(Reference ref)Sets a memory reference to be the primary reference at its address/opIndex location.voidsetProperty(java.lang.String name)Set the named property.voidsetProperty(java.lang.String name, int value)Set the named property with the given value at the address of this codeunit.voidsetProperty(java.lang.String name, Saveable value)Set the named property with the given value at the address of this codeunit.voidsetProperty(java.lang.String name, java.lang.String value)Set the named property with the given value at the address of this codeunit.voidsetRegisterReference(int opIndex, Register reg, SourceType sourceType, RefType refType)Sets a register reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
 NOTE: If another reference was previously set on the operand, then it will be replaced with this register referencevoidsetRegisterValue(RegisterValue value)Sets the specified register value within this context.voidsetStackReference(int opIndex, int offset, SourceType sourceType, RefType refType)Sets a stack reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
 NOTE: If another reference was previously set on the operand, then it will be replaced with this stack referencevoidsetValue(Register register, java.math.BigInteger value)Sets the value for a Register.voidvisitProperty(PropertyVisitor visitor, java.lang.String propertyName)Invokes the visit() method of the specified PropertyVisitor if the named property exists for this code unit.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface ghidra.program.model.mem.MemBuffergetUnsignedByte, getUnsignedInt, getUnsignedShort, getVarLengthInt, getVarLengthUnsignedInt, isInitializedMemory
 
- 
 
- 
- 
- 
Method Detail- 
getAddressStringpublic java.lang.String getAddressString(boolean showBlockName, boolean pad)Description copied from interface:CodeUnitGet the string representation of the starting address for this code unit.- Specified by:
- getAddressStringin interface- CodeUnit
- Parameters:
- showBlockName- true if the string should include the memory block name
- pad- if true, the address will be padded with leading zeros. Even if pad is false, the string will be padded to make the address string contain at least 4 digits.
- Returns:
- string representation of address
 
 - 
setPropertypublic void setProperty(java.lang.String name, Saveable value)Description copied from interface:CodeUnitSet the named property with the given value at the address of this codeunit.- Specified by:
- setPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property.
- value- value to be stored.
 
 - 
setPropertypublic void setProperty(java.lang.String name, java.lang.String value)Description copied from interface:CodeUnitSet the named property with the given value at the address of this codeunit.- Specified by:
- setPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property.
- value- value to be stored.
 
 - 
setPropertypublic void setProperty(java.lang.String name, int value)Description copied from interface:CodeUnitSet the named property with the given value at the address of this codeunit.- Specified by:
- setPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property.
- value- value to be stored.
 
 - 
setPropertypublic void setProperty(java.lang.String name) Description copied from interface:CodeUnitSet the named property. This method is used for "void" properites. The property is either set or not set - there is no value- Specified by:
- setPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property.
 
 - 
getObjectPropertypublic Saveable getObjectProperty(java.lang.String name) Description copied from interface:CodeUnitGet the object property for name; returns null if there is no name property for this code unit.- Specified by:
- getObjectPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
 
 - 
getStringPropertypublic java.lang.String getStringProperty(java.lang.String name) Description copied from interface:CodeUnitGet the string property for name; returns null if there is no name property for this code unit.- Specified by:
- getStringPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
 
 - 
getIntPropertypublic int getIntProperty(java.lang.String name) throws NoValueExceptionDescription copied from interface:CodeUnitGet the int property for name.- Specified by:
- getIntPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
- Throws:
- NoValueException- if there is not name property for this code unit
 
 - 
hasPropertypublic boolean hasProperty(java.lang.String name) Description copied from interface:CodeUnitReturns true if the codeunit has the given property defined.- Specified by:
- hasPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
 
 - 
getVoidPropertypublic boolean getVoidProperty(java.lang.String name) Description copied from interface:CodeUnitReturns whether this code unit is marked as having the name property.- Specified by:
- getVoidPropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
 
 - 
propertyNamespublic java.util.Iterator<java.lang.String> propertyNames() Description copied from interface:CodeUnitGet an iterator over the property names.- Specified by:
- propertyNamesin interface- CodeUnit
 
 - 
removePropertypublic void removeProperty(java.lang.String name) Description copied from interface:CodeUnitRemove the property with the given name from this code unit.- Specified by:
- removePropertyin interface- CodeUnit
- Parameters:
- name- the name of the property
 
 - 
visitPropertypublic void visitProperty(PropertyVisitor visitor, java.lang.String propertyName) Description copied from interface:CodeUnitInvokes the visit() method of the specified PropertyVisitor if the named property exists for this code unit.- Specified by:
- visitPropertyin interface- CodeUnit
- Parameters:
- visitor- the class implementing the PropertyVisitor interface.
- propertyName- the name of the property to be visited.
 
 - 
getLabelpublic java.lang.String getLabel() Description copied from interface:CodeUnitGet the label for this code unit.
 - 
getSymbolspublic Symbol[] getSymbols() Description copied from interface:CodeUnitGet the Symbols for this code unit.- Specified by:
- getSymbolsin interface- CodeUnit
 
 - 
getPrimarySymbolpublic Symbol getPrimarySymbol() Description copied from interface:CodeUnitGet the Primary Symbol for this code unit.- Specified by:
- getPrimarySymbolin interface- CodeUnit
 
 - 
getMinAddresspublic Address getMinAddress() Description copied from interface:CodeUnitGet the starting address for this code unit.- Specified by:
- getMinAddressin interface- CodeUnit
 
 - 
getMaxAddresspublic Address getMaxAddress() Description copied from interface:CodeUnitGet the ending address for this code unit.- Specified by:
- getMaxAddressin interface- CodeUnit
 
 - 
getMnemonicStringpublic java.lang.String getMnemonicString() Description copied from interface:CodeUnitGet the mnemonic for this code unit, e.g., MOV, JMP- Specified by:
- getMnemonicStringin interface- CodeUnit
 
 - 
getCommentpublic java.lang.String getComment(int commentType) Description copied from interface:CodeUnitGet the comment for the given type- Specified by:
- getCommentin interface- CodeUnit
- Parameters:
- commentType- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, or REPEATABLE_COMMENT
- Returns:
- the comment string of the appropriate type or null if no comment of that type exists for this codeunit
 
 - 
getCommentAsArraypublic java.lang.String[] getCommentAsArray(int commentType) Description copied from interface:CodeUnitGet the comment for the given type and parse it into an array of strings such that each line is its own string.- Specified by:
- getCommentAsArrayin interface- CodeUnit
- Parameters:
- commentType- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, or REPEATABLE_COMMENT
- Returns:
- an array of strings where each item in the array is a line of text in the comment. If there is no comment of the requested type, an empty array is returned.
 
 - 
setCommentpublic void setComment(int commentType, java.lang.String comment)Description copied from interface:CodeUnitSet the comment for the given comment type. Passing null clears the comment- Specified by:
- setCommentin interface- CodeUnit
- Parameters:
- commentType- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, or REPEATABLE_COMMENT
- comment- comment for code unit; null clears the comment
 
 - 
setCommentAsArraypublic void setCommentAsArray(int commentType, java.lang.String[] comment)Description copied from interface:CodeUnitSet the comment (with each line in its own string) for the given comment type- Specified by:
- setCommentAsArrayin interface- CodeUnit
- Parameters:
- commentType- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, or REPEATABLE_COMMENT
- comment- an array of strings where each string is a single line of the comment.
 
 - 
isSuccessorpublic boolean isSuccessor(CodeUnit codeUnit) Description copied from interface:CodeUnitReturn true if the given CodeUnit follows directly after this code unit.- Specified by:
- isSuccessorin interface- CodeUnit
- Parameters:
- codeUnit- the codeUnit being tested to see if it follows this codeUnit.
 
 - 
getLengthpublic int getLength() Description copied from interface:CodeUnitGet length of this code unit.
 - 
getBytespublic byte[] getBytes() throws MemoryAccessExceptionDescription copied from interface:CodeUnitGet the bytes that make up this code unit.- Specified by:
- getBytesin interface- CodeUnit
- Returns:
- an array of bytes that are in memory at the codeunits address. The array length is the same as the codeUnits length
- Throws:
- MemoryAccessException- if the full number of bytes could not be read.
 
 - 
getBytesInCodeUnitpublic void getBytesInCodeUnit(byte[] buffer, int bufferOffset) throws MemoryAccessExceptionDescription copied from interface:CodeUnitCopies max(buffer.length, code unit length) bytes into buffer starting at location offset in buffer.- Specified by:
- getBytesInCodeUnitin interface- CodeUnit
- Parameters:
- buffer- byte array to copy into
- bufferOffset- offset in byte array the copy will start
- Throws:
- MemoryAccessException- if the full number of bytes could not be read.
 
 - 
containspublic boolean contains(Address testAddr) Description copied from interface:CodeUnitReturns true if address is contained in the range of this codeUnit
 - 
compareTopublic int compareTo(Address addr) Description copied from interface:CodeUnitCompares the given address to the address range of this node.
 - 
addMnemonicReferencepublic void addMnemonicReference(Address refAddr, RefType refType, SourceType sourceType) Description copied from interface:CodeUnitAdd a reference to the mnemonic for this code unit.- Specified by:
- addMnemonicReferencein interface- CodeUnit
- Parameters:
- refAddr- address to add as a reference.
- refType- the type of reference to add.
- sourceType- the source of this reference
 
 - 
removeMnemonicReferencepublic void removeMnemonicReference(Address refAddr) Description copied from interface:CodeUnitRemove a reference to the mnemonic for this code unit.- Specified by:
- removeMnemonicReferencein interface- CodeUnit
- Parameters:
- refAddr- the address to remove as a reference.
 
 - 
getMnemonicReferencespublic Reference[] getMnemonicReferences() Description copied from interface:CodeUnitGet references for the mnemonic for this code unit.- Specified by:
- getMnemonicReferencesin interface- CodeUnit
- Returns:
- an array of memory references. A zero length array will be returned if there are no references for the mnemonic.
 
 - 
getOperandReferencespublic Reference[] getOperandReferences(int index) Description copied from interface:CodeUnitGet the references for the operand index.- Specified by:
- getOperandReferencesin interface- CodeUnit
- Parameters:
- index- operand index (0 is the first operand)
 
 - 
getPrimaryReferencepublic Reference getPrimaryReference(int index) Description copied from interface:CodeUnitGet the primary reference for the operand index.- Specified by:
- getPrimaryReferencein interface- CodeUnit
- Parameters:
- index- operand index (0 is the first operand)
 
 - 
addOperandReferencepublic void addOperandReference(int index, Address refAddr, RefType type, SourceType sourceType)Description copied from interface:CodeUnitAdd a memory reference to the operand at the given index.- Specified by:
- addOperandReferencein interface- CodeUnit
- Parameters:
- index- operand index
- refAddr- reference address
- type- the reference type to be added.
- sourceType- the source of this reference
 
 - 
removeOperandReferencepublic void removeOperandReference(int index, Address refAddr)Description copied from interface:CodeUnitRemove a reference to the operand.- Specified by:
- removeOperandReferencein interface- CodeUnit
- Parameters:
- index- operand index
- refAddr- address referencing the operand
 
 - 
getReferencesFrompublic Reference[] getReferencesFrom() Description copied from interface:CodeUnitGet ALL memory references FROM this code unit.- Specified by:
- getReferencesFromin interface- CodeUnit
- Returns:
- an array of memory references from this codeUnit or an empty array if there are no references.
 
 - 
getReferenceIteratorTopublic ReferenceIterator getReferenceIteratorTo() Description copied from interface:CodeUnitGet an iterator over all references TO this code unit.- Specified by:
- getReferenceIteratorToin interface- CodeUnit
 
 - 
getProgrampublic Program getProgram() Description copied from interface:CodeUnitReturns the program that generated this CodeUnit.- Specified by:
- getProgramin interface- CodeUnit
 
 - 
getExternalReferencepublic ExternalReference getExternalReference(int opIndex) Description copied from interface:CodeUnitGets the external reference (if any) at the opIndex- Specified by:
- getExternalReferencein interface- CodeUnit
- Parameters:
- opIndex- the operand index to look for external references
- Returns:
- the external reference at the operand or null if none exists.
 
 - 
removeExternalReferencepublic void removeExternalReference(int opIndex) Description copied from interface:CodeUnitRemove external reference (if any) at the given opIndex opIndex the index of the operand from which to remove any external reference.- Specified by:
- removeExternalReferencein interface- CodeUnit
 
 - 
setPrimaryMemoryReferencepublic void setPrimaryMemoryReference(Reference ref) Description copied from interface:CodeUnitSets a memory reference to be the primary reference at its address/opIndex location. The primary reference is the one that is used in the getOperandRepresentation() method.- Specified by:
- setPrimaryMemoryReferencein interface- CodeUnit
- Parameters:
- ref- the reference to be set as primary.
 
 - 
setStackReferencepublic void setStackReference(int opIndex, int offset, SourceType sourceType, RefType refType)Description copied from interface:CodeUnitSets a stack reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
 NOTE: If another reference was previously set on the operand, then it will be replaced with this stack reference- Specified by:
- setStackReferencein interface- CodeUnit
- Parameters:
- opIndex- the index of the operand to set this stack reference
- offset- the (+/-) offset from stack base address
- sourceType- the source of this reference
- refType- type of reference, RefType.READ,WRITE,PTR...
 
 - 
setRegisterReferencepublic void setRegisterReference(int opIndex, Register reg, SourceType sourceType, RefType refType)Description copied from interface:CodeUnitSets a register reference at theoffseton the specified operand index, which effectively substitutes the previous operation interpretation
 NOTE: If another reference was previously set on the operand, then it will be replaced with this register reference- Specified by:
- setRegisterReferencein interface- CodeUnit
- Parameters:
- opIndex- the index of the operand to set this register reference
- reg- a register
- sourceType- the source of this reference
- refType- type of reference, RefType.READ,WRITE,PTR...
 
 - 
getNumOperandspublic int getNumOperands() Description copied from interface:CodeUnitGet the number of operands for this code unit.- Specified by:
- getNumOperandsin interface- CodeUnit
 
 - 
getAddresspublic Address getAddress(int opIndex) Description copied from interface:CodeUnitGet the Address for the given operand index if one exists. Data objects have one operand (the value).- Specified by:
- getAddressin interface- CodeUnit
- Parameters:
- opIndex- index of the operand.
- Returns:
- An addres if the operand represents a fully qualified address (given the context), or if the operand is a Scalar treated as an address. Null is returned if no address or scalar exists on that operand.
 
 - 
getScalarpublic Scalar getScalar(int opIndex) Description copied from interface:CodeUnitReturns the scalar at the given operand index. Data objects have one operand (the value).
 - 
getBytepublic byte getByte(int offset) throws MemoryAccessExceptionDescription copied from interface:MemBufferGet one byte from memory at the current position plus offset.- Specified by:
- getBytein interface- MemBuffer
- Parameters:
- offset- the displacement from the current position.
- Returns:
- the data at offset from the current position.
- Throws:
- MemoryAccessException- if memory cannot be read at the specified offset
 
 - 
getBytespublic int getBytes(byte[] b, int memoryBufferOffset)Description copied from interface:MemBufferReads b.length bytes from this memory buffer starting at the address of this memory buffer plus the given memoryBufferOffset from that position. The actual number of bytes may be fewer if bytes can't be read.- Specified by:
- getBytesin interface- MemBuffer
- Parameters:
- b- the buffer into which bytes will be placed
- memoryBufferOffset- the offset in this memory buffer from which to start reading bytes.
- Returns:
- the number of bytes read which may be fewer than b.length if available bytes are exhausted or no bytes are available at the specified offset.
 
 - 
getAddresspublic Address getAddress() Description copied from interface:MemBufferGet the Address which corresponds to the offset 0.- Specified by:
- getAddressin interface- MemBuffer
- Returns:
- the current address of offset 0.
 
 - 
getMemorypublic Memory getMemory() Description copied from interface:MemBufferGet the Memory object actually used by the MemBuffer.
 - 
isBigEndianpublic boolean isBigEndian() Description copied from interface:MemBufferReturns true if the underlying bytes are in big-endian order, false if they are little endian.- Specified by:
- isBigEndianin interface- MemBuffer
- Returns:
- true if the underlying bytes are in big-endian order, false if they are little endian.
 
 - 
getShortpublic short getShort(int offset) throws MemoryAccessExceptionDescription copied from interface:MemBufferreturns the short at the given offset, taking into account the endianess.- Specified by:
- getShortin interface- MemBuffer
- Parameters:
- offset- the offset from the membuffers origin (the address that it is set at)
- Returns:
- the short at the given offset, taking into account the endianess.
- Throws:
- MemoryAccessException- if a 2-byte short value cannot be read at the specified offset
 
 - 
getIntpublic int getInt(int offset) throws MemoryAccessExceptionDescription copied from interface:MemBufferreturns the int at the given offset, taking into account the endianess.- Specified by:
- getIntin interface- MemBuffer
- Parameters:
- offset- the offset from the membuffers origin (the address that it is set at)
- Returns:
- the int at the given offset, taking into account the endianess.
- Throws:
- MemoryAccessException- if a 4-byte integer value cannot be read at the specified offset
 
 - 
getLongpublic long getLong(int offset) throws MemoryAccessExceptionDescription copied from interface:MemBufferreturns the long at the given offset, taking into account the endianess.- Specified by:
- getLongin interface- MemBuffer
- Parameters:
- offset- the offset from the membuffers origin (the address that it is set at)
- Returns:
- the long at the given offset, taking into account the endianess.
- Throws:
- MemoryAccessException- if a 8-byte long value cannot be read at the specified offset
 
 - 
getBigIntegerpublic java.math.BigInteger getBigInteger(int offset, int size, boolean signed) throws MemoryAccessExceptionDescription copied from interface:MemBufferreturns the value at the given offset, taking into account the endianess.- Specified by:
- getBigIntegerin interface- MemBuffer
- Parameters:
- offset- the offset from the membuffers origin (the address that it is set at)
- size- the number of bytes to include in the value
- signed- true if value should be treated as a signed twos-compliment value.
- Returns:
- the value at the given offset, taking into account the endianess.
- Throws:
- MemoryAccessException- if the request size value cannot be read at the specified offset
 
 - 
setValuepublic void setValue(Register register, java.math.BigInteger value) throws ContextChangeException Description copied from interface:ProcessorContextSets the value for a Register.- Specified by:
- setValuein interface- ProcessorContext
- Parameters:
- register- the register to have its value set
- value- the value for the register (null is not permitted).
- Throws:
- ContextChangeException- an illegal attempt to change context was made
 
 - 
setRegisterValuepublic void setRegisterValue(RegisterValue value) throws ContextChangeException Description copied from interface:ProcessorContextSets the specified register value within this context.- Specified by:
- setRegisterValuein interface- ProcessorContext
- Parameters:
- value- register value
- Throws:
- ContextChangeException- an illegal attempt to change context was made
 
 - 
clearRegisterpublic void clearRegister(Register register) throws ContextChangeException Description copied from interface:ProcessorContextClears the register within this context.- Specified by:
- clearRegisterin interface- ProcessorContext
- Parameters:
- register- register to be cleared.
- Throws:
- ContextChangeException- an illegal attempt to change context was made
 
 - 
getBaseContextRegisterpublic Register getBaseContextRegister() - Specified by:
- getBaseContextRegisterin interface- ProcessorContextView
- Returns:
- the base processor context register or null if one has not been defined
 
 - 
getRegisterspublic Register[] getRegisters() Description copied from interface:ProcessorContextViewReturns all the Registers for the processor- Specified by:
- getRegistersin interface- ProcessorContextView
- Returns:
- all the Registers for the processor
 
 - 
getRegisterpublic Register getRegister(java.lang.String name) Description copied from interface:ProcessorContextViewGet a Register given the name of a register- Specified by:
- getRegisterin interface- ProcessorContextView
- Parameters:
- name- the name of the register.
- Returns:
- The register with the given name.
 
 - 
getValuepublic java.math.BigInteger getValue(Register register, boolean signed) Description copied from interface:ProcessorContextViewGet the contents of a processor register as a BigInteger object- Specified by:
- getValuein interface- ProcessorContextView
- Parameters:
- register- register to get the value for
- Returns:
- a BigInteger object containing the value of the register if a value exists, otherwise null.
 
 - 
getRegisterValuepublic RegisterValue getRegisterValue(Register register) Description copied from interface:ProcessorContextViewGet the RegisterValue for the given register.- Specified by:
- getRegisterValuein interface- ProcessorContextView
- Parameters:
- register- register to get the value for
- Returns:
- RegisterValue object containing the value of the register if a value exists, otherwise null.
 
 - 
hasValuepublic boolean hasValue(Register register) Description copied from interface:ProcessorContextViewReturns true if a value is defined for the given register.- Specified by:
- hasValuein interface- ProcessorContextView
- Parameters:
- register- the register to check for a value.
- Returns:
- true if the given register has a value.
 
 - 
getPrototypepublic InstructionPrototype getPrototype() Description copied from interface:InstructionGet the prototype for this instruction.- Specified by:
- getPrototypein interface- Instruction
 
 - 
getRegisterpublic Register getRegister(int opIndex) Description copied from interface:InstructionIf operand is a pure Register, return the register.- Specified by:
- getRegisterin interface- Instruction
- Parameters:
- opIndex- index of the operand.
- Returns:
- A register if the operand represents a register.
 
 - 
getOpObjectspublic java.lang.Object[] getOpObjects(int opIndex) Description copied from interface:InstructionGet objects used by this operand (Address, Scalar, Register ...)- Specified by:
- getOpObjectsin interface- Instruction
- Parameters:
- opIndex- index of the operand.
 
 - 
getInputObjectspublic java.lang.Object[] getInputObjects() Description copied from interface:InstructionGet the Input objects used by this instruction. These could be Scalars, Registers, Addresses- Specified by:
- getInputObjectsin interface- Instruction
- Returns:
- an array of objects that are used by this instruction
 
 - 
getResultObjectspublic java.lang.Object[] getResultObjects() Description copied from interface:InstructionGet the Result objects produced/affected by this instruction These would probably only be Register or Address- Specified by:
- getResultObjectsin interface- Instruction
- Returns:
- an array of objects that are affected by this instruction
 
 - 
getDefaultOperandRepresentationpublic java.lang.String getDefaultOperandRepresentation(int opIndex) Description copied from interface:InstructionGet the operand representation for the given operand index without markup.- Specified by:
- getDefaultOperandRepresentationin interface- Instruction
- Parameters:
- opIndex- operand index
- Returns:
- operand represented as a string.
 
 - 
getDefaultOperandRepresentationListpublic java.util.List<java.lang.Object> getDefaultOperandRepresentationList(int opIndex) Description copied from interface:InstructionGet the operand representation for the given operand index. A list of Register, Address, Scalar, Character and String objects is returned - without markup!- Specified by:
- getDefaultOperandRepresentationListin interface- Instruction
- Parameters:
- opIndex- operand index
- Returns:
- ArrayList of pieces of the operand representation. Unsupported languages may return null.
 
 - 
getSeparatorpublic java.lang.String getSeparator(int opIndex) Description copied from interface:InstructionGet the separator strings between an operand. The separator string for 0 are the characters before the first operand. The separator string for numOperands+1 are the characters after the last operand.- Specified by:
- getSeparatorin interface- Instruction
- Parameters:
- opIndex- valid values are 0 thru numOperands+1
- Returns:
- separator string, or null if there is no string
 
 - 
getOperandTypepublic int getOperandType(int opIndex) Description copied from interface:InstructionGet the type of a specific operand.- Specified by:
- getOperandTypein interface- Instruction
- Parameters:
- opIndex- the index of the operand. (zero based)
- Returns:
- the type of the operand.
 
 - 
getOperandRefTypepublic RefType getOperandRefType(int index) Description copied from interface:InstructionGet the operand reference type for the given operand index.- Specified by:
- getOperandRefTypein interface- Instruction
- Parameters:
- index- operand index
 
 - 
getDefaultFallThroughOffsetpublic int getDefaultFallThroughOffset() Description copied from interface:InstructionGet default fall-through offset in bytes from start of instruction to the fallthrough instruction. This accounts for any instructions contained with delay slots.- Specified by:
- getDefaultFallThroughOffsetin interface- Instruction
- Returns:
- default fall-through offset or zero (0) if instruction has no fallthrough
 
 - 
getDefaultFallThroughpublic Address getDefaultFallThrough() Description copied from interface:InstructionGet the default fallthrough for this instruction. This accounts for any instructions contained with delay slots.- Specified by:
- getDefaultFallThroughin interface- Instruction
- Returns:
- fall-through address or null if instruction has no default fallthrough
 
 - 
getFallThroughpublic Address getFallThrough() Description copied from interface:InstructionGet the fallthrough for this instruction, factoring in any fallthrough override and delay slotted instructions.- Specified by:
- getFallThroughin interface- Instruction
- Returns:
- fall-through address or null if instruction has no fallthrough
 
 - 
getFallFrompublic Address getFallFrom() Description copied from interface:InstructionGet the Address for the instruction that fell through to this instruction. This is useful for handling instructions that are found in a delay slot.- Specified by:
- getFallFromin interface- Instruction
 
 - 
getFlowspublic Address[] getFlows() Description copied from interface:InstructionGet an array of Address objects for all flows other than a fall-through. This will include any flow references which have been added to the instruction.- Specified by:
- getFlowsin interface- Instruction
- Returns:
- flow addresses or null if there are no flows
 
 - 
getDefaultFlowspublic Address[] getDefaultFlows() Description copied from interface:InstructionGet an array of Address objects for all default flows established by the underlying instruction prototype. References are ignored.- Specified by:
- getDefaultFlowsin interface- Instruction
- Returns:
- flow addresses or null if there are no flows
 
 - 
getFlowTypepublic FlowType getFlowType() Description copied from interface:InstructionGet the flow type of this instruction (how this instruction flows to the next instruction).- Specified by:
- getFlowTypein interface- Instruction
 
 - 
isFallthroughpublic boolean isFallthrough() Description copied from interface:InstructionReturns true if this instruction has no execution flow other than fall-through.- Specified by:
- isFallthroughin interface- Instruction
 
 - 
hasFallthroughpublic boolean hasFallthrough() Description copied from interface:InstructionReturns true if this instruction has a fall-through flow.- Specified by:
- hasFallthroughin interface- Instruction
 
 - 
getFlowOverridepublic FlowOverride getFlowOverride() Description copied from interface:InstructionReturns the flow override which may have been set on this instruction.- Specified by:
- getFlowOverridein interface- Instruction
 
 - 
setFlowOverridepublic void setFlowOverride(FlowOverride flowOverride) Description copied from interface:InstructionSet the flow override for this instruction.- Specified by:
- setFlowOverridein interface- Instruction
 
 - 
getPcodepublic PcodeOp[] getPcode() Description copied from interface:InstructionGet an array of PCode operations (micro code) that this instruction performs. Flow overrides are not factored into pcode.- Specified by:
- getPcodein interface- Instruction
- Returns:
- an array of Pcode operations, a zero length array if the language does not support PCode
 
 - 
getPcodepublic PcodeOp[] getPcode(boolean includeOverrides) Description copied from interface:InstructionGet an array of PCode operations (micro code) that this instruction performs. NOTE: If includeOverrides is true, unique temporary varnodes may be produced which vary in size to those produced for other instructions. If your analysis is sensitive to this you should consider usingInstructionPrototype#getPcode(ghidra.program.model.mem.MemBuffer, ProcessorContext, FlowOverride, ghidra.program.model.address.UniqueAddressFactory)instead with your ownUniqueAddressFactoryto prevent duplication within your scope of analysis. by this method may not be suitable for use with certain analysis- Specified by:
- getPcodein interface- Instruction
- Parameters:
- includeOverrides- if true any flow overrides will be factored into generated pcode.
- Returns:
- an array of Pcode operations, a zero length array if the language does not support PCode
 
 - 
getPcodepublic PcodeOp[] getPcode(int opIndex) Description copied from interface:InstructionGet an array of PCode operations (micro code) that a particular operand performs to compute its value.- Specified by:
- getPcodein interface- Instruction
- Parameters:
- opIndex- index of the operand to retrieve PCode
- Returns:
- an array of PCode operations, a zero length array if the language does not support PCode
 
 - 
getDelaySlotDepthpublic int getDelaySlotDepth() Description copied from interface:InstructionGet the number of delay slot instructions for this argument. This should be 0 for instructions which don't have a delay slot. This is used to support the delay slots found on some RISC processors such as SPARC and the PA-RISC. This returns an integer instead of a boolean in case some other processor executes more than one instruction from a delay slot.- Specified by:
- getDelaySlotDepthin interface- Instruction
 
 - 
isInDelaySlotpublic boolean isInDelaySlot() Description copied from interface:InstructionReturn true if this instruction was disassembled in a delay slot- Specified by:
- isInDelaySlotin interface- Instruction
 
 - 
getNextpublic Instruction getNext() Description copied from interface:InstructionGet the instruction following this one in address order.- Specified by:
- getNextin interface- Instruction
 
 - 
getPreviouspublic Instruction getPrevious() Description copied from interface:InstructionGet the instruction before this one in address order.- Specified by:
- getPreviousin interface- Instruction
 
 - 
setFallThroughpublic void setFallThrough(Address addr) Description copied from interface:InstructionOverrides the instruction's default fallthrough address to the given address. The given address may be null to indicate that the instruction has no fallthrough.- Specified by:
- setFallThroughin interface- Instruction
- Parameters:
- addr- the address to be used as this instructions fallthrough address. May be null.
 
 - 
clearFallThroughOverridepublic void clearFallThroughOverride() Description copied from interface:InstructionRestores this instruction's fallthrough address back to the default fallthrough for this instruction.- Specified by:
- clearFallThroughOverridein interface- Instruction
 
 - 
isFallThroughOverriddenpublic boolean isFallThroughOverridden() Description copied from interface:InstructionReturns true if this instructions fallthrough has been overriden.- Specified by:
- isFallThroughOverriddenin interface- Instruction
 
 - 
getInstructionContextpublic InstructionContext getInstructionContext() - Specified by:
- getInstructionContextin interface- Instruction
 
 
- 
 
-