public interface

IDFA

com.pnfsoftware.jeb.core.units.code.IDFA<InsnType extends com.pnfsoftware.jeb.core.units.code.IInstruction>
Known Indirect Subclasses

Class Overview

Specification of a data flow analysis objects for control flow graphs.

Summary

Constants
int STANDARD_COLLECTION_FLAGS Standard setting for variable collection flags: conservative.
boolean STANDARD_INTEGRATE_INPUTS Standard setting for routine inputs integration into output maps and reaching-register chains: enabled.
Public Methods
abstract int checkNoUse(long insnAddress, int varId, boolean reachOutIsUse, int maxBlocks)
Check whether a variable, defined at the provided instruction, is not used.
abstract boolean checkNoUse(long insnAddress, int varId)
Check whether a variable, defined at the provided instruction, is not used.
abstract boolean checkNoUse(long insnAddress, int varId, boolean reachOutIsUse)
Check whether a variable, defined at the provided instruction, is not used.
abstract boolean checkSingleDef(long addr, int varid, long expectedDefAddress)
abstract Long checkSingleDef(long addr, int varid)
Check whether a used variable has a single definition point.
abstract Long checkSingleDefNoInput(long addr, int varid)
Check whether a used variable has a single explicit definition point.
abstract Long checkSingleSource(long addr, int varid, boolean liveInIsDef)
abstract Long checkSingleSource(long addr, int varid)
abstract boolean checkSingleSource(long addr, int varid, long expectedSourceAddress)
abstract Long checkSingleUse(long addr, int varid)
abstract boolean checkSingleUse(long addr, int varid, long expectedUseAddress)
abstract void collectInstructionAllDefs(long addr, Collection<Integer> r)
abstract void collectInstructionAllUses(long addr, Collection<Integer> r)
abstract Collection<Long> getBlockDefUses(long addr, int varid)
abstract IControlFlowGraph<InsnType, IBasicBlock<InsnType>> getCfg()
Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.
abstract DUI getDUI(AddressableInstruction<InsnType> a)
abstract DUI getDUI(long addr)
abstract DUI getDUI(long addr, InsnType insn)
abstract Map<Integer, Collection<Long>> getDefUseChains(long addr)
abstract Collection<Long> getDefUses(long addr, int varid, int stopCount, boolean recordReachOut)
abstract Collection<Long> getDefUses(long addr, int varid, int stopCount)
abstract Collection<Long> getDefUses(long addr, int varid)
abstract Collection<Long> getInputMap(int varid)
abstract Map<Integer, Collection<Long>> getInputMap()
abstract Collection<Integer> getInputs()
abstract Collection<Integer> getInstructionAllDefs(long addr)
abstract Collection<Integer> getInstructionAllUses(long addr)
abstract Collection<Integer> getInstructionDefs(long addr)
abstract Collection<Integer> getInstructionPotentialDefs(long addr)
abstract Collection<Integer> getInstructionPotentialUses(long addr)
abstract Collection<Integer> getInstructionSpoiledDefs(long addr)
abstract Collection<Integer> getInstructionUses(long addr)
abstract Map<Integer, Collection<Long>> getLiveChains(IBasicBlock<InsnType> b, int idx)
abstract Collection<Long> getLiveChains(IBasicBlock<InsnType> b, int idx, int varid)
abstract int getMaxBlocks()
Retrieve the maximum block count used for common DFA operations.
abstract Map<Integer, Collection<Long>> getOutputMap()
abstract Collection<Long> getOutputMap(IBasicBlock<InsnType> blk, int varid)
abstract Collection<Long> getOutputMap(int varid)
abstract Map<Integer, Collection<Long>> getOutputMap(IBasicBlock<InsnType> blk)
abstract Collection<Integer> getOutputs(IBasicBlock<InsnType> blk)
abstract Collection<Integer> getOutputs()
abstract Collection<Long> getReachChains(IBasicBlock<InsnType> b, int idx, int varid)
abstract Map<Integer, Collection<Long>> getReachChains(IBasicBlock<InsnType> b, int idx)
abstract Map<Integer, Collection<Long>> getUseDefChains(long addr)
abstract Collection<Long> getUseDefs(long addr, int varid, int stopCount)
abstract Collection<Long> getUseDefs(long addr, int varid)
abstract Collection<Integer> getUseDiscrepancies(long addr)
Retrieve the list of use-discrepancies at the provided instruction address.
abstract int getVariableCollectionFlags()
Retrieve the variable collection flags.
abstract ICFGOwnerContext getVariableInformationProvider()
abstract void invalidate()
Invalidate the analysis.
abstract boolean isConservative()
Convenience method used to determine whether the variable collection flags are CONSERVATIVE.
abstract boolean isIntegrateCalculatedInputRegisters()
abstract boolean isNotRedefined(int varid, long addr0, long addr1)
Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction.
abstract boolean isNotRedefined(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1)
Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction.
abstract boolean isTerminator(IBasicBlock<InsnType> blk)
Determine whether the provided block is a terminator.
abstract boolean isUseDiscrepancy(long addr, int varid)
abstract boolean isValid()
Determine whether the current analysis was performed and is valid.
abstract Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1)
Determine if a variable used by the start instruction reaches the final instruction with the same value.
abstract Boolean isVarReachingFromTo(int varid, long addr0, long addr1)
Determine if a variable used by the start instruction reaches the final instruction with the same value.
abstract void notifyInstructionUpdate(long addr)
abstract void perform()
Perform data flow analysis on the CFG.
abstract void setConservative()
Convenience method used to set or remove CONSERVATIVE variable collection flags.
abstract void setIntegrateCalculatedInputRegisters(boolean integrateCalculatedInputRegisters)
abstract int setMaxBlocks(int maxBlocks)
Set an exploration threshold for most DFA operations.
abstract void setVariableCollectionFlags(int varCollectionFlags)
Set the variable collection flags.
abstract void setVariableInformationProvider(ICFGOwnerContext varInfoProvider)

