Class DFA4<InsnType extends IInstruction>
- All Implemented Interfaces:
IDFA<InsnType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Cache basic def/use information at the instruction levelstatic final int
CACHE_DUI
+ cache standard ud-chains and du-chainsstatic final int
Deprecated.static final int
Nothing is cachedstatic final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
static final AtomicLong
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.IDFA
STANDARD_COLLECTION_FLAGS, STANDARD_INTEGRATE_INPUTS
-
Constructor Summary
ConstructorsConstructorDescriptionDFA4
(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg) Create a DFA object with CFG-provided default collection flags and basic caching for instruction-level def-use information.DFA4
(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg, int collectionFlags, int cacheConfig) Create a DFA object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkInput
(int varid) checkInputWithUses
(int varid) boolean
checkNoUse
(long addr, int varid) Check whether a variable, defined at the provided instruction, is not used.boolean
checkNoUse
(long insnAddress, int varId, boolean reachOutIsUse) Check whether a variable, defined at the provided instruction, is not used.int
checkNoUse
(long addr, int varid, boolean reachOutIsUse, int maxBlocks) Check whether a variable, defined at the provided instruction, is not used.boolean
checkOutput
(int varid) boolean
checkOutput
(IBasicBlock<InsnType> blk, int varid) checkOutputsWithDefs
(int varid) checkOutputsWithDefs
(IBasicBlock<InsnType> blk, int varid) checkSingleDef
(long addr, int varid) Check whether a used variable has a single definition point.checkSingleDef
(long addr, int varid, boolean liveInIsDef) Check whether a used variable has a single explicit definition point (i.e.checkSingleDefNoInput
(long addr, int varid) Check whether a used variable has a single explicit definition point.checkSingleSource
(long addr, int varid) checkSingleSource
(long addr, int varid, boolean liveInIsDef) checkSingleUse
(long addr, int varid) checkSingleUse
(long addr, int varid, boolean reachOutIsUse) void
collectInstructionAllDefs
(long addr, Collection<Integer> r) void
collectInstructionAllUses
(long addr, Collection<Integer> r) filterInputs
(Collection<Integer> varids) filterInputsWithUses
(Collection<Integer> varids) filterOutputs
(IBasicBlock<InsnType> blk, Collection<Integer> varids) filterOutputs
(Collection<Integer> varids) filterOutputsWithDefs
(IBasicBlock<InsnType> blk, Collection<Integer> varids) filterOutputsWithDefs
(Collection<Integer> varids) getBlockDefUses
(long addr, int varid) getBlockUseDefs
(long addr, int varid) int
Retrieve the cache configuration.getCfg()
Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.getDefUseChains
(long addr) getDefUseChains
(long addr, boolean recordReachOut) getDefUses
(long addr, int varid) getDefUses
(long addr, int varid, int stopCount) getDefUses
(long addr, int varid, int stopCount, boolean recordReachOut) getDefUses
(long addr, int varid, int stopcount, boolean verifyStartOnDefPoint, boolean recordReachOut, IBasicBlock<InsnType> blkForLiveChains, int idxForLiveChains, int maxBlocks, boolean limitToStartBlock) Find the list of usage points for a defined variable.getDUI
(long addr) getInputMap
(int varid) getInstructionAllDefs
(long addr) getInstructionAllUses
(long addr) getInstructionDefs
(long addr) getInstructionPotentialDefs
(long addr) getInstructionPotentialUses
(long addr) getInstructionSpoiledDefs
(long addr) getInstructionUses
(long addr) getLiveChains
(IBasicBlock<InsnType> b, int idx) getLiveChains
(IBasicBlock<InsnType> b, int idx, int varid) getLiveChains
(IBasicBlock<InsnType> b, int idx, int varid, int stopcount) getLiveChains
(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) int
Retrieve the maximum block count used for common DFA operations.getOutputMap
(int varid) getOutputMap
(IBasicBlock<InsnType> blk) getOutputMap
(IBasicBlock<InsnType> blk, int varid) getOutputs
(IBasicBlock<InsnType> blk) getReachChains
(IBasicBlock<InsnType> b, int idx) getReachChains
(IBasicBlock<InsnType> b, int idx, int varid) getReachChains
(IBasicBlock<InsnType> b, int idx, int varid, int stopcount) getReachChains
(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) getUseDefChains
(long addr) getUseDefChains
(long addr, boolean recordLiveIn) getUseDefs
(long addr, int varid) getUseDefs
(long addr, int varid, int stopCount) getUseDefs
(long addr, int varid, int stopcount, boolean verifyStartOnUsePoint, boolean recordLiveIn, IBasicBlock<InsnType> blkForReachChains, int idxForReachChains, boolean[] aDetectedUseDiscrepancy, boolean treatSpoiledAsDefs, int maxBlocks, boolean limitToStartBlock) Find the list of definition points for a used variable.getUseDiscrepancies
(long addr) Retrieve the list of use-discrepancies at the provided instruction address.int
Retrieve the variable collection flags.void
Invalidate the analysis.void
invalidateForRemoval
(long addr0) Selectively invalidate the cache in preparation for an instruction pseudo-removal (neutering).void
invalidateForSubstitution
(long addr0, Collection<Long> addr1coll, Collection<Long> srccoll) Selectively invalidate the cache in preparation for an expression-substitution.void
invalidatePostSimpleSubstitutionWithMultiDefs
(Collection<Long> addr0coll, long addr1, int varid) Selectively invalidate DFA cache after the substitution of a variableX
by an immediate.boolean
isAlive
(IBasicBlock<InsnType> b, int idx, int varid) boolean
boolean
boolean
isNotRedefined
(int varid, long addr0, long addr1) boolean
isNotRedefined
(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) boolean
isReaching
(IBasicBlock<InsnType> b, int idx, int varid) boolean
isTerminator
(IBasicBlock<InsnType> blk) Determine whether the provided block is a terminator.boolean
isUseDiscrepancy
(long addr, int varid) boolean
isValid()
Determine whether the current analysis was performed and is valid.isVarReachingFromTo
(int varid, long addr0, long addr1) Determine if a variable used by the start instruction reaches the final instruction with the same value.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.isVarReachingFromTo
(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean allowRedef, boolean performExtendedChecks, int maxBlocks) isVarReachingFromTo
(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean performExtendedChecks, int maxBlocks) Determine if a variable used by the start instruction reaches the final instruction with the same value.void
notifyInstructionUpdate
(long addr) void
perform()
Perform data flow analysis on the CFG.void
boolean
setAlwaysExamineIrregularFlows
(boolean enabled) void
setCacheConfiguration
(int value) Set or update the cache configuration of this object.boolean
setIntegrateCalculatedInputRegisters
(boolean enabled) int
setMaxBlocks
(int maxBlocks) Set an exploration threshold for most DFA operations.void
setVariableCollectionFlags
(int flags) Set the variable collection flags.toString()
verifyNoRedefAfterSink
(int varid, long addr0, long addr1) verifyNoRedefAfterSink
(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, int maxBlocks) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.IDFA
checkSingleDef, checkSingleSource, checkSingleUse, isConservative, setConservative
-
Field Details
-
CACHE_NONE
public static final int CACHE_NONENothing is cached- See Also:
-
CACHE_DUI
public static final int CACHE_DUICache basic def/use information at the instruction level- See Also:
-
CACHE_DUI_CHAINS
public static final int CACHE_DUI_CHAINSCACHE_DUI
+ cache standard ud-chains and du-chains- See Also:
-
CACHE_DUI_UDC_DUC
public static final int CACHE_DUI_UDC_DUCDeprecated.useCACHE_DUI_CHAINS
instead- See Also:
-
dbgDuCacheTotalQueryCount
-
dbgDuCacheTotalHitCount
-
dbgDuCalculationTotalExectimeNs
-
dbgUdCacheTotalQueryCount
-
dbgUdCacheTotalHitCount
-
dbgUdCalculationTotalExectimeNs
-
dbgVrCacheTotalQueryCount
-
dbgVrCacheTotalHitCount
-
dbgVrCalculationTotalExectimeNs
-
-
Constructor Details
-
DFA4
Create a DFA object with CFG-provided default collection flags and basic caching for instruction-level def-use information. This object can be further configured by invoking its various setters.- Parameters:
cfg
-
-
DFA4
public DFA4(IControlFlowGraph<InsnType, ? extends IBasicBlock<InsnType>> cfg, int collectionFlags, int cacheConfig) Create a DFA object. This object can be further configured by invoking its various setters.- Parameters:
cfg
-collectionFlags
- collection flags, see constants inDefUseInfo
cacheConfig
- 0= no cache, 1= cached for instruction-level def-use information; 2= 1 + cache for ud-chains and du-chains
-
-
Method Details
-
perform
public void perform()Description copied from interface:IDFA
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.- Specified by:
perform
in interfaceIDFA<InsnType extends IInstruction>
-
isValid
public boolean isValid()Description copied from interface:IDFA
Determine whether the current analysis was performed and is valid.- Specified by:
isValid
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
invalidate
public void invalidate()Description copied from interface:IDFA
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.- Specified by:
invalidate
in interfaceIDFA<InsnType extends IInstruction>
-
notifyInstructionUpdate
public void notifyInstructionUpdate(long addr) - Specified by:
notifyInstructionUpdate
in interfaceIDFA<InsnType extends IInstruction>
-
resetChainCaches
public void resetChainCaches() -
invalidateForRemoval
public void invalidateForRemoval(long addr0) Description copied from interface:IDFA
Selectively invalidate the cache in preparation for an instruction pseudo-removal (neutering). This method should be called before neutering takes place.- Specified by:
invalidateForRemoval
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr0
- address of the start instruction; it is assumed that this instruction is no-throw
-
invalidateForSubstitution
public void invalidateForSubstitution(long addr0, Collection<Long> addr1coll, Collection<Long> srccoll) Description copied from interface:IDFA
Selectively invalidate the cache in preparation for an expression-substitution. This method should be called before the substitution by an immediate took place.- Specified by:
invalidateForSubstitution
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr0
- address of the start instruction, which defines the variable being substituted; it is assumed that this instruction is no-throwaddr1coll
- mandatory collection of addresses where the substitutions will take place placesrccoll
- optional collection of source instructions; if not provided, all instructions defining some of the substituted variables will be invalidated from the cache
-
invalidatePostSimpleSubstitutionWithMultiDefs
public void invalidatePostSimpleSubstitutionWithMultiDefs(Collection<Long> addr0coll, long addr1, int varid) Description copied from interface:IDFA
Selectively invalidate DFA cache after the substitution of a variableX
by an immediate. This method should be called after the substitution by an immediate took place.- Specified by:
invalidatePostSimpleSubstitutionWithMultiDefs
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr0coll
- collection of equivalent source instructions defining a target varX
(e.g. X=3); these instructions must be left as-is when calling this method; it is assumed that these instructions are no-throwaddr1
- destination instruction, whose target variableX
was replaced by a constantvarid
- the variable that was propagated (X
)
-
getCfg
Description copied from interface:IDFA
Retrieve a reference to the CFG object that will be accessed and modified when performing an analysis.- Specified by:
getCfg
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
setVariableCollectionFlags
public void setVariableCollectionFlags(int flags) Description copied from interface:IDFA
Set the variable collection flags.- Specified by:
setVariableCollectionFlags
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
flags
- flags, seeDefUseInfo
-
getVariableCollectionFlags
public int getVariableCollectionFlags()Description copied from interface:IDFA
Retrieve the variable collection flags.- Specified by:
getVariableCollectionFlags
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
- flags, see
DefUseInfo
-
setCacheConfiguration
public void setCacheConfiguration(int value) Set or update the cache configuration of this object.- Parameters:
value
- one ofCACHE_xxx
attribute
-
getCacheConfiguration
public int getCacheConfiguration()Retrieve the cache configuration.- Returns:
- value one of
CACHE_xxx
attribute
-
setIntegrateCalculatedInputRegisters
public boolean setIntegrateCalculatedInputRegisters(boolean enabled) - Specified by:
setIntegrateCalculatedInputRegisters
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
integrateCalculatedInputRegisters
- if true, the live registers determined after analysis will be integrated in the use-def chains- Returns:
- the previous value for this setting
-
isIntegrateCalculatedInputRegisters
public boolean isIntegrateCalculatedInputRegisters()- Specified by:
isIntegrateCalculatedInputRegisters
in interfaceIDFA<InsnType extends IInstruction>
-
setAlwaysExamineIrregularFlows
public boolean setAlwaysExamineIrregularFlows(boolean enabled) - Specified by:
setAlwaysExamineIrregularFlows
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
- the previous value for this setting
-
isAlwaysExamineIrregularFlows
public boolean isAlwaysExamineIrregularFlows()- Specified by:
isAlwaysExamineIrregularFlows
in interfaceIDFA<InsnType extends IInstruction>
-
setVariableInformationProvider
- Specified by:
setVariableInformationProvider
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
- the previously set provider
-
getVariableInformationProvider
- Specified by:
getVariableInformationProvider
in interfaceIDFA<InsnType extends IInstruction>
-
setMaxBlocks
public int setMaxBlocks(int maxBlocks) Description copied from interface:IDFA
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.- Specified by:
setMaxBlocks
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
maxBlocks
- -1 means no limit- Returns:
- the previous value for this setting
-
getMaxBlocks
public int getMaxBlocks()Description copied from interface:IDFA
Retrieve the maximum block count used for common DFA operations. SeeIDFA.setMaxBlocks(int)
for details.- Specified by:
getMaxBlocks
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
formatDUI
-
getDUI
- Specified by:
getDUI
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
getDUI
- Specified by:
getDUI
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
getDUI
- Specified by:
getDUI
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
getUseDefs
public Collection<Long> getUseDefs(long addr, int varid, int stopcount, boolean verifyStartOnUsePoint, boolean recordLiveIn, IBasicBlock<InsnType> blkForReachChains, int idxForReachChains, boolean[] aDetectedUseDiscrepancy, boolean treatSpoiledAsDefs, int maxBlocks, boolean limitToStartBlock) Find the list of definition points for a used variable.- Parameters:
addr
- initial instruction address (disregarded if computing reachability, in which case, blkForReachChains must be provided)varid
- used variable, for which definitions are to be collectedstopcount
- the search will stop if the def-count reaches that threshold; use <=0 to mean no stopcountverifyStartOnUsePoint
- if true, the variable must be used at the provided instruction (else the method will return null)recordLiveIn
- if true, a candidate argument-definition is recorded as -1 in the returned listblkForReachChains
- optional basic block used to record reaching variablesidxForReachChains
- optional block index used to record reaching variablesaDetectedUseDiscrepancy
- optional one-element array, if provided, any use discrepancy (using a potentially undefined variable) will interrupt the search, and this flag will be set to truetreatSpoiledAsDefs
- if true, spoiled information for variables will be treated as a regular definitionmaxBlocks
- maximum number of basic blocks to be examined; use -1 to mean all; if a positive value is provided, the returned list of addresses may contain -2 to indicate that a definition may be located in an unexplored blocklimitToStartBlock
-- Returns:
- a read-only collection of addresses where the variable was defined; the list may contain -1 to indicate a candidate argument-definition; never return null unless verifyStartOnUsePoint was true
-
getUseDefs
- Specified by:
getUseDefs
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- instruction addressvarid
- 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
-
getUseDefs
- Specified by:
getUseDefs
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- instruction addressvarid
- 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
-
getBlockUseDefs
- Specified by:
getBlockUseDefs
in interfaceIDFA<InsnType extends IInstruction>
-
isTerminator
Description copied from interface:IDFA
Determine whether the provided block is a terminator. A terminator has no output and its final instruction is a clean routine terminator.- Specified by:
isTerminator
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
blk
- block to test- Returns:
- true if the block is a clean terminator
-
getDefUses
public Collection<Long> getDefUses(long addr, int varid, int stopcount, boolean verifyStartOnDefPoint, boolean recordReachOut, IBasicBlock<InsnType> blkForLiveChains, int idxForLiveChains, int maxBlocks, boolean limitToStartBlock) Find the list of usage points for a defined variable.- Parameters:
addr
- initial instruction address (disregarded if computing liveness, in which case, blkForLiveChains must be provided)varid
- defined variablestopcount
- the search will stop if the use-count reaches that threshold; use <= 0 to mean no stopcountverifyStartOnDefPoint
- if true, the variable must be defined by the provided initial instruction (else the method will return null)recordReachOut
- if true, if the variable reaches the CFG output, a pseudo usage will be recorded as -1blkForLiveChains
- optional basic block used to record live variablesidxForLiveChains
- optional block index used to record live variablesmaxBlocks
- maximum number of basic blocks to be examined; use -1 to mean all; if a positive value is provided, the returned list of addresses may contain -2 to indicate that a usage may be located in an unexplored blocklimitToStartBlock
- if true, the exploration will stop as soon as a use is detected outside the provided starting block, where the def took place, and -2 will be added to the returned list (if true, blkForLiveChains should be null); note: unlike what maxBlocks intends to do, a -2 in the resulting collection will indicate a definite out-of-block use- Returns:
- a read-only collection of addresses where the variable is used; the list may contain -1 to indicate the the variable reached an output; never returns null unless verifyStartOnDefPoint was true
-
getDefUses
- Specified by:
getDefUses
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- instruction addressvarid
- 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
-
getDefUses
- Specified by:
getDefUses
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- instruction addressvarid
- a variable, which must be defined by the provided instructionstopCount
- 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
-
getDefUses
- Specified by:
getDefUses
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- instruction addressvarid
- a variable, which must be defined by the provided instructionstopCount
- 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
-
getBlockDefUses
- Specified by:
getBlockDefUses
in interfaceIDFA<InsnType extends IInstruction>
-
checkNoUse
public int checkNoUse(long addr, int varid, boolean reachOutIsUse, int maxBlocks) Description copied from interface:IDFA
Check whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUse
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- initial instruction addressvarid
- 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
-
checkNoUse
public boolean checkNoUse(long insnAddress, int varId, boolean reachOutIsUse) Description copied from interface:IDFA
Check whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUse
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
insnAddress
- initial instruction addressvarId
- 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
-
checkNoUse
public boolean checkNoUse(long addr, int varid) Description copied from interface:IDFA
Check whether a variable, defined at the provided instruction, is not used.- Specified by:
checkNoUse
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- initial instruction addressvarid
- defined variable at the initial instruction- Returns:
- true if the variable is not used; reaching-out is not considered a use
-
checkSingleUse
- Parameters:
addr
-varid
-reachOutIsUse
-- Returns:
-
checkSingleUse
- Specified by:
checkSingleUse
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
checkSingleDef
Check whether a used variable has a single explicit definition point (i.e. it is a non-input defined at a unique address).- Parameters:
addr
- initial instruction addressvarid
- used variable at the initial instructionliveInIsDef
-- Returns:
- the instruction address, if the variable used at the provided instruction has a single def-point; -1 is returned if the variable has no explicit def-point (as would be the case for method arguments); on error, or if multiple def-points are detected, null is returned
-
checkSingleDefNoInput
Description copied from interface:IDFA
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).- Specified by:
checkSingleDefNoInput
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- initial instruction addressvarid
- used variable at the initial instruction- Returns:
-
checkSingleDef
Description copied from interface:IDFA
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).- Specified by:
checkSingleDef
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
addr
- initial instruction addressvarid
- used variable at the initial instruction (it must be used at the provided address; else, refer tocheckSingleSource
)- Returns:
-
checkSingleSource
- Specified by:
checkSingleSource
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
checkSingleSource
- Specified by:
checkSingleSource
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
collectInstructionAllDefs
- Specified by:
collectInstructionAllDefs
in interfaceIDFA<InsnType extends IInstruction>
-
collectInstructionAllUses
- Specified by:
collectInstructionAllUses
in interfaceIDFA<InsnType extends IInstruction>
-
getInstructionAllDefs
- Specified by:
getInstructionAllDefs
in interfaceIDFA<InsnType extends IInstruction>
-
getInstructionAllUses
- Specified by:
getInstructionAllUses
in interfaceIDFA<InsnType extends IInstruction>
-
getInstructionDefs
- Specified by:
getInstructionDefs
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
- a list of variables defined by the instruction at index in the block
-
getInstructionUses
- Specified by:
getInstructionUses
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
- a list of variables used by the instruction at index in the block
-
getInstructionPotentialDefs
- Specified by:
getInstructionPotentialDefs
in interfaceIDFA<InsnType extends IInstruction>
- 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
-
getInstructionPotentialUses
- Specified by:
getInstructionPotentialUses
in interfaceIDFA<InsnType extends IInstruction>
- 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
-
getInstructionSpoiledDefs
- Specified by:
getInstructionSpoiledDefs
in interfaceIDFA<InsnType extends IInstruction>
- 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
-
getUseDefChains
-
getUseDefChains
- Specified by:
getUseDefChains
in interfaceIDFA<InsnType extends IInstruction>
-
getDefUseChains
-
getDefUseChains
- Specified by:
getDefUseChains
in interfaceIDFA<InsnType extends IInstruction>
-
getLiveChains
public Map<Integer,Collection<Long>> getLiveChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) -
getLiveChains
- Specified by:
getLiveChains
in interfaceIDFA<InsnType extends IInstruction>
-
getLiveChains
- Specified by:
getLiveChains
in interfaceIDFA<InsnType extends IInstruction>
-
getLiveChains
- Specified by:
getLiveChains
in interfaceIDFA<InsnType extends IInstruction>
-
isAlive
- Specified by:
isAlive
in interfaceIDFA<InsnType extends IInstruction>
-
getReachChains
public Map<Integer,Collection<Long>> getReachChains(IBasicBlock<InsnType> b, int idx, Collection<Integer> varids, int stopcount) -
getReachChains
- Specified by:
getReachChains
in interfaceIDFA<InsnType extends IInstruction>
-
getReachChains
- Specified by:
getReachChains
in interfaceIDFA<InsnType extends IInstruction>
-
getReachChains
- Specified by:
getReachChains
in interfaceIDFA<InsnType extends IInstruction>
-
isReaching
- Specified by:
isReaching
in interfaceIDFA<InsnType extends IInstruction>
-
getUseDiscrepancies
Description copied from interface:IDFA
Retrieve the list of use-discrepancies at the provided instruction address.- Specified by:
getUseDiscrepancies
in interfaceIDFA<InsnType extends IInstruction>
- 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)
-
isUseDiscrepancy
public boolean isUseDiscrepancy(long addr, int varid) - Specified by:
isUseDiscrepancy
in interfaceIDFA<InsnType extends IInstruction>
- Returns:
-
checkInput
public boolean checkInput(int varid) -
getInputs
- Specified by:
getInputs
in interfaceIDFA<InsnType extends IInstruction>
-
filterInputs
- Parameters:
varids
- optional collection of potential argument variables for which we want to verify uses; leave null to retrieve all potential arguments- Returns:
- a collection of variables that are used in the routine, that look like they have definitions outside the routine
-
getInputsWithUses
- Returns:
-
checkInputWithUses
-
filterInputsWithUses
- Parameters:
varids
-- Returns:
-
getInputMap
- Specified by:
getInputMap
in interfaceIDFA<InsnType extends IInstruction>
-
getInputMap
- Specified by:
getInputMap
in interfaceIDFA<InsnType extends IInstruction>
-
checkOutput
-
getOutputs
- Specified by:
getOutputs
in interfaceIDFA<InsnType extends IInstruction>
-
filterOutputs
-
getOutputsWithDefs
-
checkOutputsWithDefs
-
filterOutputsWithDefs
public Map<Integer,Collection<Long>> filterOutputsWithDefs(IBasicBlock<InsnType> blk, Collection<Integer> varids) -
getOutputMap
- Specified by:
getOutputMap
in interfaceIDFA<InsnType extends IInstruction>
-
getOutputMap
- Specified by:
getOutputMap
in interfaceIDFA<InsnType extends IInstruction>
-
checkOutput
public boolean checkOutput(int varid) -
getOutputs
- Specified by:
getOutputs
in interfaceIDFA<InsnType extends IInstruction>
-
filterOutputs
-
getOutputsWithDefs
-
checkOutputsWithDefs
-
filterOutputsWithDefs
-
getOutputMap
- Specified by:
getOutputMap
in interfaceIDFA<InsnType extends IInstruction>
-
getOutputMap
- Specified by:
getOutputMap
in interfaceIDFA<InsnType extends IInstruction>
-
isNotRedefined
public boolean isNotRedefined(int varid, long addr0, long addr1) -
isNotRedefined
public boolean isNotRedefined(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) -
isVarReachingFromTo
Description copied from interface:IDFA
Determine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- This method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromTo
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
varid
- variable idaddr0
- source: start address, exclusiveaddr1
- sink: final address, also exclusive- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1) Description copied from interface:IDFA
Determine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- This method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromTo
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
varid
- variable idb0
- start block (source)i0
- final block (sink)b1
- index of the start instruction in the start block, exclusivei1
- index of the final instruction in the final block, also exclusive- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean performExtendedChecks, int maxBlocks) Description copied from interface:IDFA
Determine if a variable used by the start instruction reaches the final instruction with the same value.Important notes:
- This method provides a must-reach result: if a multiple paths exist from source to sink, where the variable reaches the sink via some paths, but not on others (it is overwritten), the method returns false.
- This method works from the source to the sink, and provides the guarantee that the variable was not overwritten when it reached the sink. There is no guarantee provided at the sink itself regarding other paths that may exist from different sources to the same sink.
- if `performExtendedChecks` is true, this method also checks that the paths from the sink back that may connect back to the sink do not overwrite the variable defined at the source.- Specified by:
isVarReachingFromTo
in interfaceIDFA<InsnType extends IInstruction>
- Parameters:
varid
- variable idb0
- start block (source)i0
- final block (sink)b1
- index of the start instruction in the start block, exclusivei1
- index of the final instruction in the final block, also exclusivemaxBlocks
- optional maximum count of blocks to be explored before failing- Returns:
- success indicator; null means unknown
-
isVarReachingFromTo
public Boolean isVarReachingFromTo(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, boolean allowRedef, boolean performExtendedChecks, int maxBlocks) -
verifyNoRedefAfterSink
-
verifyNoRedefAfterSink
public Boolean verifyNoRedefAfterSink(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, int maxBlocks) -
toString
-
CACHE_DUI_CHAINS
instead