Class InstructionUtil

java.lang.Object
com.pnfsoftware.jeb.core.units.code.InstructionUtil

public class InstructionUtil extends Object
Utility methods for IInstruction objects.
  • Method Details

    • getOperand

      public static IInstructionOperand getOperand(IInstruction insn, int index)
      Safely retrieve an operand.
      Parameters:
      insn - instruction
      index - operand index
      Returns:
      null on error
    • getOperand

      public static <T extends IInstructionOperand> T getOperand(IInstruction insn, int index, Class<T> c)
      Safely retrieve an operand of the expected type.
      Type Parameters:
      T - operand type
      Parameters:
      insn - instruction
      index - operand index
      c - expected operand type
      Returns:
      null on error
    • getSizeOf

      public static int getSizeOf(List<? extends IInstruction> insns)
      Compute the size of all the instruction list.
      Parameters:
      insns - instruction list
      Returns:
      the size, in bytes
    • getSizeUntil

      public static int getSizeUntil(List<? extends IInstruction> insns, int limit)
      Compute the size of the instruction list until nth index.
      Parameters:
      insns - instruction list
      limit - nth index.
      Returns:
      the size, in bytes