public abstract class

AbstractCFGReorganizer

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

Class Overview

Facility for CFG graph nodes reordering. Trampoline blocks will be created to ensure the original execution flow is maintained.

Summary

Public Constructors
AbstractCFGReorganizer(CFG<InsnType> cfg)
Public Methods
Map<Long, Long> getConversionMap()
Retrieve a map holding the old offsets to their corresponding new offsets, in the reorganized CFG.
CFG<InsnType> getReorganizedCfg()
Retrieve a CFG reorganized by reorder(int[]).
CFG<InsnType> reorder(int[] newOrder)
Protected Methods
abstract CFG<InsnType> buildCFG(List<InsnType> statements)
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.
abstract InsnType createNop(int insnSize)
abstract InsnType createTrampoline(long tempTarget)
Create a trampoline instruction whose size must be 1.
abstract boolean hasTargets(InsnType insn)
Determine whether the instruction has targets that may be updated.
abstract void updateTargets(InsnType insn, Map<Long, Long> map)
abstract void updateTrampolineTarget(InsnType insn, long target)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AbstractCFGReorganizer (CFG<InsnType> cfg)

Public Methods

public Map<Long, Long> getConversionMap ()

Retrieve a map holding the old offsets to their corresponding new offsets, in the reorganized CFG.

public CFG<InsnType> getReorganizedCfg ()

Retrieve a CFG reorganized by reorder(int[]).

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

Protected Methods

protected abstract CFG<InsnType> buildCFG (List<InsnType> statements)

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.

protected abstract InsnType createNop (int insnSize)

protected abstract InsnType createTrampoline (long tempTarget)

Create a trampoline instruction whose size must be 1.

protected abstract boolean hasTargets (InsnType insn)

Determine whether the instruction has targets that may be updated.

protected abstract void updateTargets (InsnType insn, Map<Long, Long> map)

protected abstract void updateTrampolineTarget (InsnType insn, long target)

Parameters
insn must be a trampoline instruction