Class DFA4<InsnType extends IInstruction>

java.lang.Object
com.pnfsoftware.jeb.core.units.code.DFA4<InsnType>
All Implemented Interfaces:
IDFA<InsnType>

public class DFA4<InsnType extends IInstruction> extends Object implements IDFA<InsnType>
Lean Data Flow Analysis (DFA) object implementation.
  • Field Details

    • CACHE_NONE

      public static final int CACHE_NONE
      Nothing is cached
      See Also:
    • CACHE_DUI

      public static final int CACHE_DUI
      Cache basic def/use information at the instruction level
      See Also:
    • CACHE_DUI_CHAINS

      public static final int CACHE_DUI_CHAINS
      CACHE_DUI + cache standard ud-chains and du-chains
      See Also:
    • CACHE_DUI_UDC_DUC

      public static final int CACHE_DUI_UDC_DUC
      Deprecated.
      use CACHE_DUI_CHAINS instead
      See Also:
    • dbgDuCacheTotalQueryCount

      public static final AtomicLong dbgDuCacheTotalQueryCount
    • dbgDuCacheTotalHitCount

      public static final AtomicLong dbgDuCacheTotalHitCount
    • dbgDuCalculationTotalExectimeNs

      public static final AtomicLong dbgDuCalculationTotalExectimeNs
    • dbgUdCacheTotalQueryCount

      public static final AtomicLong dbgUdCacheTotalQueryCount
    • dbgUdCacheTotalHitCount

      public static final AtomicLong dbgUdCacheTotalHitCount
    • dbgUdCalculationTotalExectimeNs

      public static final AtomicLong dbgUdCalculationTotalExectimeNs
    • dbgVrCacheTotalQueryCount

      public static final AtomicLong dbgVrCacheTotalQueryCount
    • dbgVrCacheTotalHitCount

      public static final AtomicLong dbgVrCacheTotalHitCount
    • dbgVrCalculationTotalExectimeNs

      public static final AtomicLong dbgVrCalculationTotalExectimeNs
  • Constructor Details

    • DFA4

      public DFA4(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. 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 in DefUseInfo
      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 interface IDFA<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 interface IDFA<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 interface IDFA<InsnType extends IInstruction>
    • notifyInstructionUpdate

      public void notifyInstructionUpdate(long addr)
      Specified by:
      notifyInstructionUpdate in interface IDFA<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 interface IDFA<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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr0 - address of the start instruction, which defines the variable being substituted; it is assumed that this instruction is no-throw
      addr1coll - mandatory collection of addresses where the substitutions will take place place
      srccoll - 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 variable X by an immediate. This method should be called after the substitution by an immediate took place.
      Specified by:
      invalidatePostSimpleSubstitutionWithMultiDefs in interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr0coll - collection of equivalent source instructions defining a target var X (e.g. X=3); these instructions must be left as-is when calling this method; it is assumed that these instructions are no-throw
      addr1 - destination instruction, whose target variable X was replaced by a constant
      varid - 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 interface IDFA<InsnType extends IInstruction>
      Returns:
    • setVariableCollectionFlags

      public void setVariableCollectionFlags(int flags)
      Description copied from interface: IDFA
      Set the variable collection flags.
      Specified by:
      setVariableCollectionFlags in interface IDFA<InsnType extends IInstruction>
      Parameters:
      flags - flags, see DefUseInfo
    • getVariableCollectionFlags

      public int getVariableCollectionFlags()
      Description copied from interface: IDFA
      Retrieve the variable collection flags.
      Specified by:
      getVariableCollectionFlags in interface IDFA<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 of CACHE_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 interface IDFA<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 interface IDFA<InsnType extends IInstruction>
    • setAlwaysExamineIrregularFlows

      public boolean setAlwaysExamineIrregularFlows(boolean enabled)
      Specified by:
      setAlwaysExamineIrregularFlows in interface IDFA<InsnType extends IInstruction>
      Returns:
      the previous value for this setting
    • isAlwaysExamineIrregularFlows

      public boolean isAlwaysExamineIrregularFlows()
      Specified by:
      isAlwaysExamineIrregularFlows in interface IDFA<InsnType extends IInstruction>
    • setVariableInformationProvider

      public ICFGOwnerContext setVariableInformationProvider(ICFGOwnerContext provider)
      Specified by:
      setVariableInformationProvider in interface IDFA<InsnType extends IInstruction>
      Returns:
      the previously set provider
    • getVariableInformationProvider

      public ICFGOwnerContext getVariableInformationProvider()
      Specified by:
      getVariableInformationProvider in interface IDFA<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 interface IDFA<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. See IDFA.setMaxBlocks(int) for details.
      Specified by:
      getMaxBlocks in interface IDFA<InsnType extends IInstruction>
      Returns:
    • formatDUI

      public String formatDUI(DUI o)
    • getDUI

      public DUI getDUI(long addr)
      Specified by:
      getDUI in interface IDFA<InsnType extends IInstruction>
      Returns:
    • getDUI

      public DUI getDUI(AddressableInstruction<InsnType> a)
      Specified by:
      getDUI in interface IDFA<InsnType extends IInstruction>
      Returns:
    • getDUI

      public DUI getDUI(long addr, InsnType insn)
      Specified by:
      getDUI in interface IDFA<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 collected
      stopcount - the search will stop if the def-count reaches that threshold; use <=0 to mean no stopcount
      verifyStartOnUsePoint - 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 list
      blkForReachChains - optional basic block used to record reaching variables
      idxForReachChains - optional block index used to record reaching variables
      aDetectedUseDiscrepancy - 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 true
      treatSpoiledAsDefs - if true, spoiled information for variables will be treated as a regular definition
      maxBlocks - 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 block
      limitToStartBlock -
      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

      public Collection<Long> getUseDefs(long addr, int varid)
      Specified by:
      getUseDefs in interface IDFA<InsnType extends IInstruction>
      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
    • getUseDefs

      public Collection<Long> getUseDefs(long addr, int varid, int stopCount)
      Specified by:
      getUseDefs in interface IDFA<InsnType extends IInstruction>
      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
    • getBlockUseDefs

      public Collection<Long> getBlockUseDefs(long addr, int varid)
      Specified by:
      getBlockUseDefs in interface IDFA<InsnType extends IInstruction>
    • isTerminator

      public boolean isTerminator(IBasicBlock<InsnType> blk)
      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 interface IDFA<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 variable
      stopcount - the search will stop if the use-count reaches that threshold; use <= 0 to mean no stopcount
      verifyStartOnDefPoint - 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 -1
      blkForLiveChains - optional basic block used to record live variables
      idxForLiveChains - optional block index used to record live variables
      maxBlocks - 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 block
      limitToStartBlock - 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

      public Collection<Long> getDefUses(long addr, int varid)
      Specified by:
      getDefUses in interface IDFA<InsnType extends IInstruction>
      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
    • getDefUses

      public Collection<Long> getDefUses(long addr, int varid, int stopCount)
      Specified by:
      getDefUses in interface IDFA<InsnType extends IInstruction>
      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
    • getDefUses

      public Collection<Long> getDefUses(long addr, int varid, int stopCount, boolean recordReachOut)
      Specified by:
      getDefUses in interface IDFA<InsnType extends IInstruction>
      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
    • getBlockDefUses

      public Collection<Long> getBlockDefUses(long addr, int varid)
      Specified by:
      getBlockDefUses in interface IDFA<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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr - 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
    • 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 interface IDFA<InsnType extends IInstruction>
      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
    • 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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr - 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
    • checkSingleUse

      public Long checkSingleUse(long addr, int varid, boolean reachOutIsUse)
      Parameters:
      addr -
      varid -
      reachOutIsUse -
      Returns:
    • checkSingleUse

      public Long checkSingleUse(long addr, int varid)
      Specified by:
      checkSingleUse in interface IDFA<InsnType extends IInstruction>
      Returns:
    • checkSingleDef

      public Long checkSingleDef(long addr, int varid, boolean liveInIsDef)
      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 address
      varid - used variable at the initial instruction
      liveInIsDef -
      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

      public Long checkSingleDefNoInput(long addr, int varid)
      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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr - initial instruction address
      varid - used variable at the initial instruction
      Returns:
    • checkSingleDef

      public Long checkSingleDef(long addr, int varid)
      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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      addr - initial instruction address
      varid - used variable at the initial instruction (it must be used at the provided address; else, refer to checkSingleSource)
      Returns:
    • checkSingleSource

      public Long checkSingleSource(long addr, int varid, boolean liveInIsDef)
      Specified by:
      checkSingleSource in interface IDFA<InsnType extends IInstruction>
      Returns:
    • checkSingleSource

      public Long checkSingleSource(long addr, int varid)
      Specified by:
      checkSingleSource in interface IDFA<InsnType extends IInstruction>
      Returns:
    • collectInstructionAllDefs

      public void collectInstructionAllDefs(long addr, Collection<Integer> r)
      Specified by:
      collectInstructionAllDefs in interface IDFA<InsnType extends IInstruction>
    • collectInstructionAllUses

      public void collectInstructionAllUses(long addr, Collection<Integer> r)
      Specified by:
      collectInstructionAllUses in interface IDFA<InsnType extends IInstruction>
    • getInstructionAllDefs

      public Set<Integer> getInstructionAllDefs(long addr)
      Specified by:
      getInstructionAllDefs in interface IDFA<InsnType extends IInstruction>
    • getInstructionAllUses

      public Set<Integer> getInstructionAllUses(long addr)
      Specified by:
      getInstructionAllUses in interface IDFA<InsnType extends IInstruction>
    • getInstructionDefs

      public Set<Integer> getInstructionDefs(long addr)
      Specified by:
      getInstructionDefs in interface IDFA<InsnType extends IInstruction>
      Returns:
      a list of variables defined by the instruction at index in the block
    • getInstructionUses

      public Set<Integer> getInstructionUses(long addr)
      Specified by:
      getInstructionUses in interface IDFA<InsnType extends IInstruction>
      Returns:
      a list of variables used by the instruction at index in the block
    • getInstructionPotentialDefs

      public Set<Integer> getInstructionPotentialDefs(long addr)
      Specified by:
      getInstructionPotentialDefs in interface IDFA<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

      public Set<Integer> getInstructionPotentialUses(long addr)
      Specified by:
      getInstructionPotentialUses in interface IDFA<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

      public Set<Integer> getInstructionSpoiledDefs(long addr)
      Specified by:
      getInstructionSpoiledDefs in interface IDFA<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

      public Map<Integer,Collection<Long>> getUseDefChains(long addr, boolean recordLiveIn)
    • getUseDefChains

      public Map<Integer,Collection<Long>> getUseDefChains(long addr)
      Specified by:
      getUseDefChains in interface IDFA<InsnType extends IInstruction>
    • getDefUseChains

      public Map<Integer,Collection<Long>> getDefUseChains(long addr, boolean recordReachOut)
    • getDefUseChains

      public Map<Integer,Collection<Long>> getDefUseChains(long addr)
      Specified by:
      getDefUseChains in interface IDFA<InsnType extends IInstruction>
    • getLiveChains

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

      public Collection<Long> getLiveChains(IBasicBlock<InsnType> b, int idx, int varid)
      Specified by:
      getLiveChains in interface IDFA<InsnType extends IInstruction>
    • getLiveChains

      public Collection<Long> getLiveChains(IBasicBlock<InsnType> b, int idx, int varid, int stopcount)
      Specified by:
      getLiveChains in interface IDFA<InsnType extends IInstruction>
    • getLiveChains

      public Map<Integer,Collection<Long>> getLiveChains(IBasicBlock<InsnType> b, int idx)
      Specified by:
      getLiveChains in interface IDFA<InsnType extends IInstruction>
    • isAlive

      public boolean isAlive(IBasicBlock<InsnType> b, int idx, int varid)
      Specified by:
      isAlive in interface IDFA<InsnType extends IInstruction>
    • getReachChains

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

      public Collection<Long> getReachChains(IBasicBlock<InsnType> b, int idx, int varid)
      Specified by:
      getReachChains in interface IDFA<InsnType extends IInstruction>
    • getReachChains

      public Collection<Long> getReachChains(IBasicBlock<InsnType> b, int idx, int varid, int stopcount)
      Specified by:
      getReachChains in interface IDFA<InsnType extends IInstruction>
    • getReachChains

      public Map<Integer,Collection<Long>> getReachChains(IBasicBlock<InsnType> b, int idx)
      Specified by:
      getReachChains in interface IDFA<InsnType extends IInstruction>
    • isReaching

      public boolean isReaching(IBasicBlock<InsnType> b, int idx, int varid)
      Specified by:
      isReaching in interface IDFA<InsnType extends IInstruction>
    • getUseDiscrepancies

      public Collection<Integer> getUseDiscrepancies(long addr)
      Description copied from interface: IDFA
      Retrieve the list of use-discrepancies at the provided instruction address.
      Specified by:
      getUseDiscrepancies in interface IDFA<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 interface IDFA<InsnType extends IInstruction>
      Returns:
    • checkInput

      public boolean checkInput(int varid)
    • getInputs

      public Collection<Integer> getInputs()
      Specified by:
      getInputs in interface IDFA<InsnType extends IInstruction>
    • filterInputs

      public Collection<Integer> filterInputs(Collection<Integer> varids)
      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

      public Map<Integer,Collection<Long>> getInputsWithUses()
      Returns:
    • checkInputWithUses

      public Collection<Long> checkInputWithUses(int varid)
    • filterInputsWithUses

      public Map<Integer,Collection<Long>> filterInputsWithUses(Collection<Integer> varids)
      Parameters:
      varids -
      Returns:
    • getInputMap

      public Map<Integer,Collection<Long>> getInputMap()
      Specified by:
      getInputMap in interface IDFA<InsnType extends IInstruction>
    • getInputMap

      public Collection<Long> getInputMap(int varid)
      Specified by:
      getInputMap in interface IDFA<InsnType extends IInstruction>
    • checkOutput

      public boolean checkOutput(IBasicBlock<InsnType> blk, int varid)
    • getOutputs

      public Collection<Integer> getOutputs(IBasicBlock<InsnType> blk)
      Specified by:
      getOutputs in interface IDFA<InsnType extends IInstruction>
    • filterOutputs

      public Collection<Integer> filterOutputs(IBasicBlock<InsnType> blk, Collection<Integer> varids)
    • getOutputsWithDefs

      public Map<Integer,Collection<Long>> getOutputsWithDefs(IBasicBlock<InsnType> blk)
    • checkOutputsWithDefs

      public Collection<Long> checkOutputsWithDefs(IBasicBlock<InsnType> blk, int varid)
    • filterOutputsWithDefs

      public Map<Integer,Collection<Long>> filterOutputsWithDefs(IBasicBlock<InsnType> blk, Collection<Integer> varids)
    • getOutputMap

      public Map<Integer,Collection<Long>> getOutputMap(IBasicBlock<InsnType> blk)
      Specified by:
      getOutputMap in interface IDFA<InsnType extends IInstruction>
    • getOutputMap

      public Collection<Long> getOutputMap(IBasicBlock<InsnType> blk, int varid)
      Specified by:
      getOutputMap in interface IDFA<InsnType extends IInstruction>
    • checkOutput

      public boolean checkOutput(int varid)
    • getOutputs

      public Collection<Integer> getOutputs()
      Specified by:
      getOutputs in interface IDFA<InsnType extends IInstruction>
    • filterOutputs

      public Collection<Integer> filterOutputs(Collection<Integer> varids)
    • getOutputsWithDefs

      public Map<Integer,Collection<Long>> getOutputsWithDefs()
    • checkOutputsWithDefs

      public Collection<Long> checkOutputsWithDefs(int varid)
    • filterOutputsWithDefs

      public Map<Integer,Collection<Long>> filterOutputsWithDefs(Collection<Integer> varids)
    • getOutputMap

      public Map<Integer,Collection<Long>> getOutputMap()
      Specified by:
      getOutputMap in interface IDFA<InsnType extends IInstruction>
    • getOutputMap

      public Collection<Long> getOutputMap(int varid)
      Specified by:
      getOutputMap in interface IDFA<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

      public Boolean isVarReachingFromTo(int varid, long addr0, long addr1)
      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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      varid - variable id
      addr0 - source: start address, exclusive
      addr1 - 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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      varid - variable id
      b0 - start block (source)
      i0 - final block (sink)
      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
    • 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 interface IDFA<InsnType extends IInstruction>
      Parameters:
      varid - variable id
      b0 - start block (source)
      i0 - final block (sink)
      b1 - index of the start instruction in the start block, exclusive
      i1 - index of the final instruction in the final block, also exclusive
      maxBlocks - 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

      public Boolean verifyNoRedefAfterSink(int varid, long addr0, long addr1)
    • verifyNoRedefAfterSink

      public Boolean verifyNoRedefAfterSink(int varid, IBasicBlock<InsnType> b0, int i0, IBasicBlock<InsnType> b1, int i1, int maxBlocks)
    • toString

      public String toString()
      Overrides:
      toString in class Object