Constants

public static final int STANDARD_COLLECTION_FLAGS

Standard setting for variable collection flags: conservative.

Constant Value: 3 (0x00000003)

public static final boolean STANDARD_INTEGRATE_INPUTS

Standard setting for routine inputs integration into output maps and reaching-register chains: enabled.

Constant Value: true

Public Methods

public abstract int checkNoUse (long insnAddress, int varId, boolean reachOutIsUse, int maxBlocks)

Check whether a variable, defined at the provided instruction, is not used.

Parameters
insnAddress initial instruction address
varId defined variable at the initial instruction
Returns
  • 1: some uses; 0: no use; -1: no use, but may be a meaningful output; -2: unknown (may be returned only if maxBlocks is positive); -3: error

public abstract boolean checkNoUse (long insnAddress, int varId)

Check whether a variable, defined at the provided instruction, is not used.

Parameters
insnAddress initial instruction address
varId defined variable at the initial instruction
Returns
  • true if the variable is not used; reaching-out is not considered a use

public abstract boolean checkNoUse (long insnAddress, int varId, boolean reachOutIsUse)

Check whether a variable, defined at the provided instruction, is not used.

Parameters
insnAddress initial instruction address
varId defined variable at the initial instruction
Returns
  • true if the variable is not used, and optionally (if reachOutIsUse is true), is overwritten before reaching possible end-blocks

public abstract boolean checkSingleDef (long addr, int varid, long expectedDefAddress)

public abstract Long checkSingleDef (long addr, int varid)

Check whether a used variable has a single definition point. The def point may be explicit (e.g. resulting from an assignment) or implicit (e.g. provided as a parameter to the routine, which is always represented as the address -1).

Parameters
addr initial instruction address
varid used variable at the initial instruction

public abstract Long checkSingleDefNoInput (long addr, int varid)

Check whether a used variable has a single explicit definition point. The def point cannot be a routine input (i.e. the definition must be explicit).

Parameters
addr initial instruction address
varid used variable at the initial instruction

public abstract Long checkSingleSource (long addr, int varid, boolean liveInIsDef)

