Class AbstractCFGReorganizer<InsnType extends IInstruction>

java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.cfg.AbstractCFGReorganizer<InsnType>

public abstract class AbstractCFGReorganizer<InsnType extends IInstruction> extends Object
Facility for CFG graph nodes reordering. Trampoline blocks will be created to ensure the original execution flow is maintained.
  • Constructor Details

    • AbstractCFGReorganizer

      public AbstractCFGReorganizer(CFG<InsnType> cfg)
  • Method Details

    • reorder

      public CFG<InsnType> reorder(int[] newOrder)
      Parameters:
      newOrder - an array of 0-based indices from 0 to n-1; providing [0, 1, ..., n-1] does nothing
      Returns:
      a reordered CFG; null if the provided order was the original order
    • getReorganizedCfg

      public CFG<InsnType> getReorganizedCfg()
      Retrieve a CFG reorganized by reorder(int[]).
      Returns:
    • getConversionMap

      public Map<Long,Long> getConversionMap()
      Retrieve a map holding the old offsets to their corresponding new offsets, in the reorganized CFG.
      Returns:
    • canFallthrough

      protected abstract boolean canFallthrough(InsnType insn)
      Determine if the provided instruction is a flow breaker that falls-through (or may, if it's a conditional branch) into the first instruction of the next block.
      Parameters:
      insn -
      Returns:
    • createTrampoline

      protected abstract InsnType createTrampoline(long tempTarget)
      Create a trampoline instruction whose size must be 1.
      Parameters:
      tempTarget -
      Returns:
    • createNop

      protected abstract InsnType createNop(int insnSize)
      Parameters:
      insnSize -
      Returns:
    • updateTrampolineTarget

      protected abstract void updateTrampolineTarget(InsnType insn, long target)
      Parameters:
      insn - must be a trampoline instruction
      target -
    • hasTargets

      protected abstract boolean hasTargets(InsnType insn)
      Determine whether the instruction has targets that may be updated.
      Parameters:
      insn -
      Returns:
    • updateTargets

      protected abstract void updateTargets(InsnType insn, Map<Long,Long> map)
      Parameters:
      insn -
      map -
    • buildCFG

      protected abstract CFG<InsnType> buildCFG(List<InsnType> statements)
      Parameters:
      statements -
      Returns: