java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.units.code.android.controlflow.AbstractGraphReorganizer<InsnType extends com.pnfsoftware.jeb.core.units.code.ILocatedInstruction> |
Facility for CFG graph nodes reordering and graph address shifting.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractGraphReorganizer(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) | ||||||||||
void |
shift(int shsize)
Shift the CFG 'downward', ie, all addresses.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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(long insnOffset, int insnSize) | ||||||||||
abstract InsnType | createTrampoline(long insnOffset, long tempTarget) | ||||||||||
abstract boolean |
hasTargets(InsnType insn)
Determine whether the instruction has targets that may be updated.
| ||||||||||
abstract InsnType |
updateInstructionOffset(InsnType insn, long insnOffset)
Update or copy the provided instruction and set its offset.
| ||||||||||
abstract void | updateTargets(InsnType insn, Map<Long, Long> map) | ||||||||||
abstract void | updateTrampolineTarget(InsnType insn, long target) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Retrieve a map holding the old offsets to their corresponding new offsets, in the reorganized CFG.
newOrder | an array of 0-based indices from 0 to n-1; providing [0, 1, ..., n-1] does nothing |
---|
Shift the CFG 'downward', ie, all addresses. This method works in-place; no new CFG is
created (unlike reorder(int[])
).
shsize | a strictly positive value; else the method will throw |
---|
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.
Determine whether the instruction has targets that may be updated.
Update or copy the provided instruction and set its offset. It is up to the implementation to decide whether instructions should be copied (consequence: the original CFG may be fully preserved, at the cost of speed and resources) or reused.
insn | original instruction |
---|---|
insnOffset | new offset |
insn | must be a trampoline instruction |
---|