public abstract class

AbstractInstruction

extends Object
implements IInstruction
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.processor.AbstractInstruction<T extends com.pnfsoftware.jeb.core.units.code.IInstructionOperand>

Class Overview

A skeleton implementation for instructions.

Summary

Fields
protected T[] extends IInstructionOperand operands
protected int processorMode
Public Constructors
AbstractInstruction(BytesBlock code, String mnemonic, T[] operands, int processorMode)
Public Methods
boolean equals(Object obj)
String format(Object context)
Format the instruction for printing
byte[] getCode(ByteOrder byteOrder)
byte[] getCode()
Get the binary code that makes up this instruction.
BytesBlock getCodeBlock()
int getCountOfOperands()
Set<InstructionFlags> getInstructionFlags()
String getMnemonic()
The instruction mnemonic.
T getOperand(int index)
Get an operand by index.
T[] getOperands()
Get the list of operands for this instruction.
String getPrefix()
Get the instruction's optional prefix(es).
int getProcessorMode()
Get the mode the processor was in when it parsed and created this instruction.
int getSize()
Get the instruction size in bytes.
int hashCode()
String toString()
Protected Methods
CodePointer buildNextEntryPoint(long instructionAddress)
boolean isBreakingFlow(IInsnEmulator<T> emulator)
boolean isJump(IInsnEmulator<T> emulator)
boolean isRoutineCall(IInsnEmulator<T> emulator)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.IInstruction

Fields

protected T[] extends IInstructionOperand operands

protected int processorMode

Public Constructors

public AbstractInstruction (BytesBlock code, String mnemonic, T[] operands, int processorMode)

Public Methods

public boolean equals (Object obj)

public String format (Object context)

Format the instruction for printing

Parameters
context optional context, used to provide a better representation of the instruction (for instance, resolving strings or method names.) The implementor should do its best to return a decent result even if context is null.

public byte[] getCode (ByteOrder byteOrder)

public byte[] getCode ()

Get the binary code that makes up this instruction.

Returns
  • an array of bytes, or null if the instruction is abstract

public BytesBlock getCodeBlock ()

public int getCountOfOperands ()

public Set<InstructionFlags> getInstructionFlags ()

public String getMnemonic ()

The instruction mnemonic.

public T getOperand (int index)

Get an operand by index.

public T[] getOperands ()

Get the list of operands for this instruction.

Returns
  • a list (possibly empty) of operands, or null if operands are not applicable to the instruction set

public String getPrefix ()

Get the instruction's optional prefix(es).

Returns
  • the prefix (or prefix string list), null if none

public int getProcessorMode ()

Get the mode the processor was in when it parsed and created this instruction. Refer to IProcessor MODE_xxx.

Returns
  • the mode, 0 for none/default

public int getSize ()

Get the instruction size in bytes.

Returns
  • the instruction size

public int hashCode ()

public String toString ()

Protected Methods

protected CodePointer buildNextEntryPoint (long instructionAddress)

protected boolean isBreakingFlow (IInsnEmulator<T> emulator)

protected boolean isJump (IInsnEmulator<T> emulator)

protected boolean isRoutineCall (IInsnEmulator<T> emulator)