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
Unitinstances, 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
CompleteUnitGraphin releases up to Soot 2.1.0 (the one known discrepancy is that the 2.1.0CompleteUnitGraphwould include two edges joining one node to anotherUnits 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
ThrowAnalysisused to estimate which exceptions eachUnitmay 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 voidbuildExceptionalEdges(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:
buildExceptionalEdgesin classTrapUnitGraph- Parameters:
unitToSuccs- AMapfromUnits toLists ofUnits. This is * an ``out parameter''; buildExceptionalEdges will add a mapping for every Unit within the scope of one or moreTraps to a List of the handler units of those Traps.unitToPreds- AMapfromUnits toLists ofUnits. This is an ``out parameter''; buildExceptionalEdges will add a mapping for everyTraphandler to all the Units within the scope of that Trap.
-
-