Class AbstractInstructionManager<T extends IInstruction>

java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.processor.AbstractInstructionManager<T>
Type Parameters:
T - instruction type managed by this object
All Implemented Interfaces:
CFBytesTrie.IKeyExtractor<T>

public abstract class AbstractInstructionManager<T extends IInstruction> extends Object implements CFBytesTrie.IKeyExtractor<T>
A skeleton class used to create instruction managers.
  • Constructor Details

    • AbstractInstructionManager

      public AbstractInstructionManager()
      Create an instruction manager with an empty cache.
  • Method Details

    • getInstruction

      public T getInstruction(BytesBlock block) throws ProcessorException
      Retrieve or decode an instruction for the provided byte block.
      Parameters:
      block - instruction bytes
      Returns:
      decoded instruction
      Throws:
      ProcessorException - on decoding error
    • retrieveInstructionFromCache

      protected T retrieveInstructionFromCache(T instruction)
    • findInstruction

      protected abstract T findInstruction(BytesBlock block) throws ProcessorException
      Throws:
      ProcessorException
    • useCache

      protected boolean useCache(BytesBlock block)
    • buildKey

      protected byte[] buildKey(BytesBlock block)
    • raiseUndefined

      protected static void raiseUndefined(byte[] code) throws ProcessorException
      Throws:
      ProcessorException
    • getUndefinedMessage

      protected static String getUndefinedMessage(byte[] code)
    • getUnpredictableMessage

      protected static String getUnpredictableMessage(byte[] code, String mnemonic)
    • extract

      public byte[] extract(T object)
      Description copied from interface: CFBytesTrie.IKeyExtractor
      Extract a key from an object.
      Specified by:
      extract in interface CFBytesTrie.IKeyExtractor<T extends IInstruction>
      Parameters:
      object - object
      Returns:
      key bytes
    • clearCache

      public void clearCache()
      Clear the decoded instruction cache.