Package soot.toolkits.graph
Class ClassicCompleteUnitGraph
- java.lang.Object
-
- soot.toolkits.graph.UnitGraph
-
- soot.toolkits.graph.TrapUnitGraph
-
- soot.toolkits.graph.ClassicCompleteUnitGraph
-
- All Implemented Interfaces:
Iterable<Unit>
,DirectedBodyGraph<Unit>
,DirectedGraph<Unit>
public class ClassicCompleteUnitGraph extends TrapUnitGraph
Represents a CFG for a Body instance where the nodes are
Unit
instances, and where edges are a conservative indication of unexceptional and exceptional control flow.ClassicCompleteUnitGraph attempts to duplicate the results that would have been produced by Soot's
CompleteUnitGraph
in releases up to Soot 2.1.0 (the one known discrepancy is that the 2.1.0CompleteUnitGraph
would include two edges joining one node to anotherUnit
s if the first node both branched to and fell through to the second). It is included solely for testing purposes, and should not be used in actual analyses.There are two distinctions between the graphs produced by the ClassicCompleteUnitGraph and ExceptionalUnitGraph:
- ExceptionalUnitGraph only creates edges to a Trap handler for trapped Units that have the
potential to throw the particular exception type caught by the handler, according to the
ThrowAnalysis
used to estimate which exceptions eachUnit
may throw. ClassicCompleteUnitGraph creates edges for all trapped Units, regardless of the types of exceptions they may throw. - When ExceptionalUnitGraph creates edges for a trapped Unit that may throw a caught exception, it adds edges from each predecessor of the excepting Unit to the handler. If the excepting Unit itself has no potential side effects, ExceptionalUnitGraph may omit an edge from it to the handler, depending on the parameters passed to the ExceptionalUnitGraph constructor. ClassicCompleteUnitGraph, on the other hand, always adds an edge from the excepting Unit itself to the handler, and adds edges from the predecessor only of the first Unit covered by a Trap (in this one aspect ClassicCompleteUnitGraph is less conservative than ExceptionalUnitGraph, since it ignores the possibility of a branch into the middle of a protected area).
-
-
Field Summary
-
Fields inherited from class soot.toolkits.graph.UnitGraph
body, heads, method, tails, unitChain, unitToPreds, unitToSuccs
-
-
Constructor Summary
Constructors Constructor Description ClassicCompleteUnitGraph(Body body)
Constructs the graph from a given Body instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildExceptionalEdges(Map<Unit,List<Unit>> unitToSuccs, Map<Unit,List<Unit>> unitToPreds)
Method to compute the edges corresponding to exceptional control flow.-
Methods inherited from class soot.toolkits.graph.UnitGraph
addEdge, buildHeadsAndTails, buildUnexceptionalEdges, combineMapValues, getBody, getExtendedBasicBlockPathBetween, getHeads, getPredsOf, getSuccsOf, getTails, iterator, size, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ClassicCompleteUnitGraph
public ClassicCompleteUnitGraph(Body body)
Constructs the graph from a given Body instance.- Parameters:
body
- the Body instance from which the graph is built.
-
-
Method Detail
-
buildExceptionalEdges
protected void buildExceptionalEdges(Map<Unit,List<Unit>> unitToSuccs, Map<Unit,List<Unit>> unitToPreds)
Method to compute the edges corresponding to exceptional control flow.- Overrides:
buildExceptionalEdges
in classTrapUnitGraph
- Parameters:
unitToSuccs
- AMap
fromUnit
s toList
s ofUnit
s. This is * an ``out parameter''; buildExceptionalEdges will add a mapping for every Unit within the scope of one or moreTrap
s to a List of the handler units of those Traps.unitToPreds
- AMap
fromUnit
s toList
s ofUnit
s. This is an ``out parameter''; buildExceptionalEdges will add a mapping for everyTrap
handler to all the Units within the scope of that Trap.
-
-