Search in sources :

Example 1 with CompleteUnitGraph

use of soot.toolkits.graph.CompleteUnitGraph in project soot by Sable.

the class MultiCalledMethods method byMCalledS0.

private void byMCalledS0(PegCallGraph pcg) {
    Iterator it = pcg.iterator();
    while (it.hasNext()) {
        SootMethod sm = (SootMethod) it.next();
        UnitGraph graph = new CompleteUnitGraph(sm.getActiveBody());
        CallGraph callGraph = Scene.v().getCallGraph();
        MultiRunStatementsFinder finder = new MultiRunStatementsFinder(graph, sm, multiCalledMethods, callGraph);
        FlowSet fs = finder.getMultiRunStatements();
    }
}
Also used : UnitGraph(soot.toolkits.graph.UnitGraph) CompleteUnitGraph(soot.toolkits.graph.CompleteUnitGraph) CallGraph(soot.jimple.toolkits.callgraph.CallGraph) PegCallGraph(soot.jimple.toolkits.thread.mhp.pegcallgraph.PegCallGraph) FlowSet(soot.toolkits.scalar.FlowSet) SootMethod(soot.SootMethod) CompleteUnitGraph(soot.toolkits.graph.CompleteUnitGraph)

Example 2 with CompleteUnitGraph

use of soot.toolkits.graph.CompleteUnitGraph in project soot by Sable.

the class JavaTranslator method translate.

private void translate() {
    st = new StmtTranslator(this);
    Collection<SootClass> app = Scene.v().getApplicationClasses();
    for (SootClass ac : app) {
        st.setCurrentClass(ac);
        List<SootMethod> sootMethods = ac.getMethods();
        for (SootMethod sm : sootMethods) {
            if (sm.isConcrete()) {
                Method method = methodsignaturToMethod.get(sm.getSignature());
                st.setCurrentMethod(sm);
                CompleteUnitGraph cug = new CompleteUnitGraph(sm.retrieveActiveBody());
                Iterator si = cug.iterator();
                while (si.hasNext()) {
                    Stmt stmt = (Stmt) si.next();
                    st.translateStmt(stmt);
                }
                // System.err.println("Setting up link between entry and first stmt of the method...");
                si = cug.getHeads().iterator();
                while (si.hasNext()) {
                    Stmt stmt = (Stmt) si.next();
                    method.getEntry().addSucc(st.getFirst(stmt));
                }
                si = cug.iterator();
                // System.err.println("Setting up link between the last statement and the first statement...");
                while (si.hasNext()) {
                    Stmt stmt = (Stmt) si.next();
                    Iterator si2 = cug.getSuccsOf(stmt).iterator();
                    while (si2.hasNext()) {
                        Stmt stmt2 = (Stmt) si2.next();
                        st.getLast(stmt).addSucc(st.getFirst(stmt2));
                    }
                }
            // System.err.println("!!!!!!!!!!!!!!!!!!"+sm.getName()+"!!!!!!!!!!!!!!!!!!!!");
            // si = cug.iterator();
            // while (si.hasNext()) {
            // Stmt stmt = (Stmt)si.next();
            // System.err.println("The stmt: "+stmt+" translates to "+st.getFirst(stmt));
            // //System.err.println(st.getFirst(stmt).getSuccs());
            // }
            // System.err.println("######################################");
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) SootMethod(soot.SootMethod) CompleteUnitGraph(soot.toolkits.graph.CompleteUnitGraph) Method(dk.brics.soot.intermediate.representation.Method) SootMethod(soot.SootMethod) SootClass(soot.SootClass) Stmt(soot.jimple.Stmt)

Aggregations

SootMethod (soot.SootMethod)2 CompleteUnitGraph (soot.toolkits.graph.CompleteUnitGraph)2 Method (dk.brics.soot.intermediate.representation.Method)1 Iterator (java.util.Iterator)1 SootClass (soot.SootClass)1 Stmt (soot.jimple.Stmt)1 CallGraph (soot.jimple.toolkits.callgraph.CallGraph)1 PegCallGraph (soot.jimple.toolkits.thread.mhp.pegcallgraph.PegCallGraph)1 UnitGraph (soot.toolkits.graph.UnitGraph)1 FlowSet (soot.toolkits.scalar.FlowSet)1