Package soot.jimple.spark.pag
Class PAG
- java.lang.Object
-
- soot.jimple.spark.pag.PAG
-
- All Implemented Interfaces:
PointsToAnalysis
- Direct Known Subclasses:
GeomPointsTo
public class PAG extends Object implements PointsToAnalysis
Pointer assignment graph.- Author:
- Ondrej Lhotak
-
-
Field Summary
-
Fields inherited from interface soot.PointsToAnalysis
ARRAY_ELEMENTS_NODE, CANONICAL_PATH, CANONICAL_PATH_LOCAL, CAST_NODE, DEFAULT_CLASS_LOADER, DEFAULT_CLASS_LOADER_LOCAL, EXCEPTION_NODE, FINALIZE_QUEUE, MAIN_CLASS_NAME_STRING, MAIN_CLASS_NAME_STRING_LOCAL, MAIN_THREAD_GROUP_NODE, MAIN_THREAD_GROUP_NODE_LOCAL, MAIN_THREAD_NODE, MAIN_THREAD_NODE_LOCAL, PHI_NODE, PRIVILEGED_ACTION_EXCEPTION, PRIVILEGED_ACTION_EXCEPTION_LOCAL, RETURN_NODE, RETURN_STRING_CONSTANT_NODE, STRING_ARRAY_NODE, STRING_ARRAY_NODE_LOCAL, STRING_NODE, STRING_NODE_LOCAL, THIS_NODE, THROW_NODE
-
-
Constructor Summary
Constructors Constructor Description PAG(SparkOptions opts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAllocEdge(AllocNode from, VarNode to)booleanaddAssignInstanceEdge(NewInstanceNode from, VarNode to)voidaddCallTarget(MethodPAG srcmpag, MethodPAG tgtmpag, Stmt s, Context srcContext, Context tgtContext, Edge e)Adds method target as a possible target of the invoke expression in s.voidaddCallTarget(MethodPAG srcmpag, MethodPAG tgtmpag, Stmt s, Context srcContext, Context tgtContext, Edge e, boolean propagateReturn)Adds method target as a possible target of the invoke expression in s.voidaddCallTarget(Edge e)voidaddDereference(VarNode base)Adds the base of a dereference to the list of dereferenced variables.booleanaddEdge(Node from, Node to)Adds an edge to the graph, returning false if it was already there.Pair<Node,Node>addInterproceduralAssignment(Node from, Node to, Edge e)booleanaddLoadEdge(FieldRefNode from, VarNode to)booleanaddNewInstanceEdge(VarNode from, NewInstanceNode to)booleanaddSimpleEdge(VarNode from, VarNode to)booleanaddStoreEdge(VarNode from, FieldRefNode to)protected <K extends Node>
booleanaddToMap(Map<K,Object> m, K key, Node value)Node[]allocInvLookup(VarNode key)Set<VarNode>allocInvSources()Iterator<VarNode>allocInvSourcesIterator()Node[]allocLookup(AllocNode key)QueueReader<AllocNode>allocNodeListener()Set<AllocNode>allocSources()Iterator<AllocNode>allocSourcesIterator()Node[]assignInstanceLookup(NewInstanceNode key)Set<NewInstanceNode>assignInstanceSources()voidcleanPAG()Delete all the assignment edges.voidcleanUpMerges()booleandoAddAllocEdge(AllocNode from, VarNode to)booleandoAddAssignInstanceEdge(NewInstanceNode from, VarNode to)booleandoAddLoadEdge(FieldRefNode from, VarNode to)booleandoAddNewInstanceEdge(VarNode from, NewInstanceNode to)booleandoAddSimpleEdge(VarNode from, VarNode to)booleandoAddStoreEdge(VarNode from, FieldRefNode to)QueueReader<Node>edgeReader()AllocDotFieldfindAllocDotField(AllocNode an, SparkField field)Finds the AllocDotField for base AllocNode an and field field, or returns null.ContextVarNodefindContextVarNode(Object baseValue, Context context)Finds the ContextVarNode for base variable value and context context, or returns null.FieldRefNodefindGlobalFieldRefNode(Object baseValue, SparkField field)Finds the FieldRefNode for base variable value and field field, or returns null.GlobalVarNodefindGlobalVarNode(Object value)Finds the GlobalVarNode for the variable value, or returns null.FieldRefNodefindLocalFieldRefNode(Object baseValue, SparkField field)Finds the FieldRefNode for base variable value and field field, or returns null.LocalVarNodefindLocalVarNode(Object value)Finds the LocalVarNode for the variable value, or returns null.ArrayNumberer<AllocDotField>getAllocDotFieldNodeNumberer()ArrayNumberer<AllocNode>getAllocNodeNumberer()CGOptionsgetCGOpts()Returns CGOptions for this graph.List<VarNode>getDereferences()Returns list of dereferences variables.ArrayNumberer<FieldRefNode>getFieldRefNodeNumberer()Map<Node,Tag>getNodeTags()intgetNumAllocNodes()OnFlyCallGraphgetOnFlyCallGraph()SparkOptionsgetOpts()Returns SparkOptions for this graph.P2SetFactorygetSetFactory()TypeManagergetTypeManager()ArrayNumberer<VarNode>getVarNodeNumberer()Node[]loadInvLookup(VarNode key)Set<VarNode>loadInvSources()Iterator<VarNode>loadInvSourcesIterator()Node[]loadLookup(FieldRefNode key)Set<FieldRefNode>loadSources()Iterator<FieldRefNode>loadSourcesIterator()protected <K extends Node>
Node[]lookup(Map<K,Object> m, K key)Set<Edge>lookupEdgesForAssignment(Pair<Node,Node> val)AllocDotFieldmakeAllocDotField(AllocNode an, SparkField field)Finds or creates the AllocDotField for base variable baseValue and field field, of type t.AllocNodemakeAllocNode(Object newExpr, Type type, SootMethod m)AllocNodemakeClassConstantNode(ClassConstant cc)ContextVarNodemakeContextVarNode(Object baseValue, Type baseType, Context context, SootMethod method)Finds or creates the ContextVarNode for base variable baseValue and context context, of type type.ContextVarNodemakeContextVarNode(LocalVarNode base, Context context)Finds or creates the ContextVarNode for base variable base and context context, of type type.FieldRefNodemakeFieldRefNode(VarNode base, SparkField field)Finds or creates the FieldRefNode for base variable base and field field, of type type.FieldRefNodemakeGlobalFieldRefNode(Object baseValue, Type baseType, SparkField field)Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.GlobalVarNodemakeGlobalVarNode(Object value, Type type)Finds or creates the GlobalVarNode for the variable value, of type type.FieldRefNodemakeLocalFieldRefNode(Object baseValue, Type baseType, SparkField field, SootMethod method)Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.LocalVarNodemakeLocalVarNode(Object value, Type type, SootMethod method)Finds or creates the LocalVarNode for the variable value, of type type.NewInstanceNodemakeNewInstanceNode(Value value, Type type, SootMethod method)AllocNodemakeStringConstantNode(String s)Node[]newInstanceLookup(VarNode key)Set<VarNode>newInstanceSources()GlobalNodeFactorynodeFactory()OnFlyCallGraphofcg()PointsToSetreachingObjects(Context c, Local l)Returns the set of objects pointed to by variable l in context c.PointsToSetreachingObjects(Context c, Local l, SootField f)Returns the set of objects pointed to by instance field f of the objects pointed to by l in context c.PointsToSetreachingObjects(Local l)Returns the set of objects pointed to by variable l.PointsToSetreachingObjects(Local l, SootField f)Returns the set of objects pointed to by instance field f of the objects pointed to by l.PointsToSetreachingObjects(PointsToSet s, SootField f)Returns the set of objects pointed to by instance field f of the objects in the PointsToSet s.PointsToSetreachingObjects(SootField f)Returns the set of objects pointed to by static field f.PointsToSetreachingObjectsOfArrayElement(PointsToSet s)Returns the set of objects pointed to by elements of the arrays in the PointsToSet s.voidsetOnFlyCallGraph(OnFlyCallGraph ofcg)Node[]simpleInvLookup(VarNode key)Set<VarNode>simpleInvSources()Iterator<VarNode>simpleInvSourcesIterator()Node[]simpleLookup(VarNode key)Set<VarNode>simpleSources()Iterator<VarNode>simpleSourcesIterator()Node[]storeInvLookup(FieldRefNode key)Set<FieldRefNode>storeInvSources()Iterator<FieldRefNode>storeInvSourcesIterator()Node[]storeLookup(VarNode key)Set<VarNode>storeSources()Iterator<VarNode>storeSourcesIterator()
-
-
-
Field Detail
-
EMPTY_NODE_ARRAY
protected static final Node[] EMPTY_NODE_ARRAY
-
setFactory
protected P2SetFactory setFactory
-
somethingMerged
protected boolean somethingMerged
-
edgeQueue
protected ChunkedQueue<Node> edgeQueue
-
allocNodeNumberer
protected final ArrayNumberer<AllocNode> allocNodeNumberer
-
opts
protected SparkOptions opts
-
cgOpts
protected CGOptions cgOpts
-
accessibilityOracle
protected ClientAccessibilityOracle accessibilityOracle
-
load
protected Map<FieldRefNode,Object> load
-
assignInstance
protected Map<NewInstanceNode,Object> assignInstance
-
storeInv
protected Map<FieldRefNode,Object> storeInv
-
newInstanceInv
protected Map<NewInstanceNode,Object> newInstanceInv
-
typeManager
protected TypeManager typeManager
-
localToNodeMap
protected Map<Local,LocalVarNode> localToNodeMap
-
maxFinishNumber
public int maxFinishNumber
-
nativeMethodDriver
public NativeMethodDriver nativeMethodDriver
-
callAssigns
public HashMultiMap<InvokeExpr,Pair<Node,Node>> callAssigns
-
callToMethod
public Map<InvokeExpr,SootMethod> callToMethod
-
virtualCallsToReceivers
public Map<InvokeExpr,Node> virtualCallsToReceivers
-
-
Constructor Detail
-
PAG
public PAG(SparkOptions opts)
-
-
Method Detail
-
reachingObjects
public PointsToSet reachingObjects(Local l)
Returns the set of objects pointed to by variable l.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l)
Returns the set of objects pointed to by variable l in context c.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
reachingObjects
public PointsToSet reachingObjects(SootField f)
Returns the set of objects pointed to by static field f.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
reachingObjects
public PointsToSet reachingObjects(PointsToSet s, SootField f)
Returns the set of objects pointed to by instance field f of the objects in the PointsToSet s.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
reachingObjectsOfArrayElement
public PointsToSet reachingObjectsOfArrayElement(PointsToSet s)
Returns the set of objects pointed to by elements of the arrays in the PointsToSet s.- Specified by:
reachingObjectsOfArrayElementin interfacePointsToAnalysis
-
getSetFactory
public P2SetFactory getSetFactory()
-
cleanUpMerges
public void cleanUpMerges()
-
doAddStoreEdge
public boolean doAddStoreEdge(VarNode from, FieldRefNode to)
-
doAddLoadEdge
public boolean doAddLoadEdge(FieldRefNode from, VarNode to)
-
doAddNewInstanceEdge
public boolean doAddNewInstanceEdge(VarNode from, NewInstanceNode to)
-
doAddAssignInstanceEdge
public boolean doAddAssignInstanceEdge(NewInstanceNode from, VarNode to)
-
loadLookup
public Node[] loadLookup(FieldRefNode key)
-
assignInstanceLookup
public Node[] assignInstanceLookup(NewInstanceNode key)
-
storeInvLookup
public Node[] storeInvLookup(FieldRefNode key)
-
loadSources
public Set<FieldRefNode> loadSources()
-
assignInstanceSources
public Set<NewInstanceNode> assignInstanceSources()
-
storeInvSources
public Set<FieldRefNode> storeInvSources()
-
loadSourcesIterator
public Iterator<FieldRefNode> loadSourcesIterator()
-
storeInvSourcesIterator
public Iterator<FieldRefNode> storeInvSourcesIterator()
-
reachingObjects
public PointsToSet reachingObjects(Local l, SootField f)
Returns the set of objects pointed to by instance field f of the objects pointed to by l.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
reachingObjects
public PointsToSet reachingObjects(Context c, Local l, SootField f)
Returns the set of objects pointed to by instance field f of the objects pointed to by l in context c.- Specified by:
reachingObjectsin interfacePointsToAnalysis
-
makeAllocNode
public AllocNode makeAllocNode(Object newExpr, Type type, SootMethod m)
-
makeClassConstantNode
public AllocNode makeClassConstantNode(ClassConstant cc)
-
allocNodeListener
public QueueReader<AllocNode> allocNodeListener()
-
findGlobalVarNode
public GlobalVarNode findGlobalVarNode(Object value)
Finds the GlobalVarNode for the variable value, or returns null.
-
findLocalVarNode
public LocalVarNode findLocalVarNode(Object value)
Finds the LocalVarNode for the variable value, or returns null.
-
makeGlobalVarNode
public GlobalVarNode makeGlobalVarNode(Object value, Type type)
Finds or creates the GlobalVarNode for the variable value, of type type.
-
makeLocalVarNode
public LocalVarNode makeLocalVarNode(Object value, Type type, SootMethod method)
Finds or creates the LocalVarNode for the variable value, of type type.
-
makeNewInstanceNode
public NewInstanceNode makeNewInstanceNode(Value value, Type type, SootMethod method)
-
findContextVarNode
public ContextVarNode findContextVarNode(Object baseValue, Context context)
Finds the ContextVarNode for base variable value and context context, or returns null.
-
makeContextVarNode
public ContextVarNode makeContextVarNode(Object baseValue, Type baseType, Context context, SootMethod method)
Finds or creates the ContextVarNode for base variable baseValue and context context, of type type.
-
makeContextVarNode
public ContextVarNode makeContextVarNode(LocalVarNode base, Context context)
Finds or creates the ContextVarNode for base variable base and context context, of type type.
-
findLocalFieldRefNode
public FieldRefNode findLocalFieldRefNode(Object baseValue, SparkField field)
Finds the FieldRefNode for base variable value and field field, or returns null.
-
findGlobalFieldRefNode
public FieldRefNode findGlobalFieldRefNode(Object baseValue, SparkField field)
Finds the FieldRefNode for base variable value and field field, or returns null.
-
makeLocalFieldRefNode
public FieldRefNode makeLocalFieldRefNode(Object baseValue, Type baseType, SparkField field, SootMethod method)
Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.
-
makeGlobalFieldRefNode
public FieldRefNode makeGlobalFieldRefNode(Object baseValue, Type baseType, SparkField field)
Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.
-
makeFieldRefNode
public FieldRefNode makeFieldRefNode(VarNode base, SparkField field)
Finds or creates the FieldRefNode for base variable base and field field, of type type.
-
findAllocDotField
public AllocDotField findAllocDotField(AllocNode an, SparkField field)
Finds the AllocDotField for base AllocNode an and field field, or returns null.
-
makeAllocDotField
public AllocDotField makeAllocDotField(AllocNode an, SparkField field)
Finds or creates the AllocDotField for base variable baseValue and field field, of type t.
-
addStoreEdge
public boolean addStoreEdge(VarNode from, FieldRefNode to)
-
addLoadEdge
public boolean addLoadEdge(FieldRefNode from, VarNode to)
-
addNewInstanceEdge
public boolean addNewInstanceEdge(VarNode from, NewInstanceNode to)
-
addAssignInstanceEdge
public boolean addAssignInstanceEdge(NewInstanceNode from, VarNode to)
-
addEdge
public boolean addEdge(Node from, Node to)
Adds an edge to the graph, returning false if it was already there.
-
edgeReader
public QueueReader<Node> edgeReader()
-
getNumAllocNodes
public int getNumAllocNodes()
-
getTypeManager
public TypeManager getTypeManager()
-
setOnFlyCallGraph
public void setOnFlyCallGraph(OnFlyCallGraph ofcg)
-
getOnFlyCallGraph
public OnFlyCallGraph getOnFlyCallGraph()
-
ofcg
public OnFlyCallGraph ofcg()
-
addDereference
public void addDereference(VarNode base)
Adds the base of a dereference to the list of dereferenced variables.
-
getAllocNodeNumberer
public ArrayNumberer<AllocNode> getAllocNodeNumberer()
-
getVarNodeNumberer
public ArrayNumberer<VarNode> getVarNodeNumberer()
-
getFieldRefNodeNumberer
public ArrayNumberer<FieldRefNode> getFieldRefNodeNumberer()
-
getAllocDotFieldNodeNumberer
public ArrayNumberer<AllocDotField> getAllocDotFieldNodeNumberer()
-
getOpts
public SparkOptions getOpts()
Returns SparkOptions for this graph.
-
getCGOpts
public CGOptions getCGOpts()
Returns CGOptions for this graph.
-
addInterproceduralAssignment
public Pair<Node,Node> addInterproceduralAssignment(Node from, Node to, Edge e)
-
addCallTarget
public void addCallTarget(Edge e)
-
addCallTarget
public void addCallTarget(MethodPAG srcmpag, MethodPAG tgtmpag, Stmt s, Context srcContext, Context tgtContext, Edge e)
Adds method target as a possible target of the invoke expression in s. If target is null, only creates the nodes for the call site, without actually connecting them to any target method.
-
addCallTarget
public void addCallTarget(MethodPAG srcmpag, MethodPAG tgtmpag, Stmt s, Context srcContext, Context tgtContext, Edge e, boolean propagateReturn)
Adds method target as a possible target of the invoke expression in s. If target is null, only creates the nodes for the call site, without actually connecting them to any target method.
-
cleanPAG
public void cleanPAG()
Delete all the assignment edges.
-
nodeFactory
public GlobalNodeFactory nodeFactory()
-
-