Class AbstractInstructionOperandGeneric
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.processor.AbstractInstructionOperandGeneric
- All Implemented Interfaces:
IInstructionOperandGeneric
,IInstructionOperandRegisterBased
,IInstructionOperandSized
,IInstructionOperand
- Direct Known Subclasses:
AbstractInstructionOperandList
,Operand
@Ser
public abstract class AbstractInstructionOperandGeneric
extends Object
implements IInstructionOperandGeneric
Reference implementation for
IInstructionOperandGeneric
.-
Field Summary
FieldsFields inherited from interface com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric
TYPE_ADDR, TYPE_ALIAS, TYPE_CMA, TYPE_IMM, TYPE_LIST, TYPE_MEMIMM, TYPE_MEMREG, TYPE_REG, TYPE_RELADDR, TYPE_SIMM, TYPE_USER_1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
format
(IInstruction insn, long address) Format the operand, assuming it is used by an instruction at the provided address.protected CharSequence
formatOperand
(IInstruction insn, long address) getAlias
(long v) Get the optional alias string to be displayed instead of a given integer value.int
Get the operand size in bits.int
Get the operand type.long
Get the value of the operand.long
getOperandValue
(long address) Get the value of the operand, adjusted (if relevant) for an instruction located at the provided address.getPrefix
(IInstruction insn) Get the optional prefix to be prepended to the formatted operand.getSuffix
(IInstruction insn) Get the optional suffix to be appended to the formatted operand.int
hashCode()
protected final String
Returns an inner representation of this object, where address is unknowntoString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric
isImmediate, isRegister
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandRegisterBased
getRegisterName
-
Field Details
-
type
protected int type -
size
protected int size -
value
protected long value
-
-
Constructor Details
-
AbstractInstructionOperandGeneric
public AbstractInstructionOperandGeneric(int type, int size, long value)
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getOperandType
public int getOperandType()Description copied from interface:IInstructionOperandGeneric
Get the operand type. Used to determine how to interpret the results provided byIInstructionOperandSized.getOperandBitsize()
andIInstructionOperandGeneric.getOperandValue()
.- Specified by:
getOperandType
in interfaceIInstructionOperandGeneric
- Returns:
- one of the
TYPE_Xxx
constants
-
getOperandBitsize
public int getOperandBitsize()Description copied from interface:IInstructionOperandSized
Get the operand size in bits.- Specified by:
getOperandBitsize
in interfaceIInstructionOperandSized
- Returns:
-
getOperandValue
public long getOperandValue()Description copied from interface:IInstructionOperandGeneric
Get the value of the operand. The interpretation of the value depends on the operand type and the underlying implementation.- Specified by:
getOperandValue
in interfaceIInstructionOperandGeneric
- Returns:
- the opaque operand value
-
getOperandValue
public long getOperandValue(long address) Description copied from interface:IInstructionOperandGeneric
Get the value of the operand, adjusted (if relevant) for an instruction located at the provided address. Example: If the operand is a memory access, this method may return "address + operand value".- Specified by:
getOperandValue
in interfaceIInstructionOperandGeneric
- Returns:
- the address-adjusted operand value
-
format
Description copied from interface:IInstructionOperand
Format the operand, assuming it is used by an instruction at the provided address.- Specified by:
format
in interfaceIInstructionOperand
- Parameters:
insn
- optional instruction using this operand. Note that this operand may not be directly returned byinsn.getOperands()
, e.g., in the case of instructions with nested operandsaddress
- optional instruction address, 0 if none. The instruction address is sometimes necessary to properly render PC-dependent operands- Returns:
- simple string representation of the operand
-
formatOperand
-
getPrefix
Description copied from interface:IInstructionOperandGeneric
Get the optional prefix to be prepended to the formatted operand.- Specified by:
getPrefix
in interfaceIInstructionOperandGeneric
- Returns:
- optional prefix
-
getSuffix
Description copied from interface:IInstructionOperandGeneric
Get the optional suffix to be appended to the formatted operand.- Specified by:
getSuffix
in interfaceIInstructionOperandGeneric
- Returns:
- optional suffix
-
getAlias
Description copied from interface:IInstructionOperandGeneric
Get the optional alias string to be displayed instead of a given integer value.- Specified by:
getAlias
in interfaceIInstructionOperandGeneric
- Returns:
- optional alias
-
toString
-
innerFormat
Returns an inner representation of this object, where address is unknown- Returns:
-