Package it.unive.lisa

Class LiSAConfiguration


  • public class LiSAConfiguration
    extends java.lang.Object
    A holder for the configuration of a LiSA analysis.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LiSAConfiguration.GraphType
      The type of graphs that can be dumped by LiSA.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_WIDENING_THRESHOLD
      The default number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
    • Constructor Summary

      Constructors 
      Constructor Description
      LiSAConfiguration()
      Builds a new configuration object, with default settings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      LiSAConfiguration addSemanticCheck​(it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?> check)
      Adds the given semantic check to the ones that will be executed.
      LiSAConfiguration addSemanticChecks​(java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?>> checks)
      Adds the given semantic checks to the ones that will be executed.
      LiSAConfiguration addSyntacticCheck​(it.unive.lisa.checks.syntactic.SyntacticCheck check)
      Adds the given syntactic check to the ones that will be executed.
      LiSAConfiguration addSyntacticChecks​(java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> checks)
      Adds the given syntactic checks to the ones that will be executed.
      boolean equals​(java.lang.Object obj)  
      it.unive.lisa.analysis.AbstractState<?,​?,​?,​?> getAbstractState()
      Yields the AbstractState for the analysis.
      LiSAConfiguration.GraphType getAnalysisGraphs()
      Yields whether or not the results of analysis, if run, should be dumped in the form of graphs representing results on single CFGs.
      it.unive.lisa.interprocedural.callgraph.CallGraph getCallGraph()
      Yields the CallGraph for the analysis.
      java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> getFixpointWorkingSet()
      Yields the concrete class of WorkingSet to be used in fixpoints.
      it.unive.lisa.interprocedural.InterproceduralAnalysis<?,​?,​?,​?> getInterproceduralAnalysis()
      Yields the InterproceduralAnalysis for the analysis.
      it.unive.lisa.interprocedural.OpenCallPolicy getOpenCallPolicy()
      Yields the OpenCallPolicy to use during the analysis.
      java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?>> getSemanticChecks()
      Yields the collection of SemanticChecks that are to be executed during the analysis.
      java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> getSyntacticChecks()
      Yields the collection of SyntacticChecks that are to be executed during the analysis.
      int getWideningThreshold()
      Yields the number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
      java.lang.String getWorkdir()
      Yields the working directory where LiSA will dump all of its outputs.
      int hashCode()  
      boolean isJsonOutput()
      Yields whether or not a json report file should be dumped at the end of the analysis.
      boolean isSerializeResults()
      Yields whether or not the results of the analyses should be dumped in the form of json graphs.
      LiSAConfiguration setAbstractState​(it.unive.lisa.analysis.AbstractState<?,​?,​?,​?> state)
      Sets the AbstractState to use for the analysis.
      LiSAConfiguration setCallGraph​(it.unive.lisa.interprocedural.callgraph.CallGraph callGraph)
      Sets the CallGraph to use for the analysis.
      LiSAConfiguration setDumpAnalysis​(LiSAConfiguration.GraphType analysisGraphs)
      Sets whether or not graph files, named analysis__<cfg name>.<format>, should be created and dumped in the working directory at the end of the analysis.
      LiSAConfiguration setFixpointWorkingSet​(java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet)
      Sets the concrete class of WorkingSet to be used in fixpoints.
      LiSAConfiguration setInterproceduralAnalysis​(it.unive.lisa.interprocedural.InterproceduralAnalysis<?,​?,​?,​?> analysis)
      Sets the InterproceduralAnalysis to use for the analysis.
      LiSAConfiguration setJsonOutput​(boolean jsonOutput)
      Sets whether or not a json report file, named report.json, should be created and dumped in the working directory at the end of the analysis.
      LiSAConfiguration setOpenCallPolicy​(it.unive.lisa.interprocedural.OpenCallPolicy openCallPolicy)
      Sets the OpenCallPolicy to use during the analysis.
      LiSAConfiguration setSerializeResults​(boolean serializeResults)
      Sets whether or not the results of the analyses should be dumped in the form of json graphs.
      LiSAConfiguration setWideningThreshold​(int wideningThreshold)
      Sets the number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
      LiSAConfiguration setWorkdir​(java.lang.String workdir)
      Sets the working directory for this instance of LiSA, that is, the directory files will be created, if any.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_WIDENING_THRESHOLD

        public static final int DEFAULT_WIDENING_THRESHOLD
        The default number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
        See Also:
        Constant Field Values
    • Constructor Detail

      • LiSAConfiguration

        public LiSAConfiguration()
        Builds a new configuration object, with default settings. By default:
        • no syntactic check is executed
        • no AbstractState is set for the analysis
        • no CallGraph is set for the analysis
        • no InterproceduralAnalysis is set for the analysis
        • the workdir is the one where LiSA was executed
        • the results of the analysis will not be dumped
        • the results of the analysis will not be serialized
        • the json report will not be dumped
        • the default warning threshold (5) will be used
        • the open call policy used is WorstCasePolicy
    • Method Detail

      • addSyntacticCheck

        public LiSAConfiguration addSyntacticCheck​(it.unive.lisa.checks.syntactic.SyntacticCheck check)
        Adds the given syntactic check to the ones that will be executed. These checks will be immediately executed after LiSA is started.
        Parameters:
        check - the check to execute
        Returns:
        the current (modified) configuration
      • addSyntacticChecks

        public LiSAConfiguration addSyntacticChecks​(java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> checks)
        Adds the given syntactic checks to the ones that will be executed. These checks will be immediately executed after LiSA is started.
        Parameters:
        checks - the checks to execute
        Returns:
        the current (modified) configuration
      • addSemanticCheck

        public LiSAConfiguration addSemanticCheck​(it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?> check)
        Adds the given semantic check to the ones that will be executed. These checks will be executed after the fixpoint iteration has been completed.
        Parameters:
        check - the check to execute
        Returns:
        the current (modified) configuration
      • addSemanticChecks

        public LiSAConfiguration addSemanticChecks​(java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?>> checks)
        Adds the given semantic checks to the ones that will be executed. These checks will be executed after the fixpoint iteration has been completed.
        Parameters:
        checks - the checks to execute
        Returns:
        the current (modified) configuration
      • setCallGraph

        public LiSAConfiguration setCallGraph​(it.unive.lisa.interprocedural.callgraph.CallGraph callGraph)
        Sets the CallGraph to use for the analysis. Any existing value is overwritten.
        Parameters:
        callGraph - the callgraph to use
        Returns:
        the current (modified) configuration
      • setInterproceduralAnalysis

        public LiSAConfiguration setInterproceduralAnalysis​(it.unive.lisa.interprocedural.InterproceduralAnalysis<?,​?,​?,​?> analysis)
        Sets the InterproceduralAnalysis to use for the analysis. Any existing value is overwritten.
        Parameters:
        analysis - the interprocedural analysis to use
        Returns:
        the current (modified) configuration
      • setAbstractState

        public LiSAConfiguration setAbstractState​(it.unive.lisa.analysis.AbstractState<?,​?,​?,​?> state)
        Sets the AbstractState to use for the analysis. Any existing value is overwritten.
        Parameters:
        state - the abstract state to use
        Returns:
        the current (modified) configuration
      • setDumpAnalysis

        public LiSAConfiguration setDumpAnalysis​(LiSAConfiguration.GraphType analysisGraphs)
        Sets whether or not graph files, named analysis__<cfg name>.<format>, should be created and dumped in the working directory at the end of the analysis. These files will contain a graph representing each input CFGs' structure, and whose nodes will contain a representation of the results of the semantic analysis on each Statement.

        To customize where the graphs should be generated, use setWorkdir(String).
        Parameters:
        analysisGraphs - whether graphs will be generated containing the results of the analysis, and in what format
        Returns:
        the current (modified) configuration
      • setJsonOutput

        public LiSAConfiguration setJsonOutput​(boolean jsonOutput)
        Sets whether or not a json report file, named report.json, should be created and dumped in the working directory at the end of the analysis. This file will contain all the Warnings that have been generated, as well as a list of produced files.

        To customize where the report should be generated, use setWorkdir(String).
        Parameters:
        jsonOutput - if true, a json report will be generated after the analysis
        Returns:
        the current (modified) configuration
      • setSerializeResults

        public LiSAConfiguration setSerializeResults​(boolean serializeResults)
        Sets whether or not the results of the analyses should be dumped in the form of json graphs.
        Parameters:
        serializeResults - whether or not the graphs should be produced
        Returns:
        the current (modified) configuration
      • setWorkdir

        public LiSAConfiguration setWorkdir​(java.lang.String workdir)
        Sets the working directory for this instance of LiSA, that is, the directory files will be created, if any. If files need to be created and this method has not been invoked, LiSA will create them in the directory where it was executed from.
        Parameters:
        workdir - the path (relative or absolute) to the working directory
        Returns:
        the current (modified) configuration
      • setFixpointWorkingSet

        public LiSAConfiguration setFixpointWorkingSet​(java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> fixpointWorkingSet)
        Sets the concrete class of WorkingSet to be used in fixpoints.
        Parameters:
        fixpointWorkingSet - the class
        Returns:
        the current (modified) configuration
      • setWideningThreshold

        public LiSAConfiguration setWideningThreshold​(int wideningThreshold)
        Sets the number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
        Parameters:
        wideningThreshold - the threshold
        Returns:
        the current (modified) configuration
      • setOpenCallPolicy

        public LiSAConfiguration setOpenCallPolicy​(it.unive.lisa.interprocedural.OpenCallPolicy openCallPolicy)
        Sets the OpenCallPolicy to use during the analysis.
        Parameters:
        openCallPolicy - the policy to use
        Returns:
        the current (modified) configuration
      • getCallGraph

        public it.unive.lisa.interprocedural.callgraph.CallGraph getCallGraph()
        Yields the CallGraph for the analysis. Might be null if none was set.
        Returns:
        the call graph for the analysis
      • getInterproceduralAnalysis

        public it.unive.lisa.interprocedural.InterproceduralAnalysis<?,​?,​?,​?> getInterproceduralAnalysis()
        Yields the InterproceduralAnalysis for the analysis. Might be null if none was set.
        Returns:
        the interprocedural analysis for the analysis
      • getAbstractState

        public it.unive.lisa.analysis.AbstractState<?,​?,​?,​?> getAbstractState()
        Yields the AbstractState for the analysis. Might be null if none was set.
        Returns:
        the abstract state for the analysis
      • getSyntacticChecks

        public java.util.Collection<it.unive.lisa.checks.syntactic.SyntacticCheck> getSyntacticChecks()
        Yields the collection of SyntacticChecks that are to be executed during the analysis.
        Returns:
        the syntactic checks
      • getSemanticChecks

        public java.util.Collection<it.unive.lisa.checks.semantic.SemanticCheck<?,​?,​?,​?>> getSemanticChecks()
        Yields the collection of SemanticChecks that are to be executed during the analysis.
        Returns:
        the semantic checks
      • getAnalysisGraphs

        public LiSAConfiguration.GraphType getAnalysisGraphs()
        Yields whether or not the results of analysis, if run, should be dumped in the form of graphs representing results on single CFGs.
        Returns:
        whether or not the graphs should be dumped, and in what format
      • isJsonOutput

        public boolean isJsonOutput()
        Yields whether or not a json report file should be dumped at the end of the analysis.
        Returns:
        true if the report should be produced
      • isSerializeResults

        public boolean isSerializeResults()
        Yields whether or not the results of the analyses should be dumped in the form of json graphs.
        Returns:
        true if the graphs should be produced
      • getWorkdir

        public java.lang.String getWorkdir()
        Yields the working directory where LiSA will dump all of its outputs.
        Returns:
        the working directory
      • getFixpointWorkingSet

        public java.lang.Class<? extends it.unive.lisa.util.collections.workset.WorkingSet<it.unive.lisa.program.cfg.statement.Statement>> getFixpointWorkingSet()
        Yields the concrete class of WorkingSet to be used in fixpoints.
        Returns:
        the working set class
      • getWideningThreshold

        public int getWideningThreshold()
        Yields the number of fixpoint iteration on a given node after which calls to Lattice.lub(Lattice) gets replaced with Lattice.widening(Lattice).
        Returns:
        the widening threshold
      • getOpenCallPolicy

        public it.unive.lisa.interprocedural.OpenCallPolicy getOpenCallPolicy()
        Yields the OpenCallPolicy to use during the analysis.
        Returns:
        the policy
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object