Package soot.toolkits.graph
Class TrapUnitGraph
- java.lang.Object
-
- soot.toolkits.graph.UnitGraph
-
- soot.toolkits.graph.TrapUnitGraph
-
- All Implemented Interfaces:
Iterable<Unit>,DirectedBodyGraph<Unit>,DirectedGraph<Unit>
- Direct Known Subclasses:
ClassicCompleteUnitGraph,SimpleExceptionalGraph
public class TrapUnitGraph extends UnitGraph
Represents a CFG for a
Bodyinstance where the nodes areUnitinstances, and where, in additional to unexceptional control flow edges, edges are added from every trappedUnitto theTrap's handlerUnit, regardless of whether the trappedUnits may actually throw the exception caught by theTrap.There are three distinctions between the exceptional edges added in
TrapUnitGraphand the exceptional edges added inExceptionalUnitGraph:- In
ExceptionalUnitGraph, the edges toTraps are associated withUnits which may actually throw an exception which theTrapcatches (according to theThrowAnalysisused in the construction of the graph). InTrapUnitGraph, there are edges from every trappedUnitto theTrap, regardless of whether it can throw an exception caught by theTrap. - In
ExceptionalUnitGraph, when aUnitmay throw an exception that is caught by aTrapthere are edges from every predecessor of the exceptingUnitto theTrap's handler. InTrapUnitGraph, edges are not added from the predecessors of exceptingUnits. - In
ExceptionalUnitGraph, when aUnitmay throw an exception that is caught by aTrap, there may be no edge from the exceptingUnititself to theTrap(depending on the possibility of side effects and the setting of theomitExceptingUnitEdgesparameter). InTrapUnitGraph, there is always an edge from the exceptingUnitto theTrap.
-
-
Field Summary
-
Fields inherited from class soot.toolkits.graph.UnitGraph
body, heads, method, tails, unitChain, unitToPreds, unitToSuccs
-
-
Constructor Summary
Constructors Constructor Description TrapUnitGraph(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
-
TrapUnitGraph
public TrapUnitGraph(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.- Parameters:
unitToSuccs- AMapfromUnits toLists ofUnits. This is an “out parameter”;buildExceptionalEdgeswill add a mapping for everyUnitwithin the scope of one or moreTraps to aListof the handler units of thoseTraps.unitToPreds- AMapfromUnits toLists ofUnits. This is an “out parameter”;buildExceptionalEdgeswill add a mapping for everyTraphandler to all theUnits within the scope of thatTrap.
-
-