S - public abstract class AbstractInterproceduralAnalysis<S> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected CallGraph |
cg |
protected Map<SootMethod,S> |
data |
protected DirectedGraph<SootMethod> |
dg |
static boolean |
doCheck |
protected Map<SootMethod,Integer> |
order |
protected Map<SootMethod,S> |
unanalysed |
| Constructor and Description |
|---|
AbstractInterproceduralAnalysis(CallGraph cg,
SootMethodFilter filter,
Iterator<SootMethod> heads,
boolean verbose)
The constructor performs some preprocessing, but you have to call doAnalysis to preform the real stuff.
|
| Modifier and Type | Method and Description |
|---|---|
void |
analyseCall(S src,
Stmt callStmt,
S dst)
Analyse the call
callStmt in the context src, and put the result into dst. |
protected abstract void |
analyseMethod(SootMethod method,
S dst)
Compute the summary for a method by analysing its body.
|
protected abstract void |
applySummary(S src,
Stmt callStmt,
S summary,
S dst)
Interprocedural analysis will call applySummary repeatedly as a consequence to
analyseCall(Object, Stmt, Object), once for each possible target method of the callStmt, provided with
its summary. |
protected abstract void |
copy(S sr,
S dst)
Copy src into dst.
|
protected void |
doAnalysis(boolean verbose)
Carry out the analysis.
|
void |
drawAsManyDot(String prefix,
boolean drawUnanalysed)
Dump the each summary computed by the interprocedural analysis as a separate graph.
|
void |
drawAsOneDot(String name)
Dump the interprocedural analysis result as a graph.
|
protected void |
fillDotGraph(String prefix,
S o,
DotGraph out)
Called by drawAsOneDot to fill dot subgraph out with the contents of summary o.
|
Iterator<SootMethod> |
getAnalysedMethods()
Get an iterator over the list of SootMethod with an associated summary.
|
S |
getSummaryFor(SootMethod m)
Query the analysis result.
|
protected abstract void |
merge(S in1,
S in2,
S out)
Merge in1 and in2 into out.
|
protected abstract S |
newInitialSummary()
Initial summary value for analysed functions.
|
protected abstract S |
summaryOfUnanalysedMethod(SootMethod method)
Whenever the analyse requires the summary of a method you filtered-out, this function is called instead of
analyseMethod.
|
public static final boolean doCheck
protected final CallGraph cg
protected final DirectedGraph<SootMethod> dg
protected final Map<SootMethod,S> data
protected final Map<SootMethod,Integer> order
protected final Map<SootMethod,S> unanalysed
public AbstractInterproceduralAnalysis(CallGraph cg, SootMethodFilter filter, Iterator<SootMethod> heads, boolean verbose)
cg - filter - verbose - heads - protected abstract S newInitialSummary()
protected abstract S summaryOfUnanalysedMethod(SootMethod method)
Note: This function is called at most once per filtered-out method. It is the equivalent of entryInitialFlow!
method - protected abstract void analyseMethod(SootMethod method, S dst)
method - is the method to be analyseddst - is where to put the computed method summaryprotected abstract void applySummary(S src, Stmt callStmt, S summary, S dst)
analyseCall(Object, Stmt, Object), once for each possible target method of the callStmt, provided with
its summary.src - summary valid before the call statementcallStmt - a statement containing a InvokeStmt or InvokeExprsummary - summary of the possible target of callStmt considered heredst - where to put the resultanalyseCallprotected abstract void merge(S in1, S in2, S out)
in1 - in2 - out - protected void fillDotGraph(String prefix, S o, DotGraph out)
prefix - gives you a unique string to prefix your node names and avoid name-clasho - out - public void analyseCall(S src, Stmt callStmt, S dst)
callStmt in the context src, and put the result into dst. For each possible
target of the call, this will get the summary for the target method (possibly
summaryOfUnanalysedMethod(SootMethod)) and applySummary(Object, Stmt, Object, Object), then merge the
results into dst using merge(Object, Object, Object).src - dst - callStmt - summaryOfUnanalysedMethod(SootMethod),
applySummary(Object, Stmt, Object, Object)public void drawAsOneDot(String name)
name - output filenamefillDotGraphpublic void drawAsManyDot(String prefix, boolean drawUnanalysed)
prefix - is prepended before method name in output filenamedrawUnanalysed - do you also want info for the unanalysed methods required by the analysis via summaryOfUnanalysedMethod ?fillDotGraphpublic S getSummaryFor(SootMethod m)
m - public Iterator<SootMethod> getAnalysedMethods()
protected void doAnalysis(boolean verbose)
verbose - Copyright © 2020 Soot OSS. All rights reserved.