Search in sources :

Example 26 with VarNode

use of soot.jimple.spark.pag.VarNode in project soot by Sable.

the class SootUtil method printNodeNumberMapping.

public static void printNodeNumberMapping(String fileName, PAG pag) {
    try {
        PrintWriter pw = new PrintWriter(new FileOutputStream(fileName));
        for (Iterator iter = pag.getVarNodeNumberer().iterator(); iter.hasNext(); ) {
            VarNode vn = (VarNode) iter.next();
            pw.println(vn.getNumber() + "\t" + vn);
        }
        pw.close();
    } catch (FileNotFoundException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) VarNode(soot.jimple.spark.pag.VarNode) FileOutputStream(java.io.FileOutputStream) Iterator(java.util.Iterator) FileNotFoundException(java.io.FileNotFoundException) PrintWriter(java.io.PrintWriter)

Example 27 with VarNode

use of soot.jimple.spark.pag.VarNode in project soot by Sable.

the class SootUtil method buildStoreMap.

public static FieldAccessMap buildStoreMap(PAG pag) {
    FieldAccessMap ret = new FieldAccessMap();
    Iterator frNodeIter = pag.storeInvSourcesIterator();
    while (frNodeIter.hasNext()) {
        FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
        SparkField field = frNode.getField();
        Node[] targets = pag.storeInvLookup(frNode);
        for (int i = 0; i < targets.length; i++) {
            VarNode target = (VarNode) targets[i];
            if (target instanceof GlobalVarNode)
                continue;
            ret.put(field, new Pair<FieldRefNode, LocalVarNode>(frNode, (LocalVarNode) target));
        }
    }
    return ret;
}
Also used : GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) VarNode(soot.jimple.spark.pag.VarNode) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) SparkField(soot.jimple.spark.pag.SparkField) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) Iterator(java.util.Iterator) LocalVarNode(soot.jimple.spark.pag.LocalVarNode)

Example 28 with VarNode

use of soot.jimple.spark.pag.VarNode in project soot by Sable.

the class SootUtil method loadsOnField.

public static FieldToEdgesMap loadsOnField(PAG pag) {
    FieldToEdgesMap loadsOnField = new FieldToEdgesMap();
    Iterator frNodeIter = pag.loadSourcesIterator();
    while (frNodeIter.hasNext()) {
        FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
        VarNode source = frNode.getBase();
        SparkField field = frNode.getField();
        Node[] targets = pag.loadLookup(frNode);
        for (int i = 0; i < targets.length; i++) {
            VarNode target = (VarNode) targets[i];
            loadsOnField.put(field, new Pair<VarNode, VarNode>(target, source));
        }
    }
    return loadsOnField;
}
Also used : GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) VarNode(soot.jimple.spark.pag.VarNode) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) SparkField(soot.jimple.spark.pag.SparkField) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) GlobalVarNode(soot.jimple.spark.pag.GlobalVarNode) StringConstantNode(soot.jimple.spark.pag.StringConstantNode) LocalVarNode(soot.jimple.spark.pag.LocalVarNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode) Iterator(java.util.Iterator)

Example 29 with VarNode

use of soot.jimple.spark.pag.VarNode in project soot by Sable.

the class MergeChecker method handleSimples.

protected void handleSimples(VarNode src) {
    PointsToSetInternal srcSet = src.getP2Set();
    if (srcSet.isEmpty())
        return;
    final Node[] simpleTargets = pag.simpleLookup(src);
    for (Node element : simpleTargets) {
        checkAll(element, srcSet, src);
    }
}
Also used : PointsToSetInternal(soot.jimple.spark.sets.PointsToSetInternal) FieldRefNode(soot.jimple.spark.pag.FieldRefNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode)

Example 30 with VarNode

use of soot.jimple.spark.pag.VarNode in project soot by Sable.

the class PropAlias method handleAllocNode.

/* End of public methods. */
/* End of package methods. */
/**
 * Propagates new points-to information of node src to all its successors.
 */
protected final boolean handleAllocNode(AllocNode src) {
    boolean ret = false;
    Node[] targets = pag.allocLookup(src);
    for (Node element : targets) {
        if (element.makeP2Set().add(src)) {
            addToWorklist((VarNode) element);
            ret = true;
        }
    }
    return ret;
}
Also used : FieldRefNode(soot.jimple.spark.pag.FieldRefNode) ClassConstantNode(soot.jimple.spark.pag.ClassConstantNode) NewInstanceNode(soot.jimple.spark.pag.NewInstanceNode) Node(soot.jimple.spark.pag.Node) VarNode(soot.jimple.spark.pag.VarNode) AllocNode(soot.jimple.spark.pag.AllocNode)

Aggregations

VarNode (soot.jimple.spark.pag.VarNode)47 AllocNode (soot.jimple.spark.pag.AllocNode)37 Node (soot.jimple.spark.pag.Node)29 FieldRefNode (soot.jimple.spark.pag.FieldRefNode)24 LocalVarNode (soot.jimple.spark.pag.LocalVarNode)23 PointsToSetInternal (soot.jimple.spark.sets.PointsToSetInternal)22 GlobalVarNode (soot.jimple.spark.pag.GlobalVarNode)17 SparkField (soot.jimple.spark.pag.SparkField)15 HashSet (java.util.HashSet)11 NewInstanceNode (soot.jimple.spark.pag.NewInstanceNode)11 SootMethod (soot.SootMethod)10 ClassConstantNode (soot.jimple.spark.pag.ClassConstantNode)10 RefType (soot.RefType)8 Type (soot.Type)8 P2SetVisitor (soot.jimple.spark.sets.P2SetVisitor)8 AssignEdge (soot.jimple.spark.ondemand.pautil.AssignEdge)7 Iterator (java.util.Iterator)6 ImmutableStack (soot.jimple.spark.ondemand.genericutil.ImmutableStack)6 Stack (soot.jimple.spark.ondemand.genericutil.Stack)6 AllocDotField (soot.jimple.spark.pag.AllocDotField)6