private void loadNecessaryClass(String name) { SootClass c; c = loadClassAndSupport(name); c.setApplicationClass(); }
public void loadDynamicClasses() { dynamicClasses = new ArrayList<SootClass>(); HashSet<String> dynClasses = new HashSet<String>(); dynClasses.addAll(Options.v().dynamic_class()); for (Iterator<String> pathIt = Options.v().dynamic_dir().iterator(); pathIt.hasNext();) { final String path = pathIt.next(); dynClasses.addAll(SourceLocator.v().getClassesUnder(path)); } for (Iterator<String> pkgIt = Options.v().dynamic_package().iterator(); pkgIt.hasNext();) { final String pkg = pkgIt.next(); dynClasses.addAll(SourceLocator.v().classesInDynamicPackage(pkg)); } for (String className : dynClasses) { dynamicClasses.add(loadClassAndSupport(className)); } // remove non-concrete classes that may accidentally have been loaded for (Iterator<SootClass> iterator = dynamicClasses.iterator(); iterator.hasNext();) { SootClass c = iterator.next(); if (!c.isConcrete()) { if (Options.v().verbose()) { logger.warn("dynamic class " + c.getName() + " is abstract or an interface, and it will not be considered."); } iterator.remove(); } } }
public static void main(String[] args) { // assumes 2 args: Class + Method Scene.v().loadClassAndSupport(args[0]); SootClass sc = Scene.v().getSootClass(args[0]); SootMethod sm = sc.getMethod(args[1]); Body b = sm.retrieveActiveBody(); CompleteBlockGraph cfg = new CompleteBlockGraph(b); System.out.println(cfg); BlockGraphConverter.addStartStopNodesTo(cfg); System.out.println(cfg); BlockGraphConverter.reverse(cfg); System.out.println(cfg); }
public static void main(String[] args) { // assumes 2 args: Class + Method Scene.v().loadClassAndSupport(args[0]); SootClass sc = Scene.v().getSootClass(args[0]); SootMethod sm = sc.getMethod(args[1]); Body b = sm.retrieveActiveBody(); ShimpleBody sb = Shimple.v().newBody(b); CompleteBlockGraph cfg = new CompleteBlockGraph(sb); SimpleGlobalValueNumberer sgvn = new SimpleGlobalValueNumberer(cfg); System.out.println(sgvn); }
public static void main(String[] args) { // assumes 2 args: Class + Method Scene.v().loadClassAndSupport(args[0]); SootClass sc = Scene.v().getSootClass(args[0]); SootMethod sm = sc.getMethod(args[1]); Body b = sm.retrieveActiveBody(); ShimpleBody sb = Shimple.v().newBody(b); CompleteBlockGraph cfg = new CompleteBlockGraph(sb); ValueGraph vg = new ValueGraph(cfg); System.out.println(vg); }
public MonitorConverter(Singletons.Global g) { SootClass davaMonitor = new SootClass("soot.dava.toolkits.base.DavaMonitor.DavaMonitor", Modifier.PUBLIC); davaMonitor.setSuperclass(Scene.v().loadClassAndSupport("java.lang.Object")); LinkedList objectSingleton = new LinkedList(); objectSingleton.add(RefType.v("java.lang.Object")); v = Scene.v().makeSootMethod("v", new LinkedList(), RefType.v("soot.dava.toolkits.base.DavaMonitor.DavaMonitor"), Modifier.PUBLIC | Modifier.STATIC); enter = Scene.v().makeSootMethod("enter", objectSingleton, VoidType.v(), Modifier.PUBLIC | Modifier.SYNCHRONIZED); exit = Scene.v().makeSootMethod("exit", objectSingleton, VoidType.v(), Modifier.PUBLIC | Modifier.SYNCHRONIZED); davaMonitor.addMethod(v); davaMonitor.addMethod(enter); davaMonitor.addMethod(exit); Scene.v().addClass(davaMonitor); }
SootClass runtime = Scene.v().loadClassAndSupport("java.lang.RuntimeException"); if (runtime.declaresMethod("void <init>(java.lang.String)")) { SootMethod sootMethod = runtime.getMethod("void <init>(java.lang.String)");
/** * Load the set of classes that soot needs, including those specified on the command-line. This is the standard way of * initialising the list of classes soot should use. */ public void loadNecessaryClasses() { loadBasicClasses(); for (String name : Options.v().classes()) { loadNecessaryClass(name); } loadDynamicClasses(); if (Options.v().oaat()) { if (Options.v().process_dir().isEmpty()) { throw new IllegalArgumentException("If switch -oaat is used, then also -process-dir must be given."); } } else { for (final String path : Options.v().process_dir()) { for (String cl : SourceLocator.v().getClassesUnder(path)) { SootClass theClass = loadClassAndSupport(cl); if (!theClass.isPhantom) { theClass.setApplicationClass(); } } } } prepareClasses(); setDoneResolving(); }
counterClass = Scene.v().loadClassAndSupport("MultiCounter"); increase = counterClass.getMethod("void increase(int)");
SootClass counterClass = Scene.v().loadClassAndSupport("MultiCounter"); SootMethod reset = counterClass.getMethod("void reset()"); SootMethod report = counterClass.getMethod("void report()");
loadClassAndSupport(s.getName());
counterClass = Scene.v().loadClassAndSupport("MultiCounter"); increase = counterClass.getMethod("void increase(int)");
SootClass objectClass = Scene.v().loadClassAndSupport("java.lang.Object"); RefType type = RefType.v(objectClass); SootMethod initMethod = objectClass.getMethod("void <init>()");
SootClass objectClass = Scene.v().loadClassAndSupport("java.lang.Object"); RefType type = RefType.v(objectClass); SootMethod initMethod = objectClass.getMethod("void <init>()"); units.insertAfter(newThrow, newExitmonitor); SootClass throwableClass = Scene.v().loadClassAndSupport("java.lang.Throwable"); b.getTraps().addFirst(Jimple.v().newTrap(throwableClass, newExitmonitor, newThrow, newCatch)); b.getTraps().addFirst(Jimple.v().newTrap(throwableClass, csr.beginning, lastEnd, newCatch));
private void loadNecessaryClass(String name) { SootClass c; c = loadClassAndSupport(name); c.setApplicationClass(); } /** Load the set of classes that soot needs, including those specified on the
private void loadNecessaryClass(String name) { SootClass c; c = loadClassAndSupport(name); c.setApplicationClass(); } /** Load the set of classes that soot needs, including those specified on the
public static void main(String[] args) { // assumes 2 args: Class + Method Scene.v().loadClassAndSupport(args[0]); SootClass sc = Scene.v().getSootClass(args[0]); SootMethod sm = sc.getMethod(args[1]); Body b = sm.retrieveActiveBody(); CompleteBlockGraph cfg = new CompleteBlockGraph(b); System.out.println(cfg); BlockGraphConverter.addStartStopNodesTo(cfg); System.out.println(cfg); BlockGraphConverter.reverse(cfg); System.out.println(cfg); }
public static void main(String[] args) { // assumes 2 args: Class + Method Scene.v().loadClassAndSupport(args[0]); SootClass sc = Scene.v().getSootClass(args[0]); SootMethod sm = sc.getMethod(args[1]); Body b = sm.retrieveActiveBody(); CompleteBlockGraph cfg = new CompleteBlockGraph(b); System.out.println(cfg); BlockGraphConverter.addStartStopNodesTo(cfg); System.out.println(cfg); BlockGraphConverter.reverse(cfg); System.out.println(cfg); }
/** Load the set of classes that soot needs, including those specified on the * command-line. This is the standard way of initialising the list of * classes soot should use. */ public void loadNecessaryClasses() { loadBasicClasses(); Iterator<String> it = Options.v().classes().iterator(); while (it.hasNext()) { String name = (String) it.next(); loadNecessaryClass(name); } loadDynamicClasses(); for( Iterator<String> pathIt = Options.v().process_dir().iterator(); pathIt.hasNext(); ) { final String path = (String) pathIt.next(); for (String cl : SourceLocator.v().getClassesUnder(path)) { loadClassAndSupport(cl).setApplicationClass(); } } prepareClasses(); // RoboVM note: In RoboVM we're never done resolving //setDoneResolving(); }
/** Load the set of classes that soot needs, including those specified on the * command-line. This is the standard way of initialising the list of * classes soot should use. */ public void loadNecessaryClasses() { loadBasicClasses(); Iterator<String> it = Options.v().classes().iterator(); while (it.hasNext()) { String name = (String) it.next(); loadNecessaryClass(name); } loadDynamicClasses(); for( Iterator<String> pathIt = Options.v().process_dir().iterator(); pathIt.hasNext(); ) { final String path = (String) pathIt.next(); for (String cl : SourceLocator.v().getClassesUnder(path)) { loadClassAndSupport(cl).setApplicationClass(); } } prepareClasses(); // RoboVM note: In RoboVM we're never done resolving //setDoneResolving(); }