Class StructuredAnalysis<E>
- java.lang.Object
-
- soot.dava.toolkits.base.AST.structuredAnalysis.StructuredAnalysis<E>
-
- Direct Known Subclasses:
CP,MustMayInitialize,ReachingCopies,ReachingDefs,UnreachableCodeFinder
public abstract class StructuredAnalysis<E> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGstatic booleanDEBUG_IFstatic booleanDEBUG_STATEMENTSstatic booleanDEBUG_TRYstatic booleanDEBUG_WHILEintMERGETYPE
-
Constructor Summary
Constructors Constructor Description StructuredAnalysis()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DavaFlowSet<E>cloneFlowSet(DavaFlowSet<E> flowSet)Make a clone of the flowset The implementor should know when they want a shallow or deep clonevoiddebug(String debug)voiddebug(String methodName, String debug)abstract DavaFlowSet<E>emptyFlowSet()DavaFlowSet<E>getAfterSet(Object afterThis)DavaFlowSet<E>getBeforeSet(Object beforeThis)StringgetLabel(ASTNode node)returns label on the ASTNode null if the ASTNode cannot hold a label or if the label is nullDavaFlowSet<E>handleBreak(String label, DavaFlowSet<E> out, ASTNode node)Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non nullDavaFlowSet<E>handleContinue(String label, DavaFlowSet<E> out, ASTNode node)Need to handleContinue stmts There can be explicit continues (in which case label is non null) There can always be implicit continues ASTNode is non nullbooleanisDifferent(DavaFlowSet<E> oldObj, DavaFlowSet<E> newObj)DavaFlowSet<E>merge(DavaFlowSet<E> in1, DavaFlowSet<E> in2)DavaFlowSet<E>mergeExplicitAndImplicit(String label, DavaFlowSet<E> output, List<DavaFlowSet<E>> explicitSet, List<DavaFlowSet<E>> implicitSet)abstract DavaFlowSet<E>newInitialFlow()voidprint(Object toPrint)DavaFlowSet<E>process(Object body, DavaFlowSet<E> input)DavaFlowSet<E>processAbruptStatements(Stmt s, DavaFlowSet<E> input)Whenever a statement has to be processed the first step is to invoke this method.DavaFlowSet<E>processASTDoWhileNode(ASTDoWhileNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTForLoopNode(ASTForLoopNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTIfElseNode(ASTIfElseNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTIfNode(ASTIfNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTLabeledBlockNode(ASTLabeledBlockNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTMethodNode(ASTMethodNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTNode(ASTNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTStatementSequenceNode(ASTStatementSequenceNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTSwitchNode(ASTSwitchNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTTryNode(ASTTryNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node, DavaFlowSet<E> input)DavaFlowSet<E>processASTWhileNode(ASTWhileNode node, DavaFlowSet<E> input)DavaFlowSet<E>processCondition(ASTCondition cond, DavaFlowSet<E> input)This implementation breaks down the aggregated condition to the terminal conditions which all have type ASTUnaryBinaryCondition.DavaFlowSet<E>processSingleSubBodyNode(ASTNode node, DavaFlowSet<E> input)This method is called from the specialized ASTNodes.abstract DavaFlowSet<E>processStatement(Stmt s, DavaFlowSet<E> input)Specific stmts within AST Constructs are processed through this method.abstract DavaFlowSet<E>processSwitchKey(Value key, DavaFlowSet<E> input)Deal with the key in the switch constructabstract DavaFlowSet<E>processSynchronizedLocal(Local local, DavaFlowSet<E> input)To deal with the local used for synch blocksabstract DavaFlowSet<E>processUnaryBinaryCondition(ASTUnaryBinaryCondition cond, DavaFlowSet<E> input)To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separately.abstract voidsetMergeType()
-
-
-
Method Detail
-
setMergeType
public abstract void setMergeType()
-
newInitialFlow
public abstract DavaFlowSet<E> newInitialFlow()
-
emptyFlowSet
public abstract DavaFlowSet<E> emptyFlowSet()
-
cloneFlowSet
public abstract DavaFlowSet<E> cloneFlowSet(DavaFlowSet<E> flowSet)
Make a clone of the flowset The implementor should know when they want a shallow or deep clone
-
processStatement
public abstract DavaFlowSet<E> processStatement(Stmt s, DavaFlowSet<E> input)
Specific stmts within AST Constructs are processed through this method. It will be invoked everytime a stmt is encountered
-
processUnaryBinaryCondition
public abstract DavaFlowSet<E> processUnaryBinaryCondition(ASTUnaryBinaryCondition cond, DavaFlowSet<E> input)
To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separately. To be able to deal with entire aggregated conditions the user should wite their own implementation of the method processCondition
-
processSynchronizedLocal
public abstract DavaFlowSet<E> processSynchronizedLocal(Local local, DavaFlowSet<E> input)
To deal with the local used for synch blocks
-
processSwitchKey
public abstract DavaFlowSet<E> processSwitchKey(Value key, DavaFlowSet<E> input)
Deal with the key in the switch construct
-
print
public void print(Object toPrint)
-
processCondition
public DavaFlowSet<E> processCondition(ASTCondition cond, DavaFlowSet<E> input)
This implementation breaks down the aggregated condition to the terminal conditions which all have type ASTUnaryBinaryCondition. Once these are obtained the abstract method processUnaryBinaryCondition is invoked. For aggregated conditions the merging is done in a depth first order of the condition tree.
-
process
public DavaFlowSet<E> process(Object body, DavaFlowSet<E> input)
-
processASTNode
public DavaFlowSet<E> processASTNode(ASTNode node, DavaFlowSet<E> input)
-
processSingleSubBodyNode
public final DavaFlowSet<E> processSingleSubBodyNode(ASTNode node, DavaFlowSet<E> input)
This method is called from the specialized ASTNodes. The purpose was to deal with different ASTNodes with similar structure in one go. The method will deal with retrieve the body of the ASTNode which are known to have only one subBody
-
getLabel
public String getLabel(ASTNode node)
returns label on the ASTNode null if the ASTNode cannot hold a label or if the label is null
-
processAbruptStatements
public DavaFlowSet<E> processAbruptStatements(Stmt s, DavaFlowSet<E> input)
Whenever a statement has to be processed the first step is to invoke this method. This is to remove the tedious work of adding code to deal with abrupt control flow from the programmer of the analysis. The method invokes the processStatement method for all other statements A programmer can decide to override this method if they want to do something specific
-
processASTMethodNode
public DavaFlowSet<E> processASTMethodNode(ASTMethodNode node, DavaFlowSet<E> input)
-
processASTStatementSequenceNode
public DavaFlowSet<E> processASTStatementSequenceNode(ASTStatementSequenceNode node, DavaFlowSet<E> input)
-
processASTLabeledBlockNode
public DavaFlowSet<E> processASTLabeledBlockNode(ASTLabeledBlockNode node, DavaFlowSet<E> input)
-
processASTSynchronizedBlockNode
public DavaFlowSet<E> processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node, DavaFlowSet<E> input)
-
processASTIfNode
public DavaFlowSet<E> processASTIfNode(ASTIfNode node, DavaFlowSet<E> input)
-
processASTIfElseNode
public DavaFlowSet<E> processASTIfElseNode(ASTIfElseNode node, DavaFlowSet<E> input)
-
processASTWhileNode
public DavaFlowSet<E> processASTWhileNode(ASTWhileNode node, DavaFlowSet<E> input)
-
processASTDoWhileNode
public DavaFlowSet<E> processASTDoWhileNode(ASTDoWhileNode node, DavaFlowSet<E> input)
-
processASTUnconditionalLoopNode
public DavaFlowSet<E> processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node, DavaFlowSet<E> input)
-
processASTForLoopNode
public DavaFlowSet<E> processASTForLoopNode(ASTForLoopNode node, DavaFlowSet<E> input)
-
processASTSwitchNode
public DavaFlowSet<E> processASTSwitchNode(ASTSwitchNode node, DavaFlowSet<E> input)
-
processASTTryNode
public DavaFlowSet<E> processASTTryNode(ASTTryNode node, DavaFlowSet<E> input)
-
merge
public DavaFlowSet<E> merge(DavaFlowSet<E> in1, DavaFlowSet<E> in2)
-
mergeExplicitAndImplicit
public DavaFlowSet<E> mergeExplicitAndImplicit(String label, DavaFlowSet<E> output, List<DavaFlowSet<E>> explicitSet, List<DavaFlowSet<E>> implicitSet)
-
handleBreak
public DavaFlowSet<E> handleBreak(String label, DavaFlowSet<E> out, ASTNode node)
Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non null
-
handleContinue
public DavaFlowSet<E> handleContinue(String label, DavaFlowSet<E> out, ASTNode node)
Need to handleContinue stmts There can be explicit continues (in which case label is non null) There can always be implicit continues ASTNode is non null
-
isDifferent
public boolean isDifferent(DavaFlowSet<E> oldObj, DavaFlowSet<E> newObj)
-
getBeforeSet
public DavaFlowSet<E> getBeforeSet(Object beforeThis)
-
getAfterSet
public DavaFlowSet<E> getAfterSet(Object afterThis)
-
debug
public void debug(String debug)
-
-