/** * Returns the list of SootClasses that have been resolved at least to the level specified. */ public List<SootClass> getClasses(int desiredLevel) { List<SootClass> ret = new ArrayList<SootClass>(); for (Iterator<SootClass> clIt = getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); if (cl.resolvingLevel() >= desiredLevel) { ret.add(cl); } } return ret; }
/** Returns a list of all constructors taking no arguments. */ public List<SootMethod> inits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); addMethod(ret, cl, sigInit); } return ret; }
/** Returns a list of all static initializers. */ public List<SootMethod> clinits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); addMethod(ret, cl, sigClinit); } return ret; }
@Override protected void internalTransform(String phaseName, Map<String, String> options) { for (SootClass sc : Scene.v().getClasses()) { transformClass(sc); } }
/** Returns a list of all constructors. */ public List<SootMethod> allInits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); for (SootMethod m : cl.getMethods()) { if (m.getName().equals("<init>")) { ret.add(m); } } } return ret; }
@Override protected void internalTransform(String phaseName, Map<String, String> options) { for (SootClass sc : Scene.v().getClasses()) { transformClass(sc, false); } }
private void dumpAllBodies(String baseName, boolean deleteGraphFiles) { List<SootClass> classes = Scene.v().getClasses(SootClass.BODIES); for (SootClass cls : classes) { for (Iterator m = cls.getMethods().iterator(); m.hasNext();) { SootMethod method = (SootMethod) m.next(); if (method.hasActiveBody()) { Body body = method.getActiveBody(); if (deleteGraphFiles) { deleteOldGraphFiles(body, baseName); } dumpBody(body, baseName); } } } }
Chain<SootClass> sootClasses = Scene.v().getClasses(); Map<String, String> lowerCaseClassNameToReal = new HashMap<String, String>();
/** Constructs a hierarchy from the current scene. */ public Hierarchy() { this.sc = Scene.v(); state = sc.getState(); // Well, this used to be describable by 'Duh'. // Construct the subclasses hierarchy and the subinterfaces hierarchy. { Chain<SootClass> allClasses = sc.getClasses(); classToSubclasses = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); interfaceToSubinterfaces = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); interfaceToSuperinterfaces = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); classToDirSubclasses = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); interfaceToDirSubinterfaces = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); interfaceToDirSuperinterfaces = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); interfaceToDirImplementers = new HashMap<SootClass, List<SootClass>>(allClasses.size() * 2 + 1, 0.7f); initializeHierarchy(allClasses); } }
public void preJimplify() { boolean change = true; while (change) { change = false; for (Iterator<SootClass> cIt = new ArrayList<>(Scene.v().getClasses()).iterator(); cIt.hasNext();) { final SootClass c = cIt.next(); for (final SootMethod m : c.getMethods()) { if (!m.isConcrete()) { continue; } if (m.isNative()) { continue; } if (m.isPhantom()) { continue; } if (!m.hasActiveBody()) { change = true; m.retrieveActiveBody(); } } } } }
Iterator classesIt = Scene.v().getClasses().iterator(); while (classesIt.hasNext()) { SootClass sClass = (SootClass) classesIt.next();
Chain<SootClass> classes = Scene.v().getClasses(); for (SootClass sc : classes) { for (SootMethod sm : sc.getMethods()) {
protected void internalApply() { CGOptions options = new CGOptions(PhaseOptions.v().getPhaseOptions(this)); if (!Scene.v().hasCustomEntryPoints()) { if (!options.implicit_entry()) { Scene.v().setEntryPoints(EntryPoints.v().application()); } if (options.all_reachable()) { List<SootMethod> entryPoints = new ArrayList<SootMethod>(); entryPoints.addAll(EntryPoints.v().all()); entryPoints.addAll(EntryPoints.v().methodsOfApplicationClasses()); Scene.v().setEntryPoints(entryPoints); } } super.internalApply(); ClinitElimTransformer trimmer = new ClinitElimTransformer(); if (options.trim_clinit()) { for (SootClass cl : Scene.v().getClasses(SootClass.BODIES)) { for (SootMethod m : cl.getMethods()) { if (m.isConcrete() && m.hasActiveBody()) { trimmer.transform(m.getActiveBody()); } } } } } }
for (SootClass cl : sc.getClasses().getElementsUnsorted()) { if (cl.resolvingLevel() < SootClass.HIERARCHY) { continue;
reachables = cgb.reachables(); for (final SootClass c : Scene.v().getClasses()) { handleClass(c);
Chain<SootClass> unprocessedClasses = new HashChain<SootClass>(getClasses()); unprocessedClasses.removeAll(processedClasses); if (unprocessedClasses.isEmpty()) {
protected void addTags(PAG pag) { final Tag unknown = new StringTag("Untagged Spark node"); final Map<Node, Tag> nodeToTag = pag.getNodeTags(); for (final SootClass c : Scene.v().getClasses()) { for (final SootMethod m : c.getMethods()) { if (!m.isConcrete()) {
/** Returns the list of SootClasses that have been resolved at least to * the level specified. */ public List/*SootClass*/<SootClass> getClasses(int desiredLevel) { List<SootClass> ret = new ArrayList<SootClass>(); for( Iterator<SootClass> clIt = getClasses().iterator(); clIt.hasNext(); ) { final SootClass cl = (SootClass) clIt.next(); if( cl.resolvingLevel() >= desiredLevel ) ret.add(cl); } return ret; } private boolean doneResolving = false;
/** Returns a list of all static initializers. */ public List<SootMethod> clinits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for( Iterator clIt = Scene.v().getClasses().iterator(); clIt.hasNext(); ) { final SootClass cl = (SootClass) clIt.next(); addMethod( ret, cl, sigClinit ); } return ret; } /** Returns a list of all constructors taking no arguments. */
/** Returns a list of all constructors taking no arguments. */ public List<SootMethod> inits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for( Iterator clIt = Scene.v().getClasses().iterator(); clIt.hasNext(); ) { final SootClass cl = (SootClass) clIt.next(); addMethod( ret, cl, sigInit ); } return ret; }