Search in sources :

Example 6 with Transform

use of soot.Transform 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 7 with Transform

use of soot.Transform in project soot by Sable.

the class ReflInliner method main.

public static void main(String[] args) {
    PackManager.v().getPack("wjpp").add(new Transform("wjpp.inlineReflCalls", new ReflectiveCallsInliner()));
    Scene.v().addBasicClass(Object.class.getName());
    Scene.v().addBasicClass(SootSig.class.getName(), SootClass.BODIES);
    Scene.v().addBasicClass(UnexpectedReflectiveCall.class.getName(), SootClass.BODIES);
    Scene.v().addBasicClass(IUnexpectedReflectiveCallHandler.class.getName(), SootClass.BODIES);
    Scene.v().addBasicClass(DefaultHandler.class.getName(), SootClass.BODIES);
    Scene.v().addBasicClass(OpaquePredicate.class.getName(), SootClass.BODIES);
    Scene.v().addBasicClass(ReflectiveCalls.class.getName(), SootClass.BODIES);
    ArrayList<String> argList = new ArrayList<String>(Arrays.asList(args));
    argList.add("-w");
    argList.add("-p");
    argList.add("cg");
    argList.add("enabled:false");
    argList.add("-app");
    Options.v().set_keep_line_number(true);
    logger.debug("TamiFlex Booster Version " + ReflInliner.class.getPackage().getImplementationVersion());
    try {
        soot.Main.main(argList.toArray(new String[0]));
    } catch (CompilationDeathException e) {
        logger.debug("\nERROR: " + e.getMessage() + "\n");
        logger.debug("The command-line options are described at:\n" + "http://www.sable.mcgill.ca/soot/tutorial/usage/index.html");
        if (Options.v().verbose()) {
            throw e;
        } else {
            logger.debug("Use -verbose to see stack trace.");
        }
        usage();
    }
}
Also used : ArrayList(java.util.ArrayList) CompilationDeathException(soot.CompilationDeathException) ReflectiveCallsInliner(soot.jimple.toolkits.reflection.ReflectiveCallsInliner) UnexpectedReflectiveCall(soot.rtlib.tamiflex.UnexpectedReflectiveCall) DefaultHandler(soot.rtlib.tamiflex.DefaultHandler) SootSig(soot.rtlib.tamiflex.SootSig) OpaquePredicate(soot.rtlib.tamiflex.OpaquePredicate) Transform(soot.Transform) ReflectiveCalls(soot.rtlib.tamiflex.ReflectiveCalls) IUnexpectedReflectiveCallHandler(soot.rtlib.tamiflex.IUnexpectedReflectiveCallHandler)

Example 8 with Transform

use of soot.Transform in project soot by Sable.

the class OptionsBase method getPhaseUsage.

protected String getPhaseUsage() {
    StringBuffer b = new StringBuffer();
    b.append("\nPhases and phase options:\n");
    for (Pack p : PackManager.v().allPacks()) {
        b.append(padOpt(p.getPhaseName(), p.getDeclaredOptions()));
        for (Iterator<Transform> phIt = p.iterator(); phIt.hasNext(); ) {
            final HasPhaseOptions ph = (HasPhaseOptions) phIt.next();
            b.append(padVal(ph.getPhaseName(), ph.getDeclaredOptions()));
        }
    }
    return b.toString();
}
Also used : HasPhaseOptions(soot.HasPhaseOptions) Pack(soot.Pack) Transform(soot.Transform)

Example 9 with Transform

use of soot.Transform in project soot by Sable.

the class BadFields method main.

public static void main(String[] args) {
    PackManager.v().getPack("cg").add(new Transform("cg.badfields", new BadFields()));
    soot.Main.main(args);
}
Also used : Transform(soot.Transform)

Example 10 with Transform

use of soot.Transform in project soot by Sable.

the class NullTransformer method main.

public static void main(String[] argv) {
    Pack jtp = soot.G.v().PackManager().getPack("jtp");
    jtp.add(new Transform("jtp.nt", new NullTransformer()));
    jtp.add(new Transform("jtp.nac", new NullnessAnalysisColorer()));
    soot.Main.main(argv);
}
Also used : Pack(soot.Pack) Transform(soot.Transform)

Aggregations

Transform (soot.Transform)13 Map (java.util.Map)5 Body (soot.Body)3 SceneTransformer (soot.SceneTransformer)3 SootMethod (soot.SootMethod)3 Unit (soot.Unit)3 ArrayList (java.util.ArrayList)2 BodyTransformer (soot.BodyTransformer)2 Pack (soot.Pack)2 Stmt (soot.jimple.Stmt)2 InterproceduralCFG (heros.InterproceduralCFG)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 CompilationDeathException (soot.CompilationDeathException)1 HasPhaseOptions (soot.HasPhaseOptions)1 MethodOrMethodContext (soot.MethodOrMethodContext)1 SootClass (soot.SootClass)1 InterfaceInvokeExpr (soot.jimple.InterfaceInvokeExpr)1 InvokeExpr (soot.jimple.InvokeExpr)1