public abstract Long checkSingleSource (long addr, int varid)

public abstract boolean checkSingleSource (long addr, int varid, long expectedSourceAddress)

public abstract Long checkSingleUse (long addr, int varid)

public abstract boolean checkSingleUse (long addr, int varid, long expectedUseAddress)

public abstract void collectInstructionAllDefs (long addr, Collection<Integer> r)

public abstract void collectInstructionAllUses (long addr, Collection<Integer> r)

public abstract Collection<Long> getBlockDefUses (long addr, int varid)

public abstract IControlFlowGraph<InsnType, IBasicBlock<InsnType>> getCfg ()

Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.

public abstract DUI getDUI (AddressableInstruction<InsnType> a)

public abstract DUI getDUI (long addr)

public abstract DUI getDUI (long addr, InsnType insn)

public abstract Map<Integer, Collection<Long>> getDefUseChains (long addr)

public abstract Collection<Long> getDefUses (long addr, int varid, int stopCount, boolean recordReachOut)

Parameters
addr instruction address
varid a variable, which must be defined by the provided instruction
stopCount optional stop count (-1 to collect as many uses as possible)
recordReachOut if true, a variable reaching is considered used (if so, the output list will contain -1)
Returns
  • a collection (possibly empty) or null if the variable is not defined by the instruction

public abstract Collection<Long> getDefUses (long addr, int varid, int stopCount)

Parameters
addr instruction address
varid a variable, which must be defined by the provided instruction
stopCount optional stop count (-1 to collect as many uses as possible)
Returns
  • a collection (possibly empty) or null if the variable is not defined by the instruction

public abstract Collection<Long> getDefUses (long addr, int varid)

Parameters
addr instruction address
varid a variable, which must be defined by the provided instruction
Returns
  • a collection (possibly empty) or null if the variable is not defined by the instruction

public abstract Collection<Long> getInputMap (int varid)

public abstract Map<Integer, Collection<Long>> getInputMap ()

public abstract Collection<Integer> getInputs ()

public abstract Collection<Integer> getInstructionAllDefs (long addr)

public abstract Collection<Integer> getInstructionAllUses (long addr)

public abstract Collection<Integer> getInstructionDefs (long addr)

Returns
  • a list of variables defined by the instruction at index in the block

public abstract Collection<Integer> getInstructionPotentialDefs (long addr)

Returns
  • a list of variables potentially defined by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings

public abstract Collection<Integer> getInstructionPotentialUses (long addr)

Returns
  • a list of variables potentially used by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings

public abstract Collection<Integer> getInstructionSpoiledDefs (long addr)

Returns
  • a list of variables potentially spoiled by the instruction at index in the block; note that this data may not be present (empty lists) depending on DFA settings

public abstract Collection<Integer> getInstructionUses (long addr)

Returns
  • a list of variables used by the instruction at index in the block

public abstract Map<Integer, Collection<Long>> getLiveChains (IBasicBlock<InsnType> b, int idx)

public abstract Collection<Long> getLiveChains (IBasicBlock<InsnType> b, int idx, int varid)

public abstract int getMaxBlocks ()

Retrieve the maximum block count used for common DFA operations. See setMaxBlocks(int) for details.

public abstract Map<Integer, Collection<Long>> getOutputMap ()

public abstract Collection<Long> getOutputMap (IBasicBlock<InsnType> blk, int varid)

public abstract Collection<Long> getOutputMap (int varid)

public abstract Map<Integer, Collection<Long>> getOutputMap (IBasicBlock<InsnType> blk)

public abstract Collection<Integer> getOutputs (IBasicBlock<InsnType> blk)

public abstract Collection<Integer> getOutputs ()

public abstract Collection<Long> getReachChains (IBasicBlock<InsnType> b, int idx, int varid)

public abstract Map<Integer, Collection<Long>> getReachChains (IBasicBlock<InsnType> b, int idx)

public abstract Map<Integer, Collection<Long>> getUseDefChains (long addr)

