Search in sources :

Example 1 with BodyTransformer

use of soot.BodyTransformer in project soot by Sable.

the class Main method main.

/**
 * @param args
 */
public static void main(String[] args) {
    PackManager.v().getPack("jtp").add(new Transform("jtp.fixedie", new BodyTransformer() {

        @Override
        protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
            for (Unit u : b.getUnits()) {
                Stmt s = (Stmt) u;
                if (s.containsInvokeExpr()) {
                    InvokeExpr ie = s.getInvokeExpr();
                    if (FixedMethods.isFixed(ie)) {
                        System.err.println("+++ " + ie);
                        yes++;
                    } else {
                        System.err.println(" -  " + ie);
                        no++;
                    }
                }
            }
        }
    }));
    soot.Main.main(args);
    System.err.println("+++ " + yes);
    System.err.println(" -  " + no);
}
Also used : InvokeExpr(soot.jimple.InvokeExpr) BodyTransformer(soot.BodyTransformer) Transform(soot.Transform) Unit(soot.Unit) Body(soot.Body) Map(java.util.Map) Stmt(soot.jimple.Stmt)

Example 2 with BodyTransformer

use of soot.BodyTransformer in project soot by Sable.

the class MyMain method main.

public static void main(String[] args) {
    PackManager.v().getPack("jtp").add(new Transform("jtp.myTransform", new BodyTransformer() {

        protected void internalTransform(Body body, String phase, Map options) {
            new MyAnalysis(new ExceptionalUnitGraph(body));
            // use G.v().out instead of System.out so that Soot can
            // redirect this output to the Eclipse console
            G.v().out.println(body.getMethod());
        }
    }));
    soot.Main.main(args);
}
Also used : ExceptionalUnitGraph(soot.toolkits.graph.ExceptionalUnitGraph) BodyTransformer(soot.BodyTransformer) Transform(soot.Transform) Body(soot.Body) Map(java.util.Map)

Aggregations

Map (java.util.Map)2 Body (soot.Body)2 BodyTransformer (soot.BodyTransformer)2 Transform (soot.Transform)2 Unit (soot.Unit)1 InvokeExpr (soot.jimple.InvokeExpr)1 Stmt (soot.jimple.Stmt)1 ExceptionalUnitGraph (soot.toolkits.graph.ExceptionalUnitGraph)1