public abstract Collection<Long> getUseDefs (long addr, int varid, int stopCount)

Parameters
addr instruction address
varid a variable, which must be used by the provided instruction
Returns
  • a collection (possibly empty) or null if the variable is not used by the instruction

public abstract Collection<Long> getUseDefs (long addr, int varid)

Parameters
addr instruction address
varid a variable, which must be used by the provided instruction
Returns
  • a collection (possibly empty) or null if the variable is not used by the instruction

public abstract Collection<Integer> getUseDiscrepancies (long addr)

Retrieve the list of use-discrepancies at the provided instruction address.

Parameters
addr instruction address
Returns
  • a list of variables whose usage at the provided location appears to be incorrect (i.e. not all paths to this usage carry a definition if the variable)

public abstract int getVariableCollectionFlags ()

Retrieve the variable collection flags.

Returns

public abstract ICFGOwnerContext getVariableInformationProvider ()

public abstract void invalidate ()

Invalidate the analysis. Clients have the responsibility to invalidate an analysis if the CFG was modified in such a way that data flow should be recalculated.

public abstract boolean isConservative ()

Convenience method used to determine whether the variable collection flags are CONSERVATIVE.

public abstract boolean isIntegrateCalculatedInputRegisters ()

public abstract boolean isNotRedefined (int varid, long addr0, long addr1)

Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction. (Note that this method does not verify that varid actually has definitions reaching the start or final instruction; it is up to the caller to verify that.)

Parameters
varid variable id
addr0 start address, exclusive
addr1 final address, also exclusive
Returns
  • true if the variable was not redefined

public abstract boolean isNotRedefined (int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1)

Determine if a variable reaching a start instruction has not been redefined when it reaches a final instruction. (Note that this method does not verify that varid actually has definitions reaching the start or final instruction; it is up to the caller to verify that.)

Parameters
varid variable id
b0 start block
i0 final block
b1 index of the start instruction in the start block, exclusive
i1 index of the final instruction in the final block, also exclusive
Returns
  • true if the variable was not redefined

public abstract boolean isTerminator (IBasicBlock<InsnType> blk)

Determine whether the provided block is a terminator. A terminator has no output and its final instruction is a clean routine terminator.

Parameters
blk block to test
Returns
  • true if the block is a clean terminator

public abstract boolean isUseDiscrepancy (long addr, int varid)

public abstract boolean isValid ()

Determine whether the current analysis was performed and is valid.

public abstract Boolean isVarReachingFromTo (int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1)

Determine if a variable used by the start instruction reaches the final instruction with the same value.

Parameters
varid variable id
b0 start block
i0 final block
b1 index of the start instruction in the start block, exclusive
i1 index of the final instruction in the final block, also exclusive
Returns
  • success indicator; null means unknown

public abstract Boolean isVarReachingFromTo (int varid, long addr0, long addr1)

Determine if a variable used by the start instruction reaches the final instruction with the same value.

Parameters
varid variable id
addr0 start address, exclusive
addr1 final address, also exclusive
Returns
  • success indicator; null means unknown

public abstract void notifyInstructionUpdate (long addr)

public abstract void perform ()

Perform data flow analysis on the CFG. Upon return, basic blocks will have their data chains (ud and du, full and simple) set up and accessible.

public abstract void setConservative ()

Convenience method used to set or remove CONSERVATIVE variable collection flags.

public abstract void setIntegrateCalculatedInputRegisters (boolean integrateCalculatedInputRegisters)

public abstract int setMaxBlocks (int maxBlocks)

Set an exploration threshold for most DFA operations. By default, there is no threshold. The threshold is a block count; if a block count is reached, a chain may contain a reference to the invalid address -2 in order to indicate an incomplete result.

Parameters
maxBlocks -1 means no limit
Returns
  • the previous value for this setting

public abstract void setVariableCollectionFlags (int varCollectionFlags)

Set the variable collection flags.

Parameters
varCollectionFlags flags, see DefUseInfo

public abstract void setVariableInformationProvider (ICFGOwnerContext varInfoProvider)