/** * Replace the current graph with its union with arg. arg is not modified. */ void union(PurityGraph arg) { nodes.addAll(arg.nodes); paramNodes.addAll(arg.paramNodes); edges.putAll(arg.edges); locals.putAll(arg.locals); ret.addAll(arg.ret); globEscape.addAll(arg.globEscape); backEdges.putAll(arg.backEdges); backLocals.putAll(arg.backLocals); mutated.putAll(arg.mutated); if (doCheck) { sanityCheck(); } }
protected final boolean localsPutAll(Local local, Set nodes) { Iterator it = nodes.iterator(); while (it.hasNext()) { Object node = it.next(); backLocals.put(node, local); } return locals.putAll(local, nodes); }
/** * For an interface parent (MUST be an interface), returns set of all subinterfaces including <code>parent</code>. * * This method can be used concurrently (is thread safe). * * @param parent * the parent interface. * @return an set, possibly empty */ public Set<SootClass> getAllSubinterfaces(SootClass parent) { parent.checkLevel(SootClass.HIERARCHY); if (!parent.isInterface()) { return Collections.emptySet(); } Set<SootClass> result = interfaceToAllSubinterfaces.get(parent); if (result.size() > 0) { return result; } result = new HashSet<>(); result.add(parent); for (SootClass si : interfaceToSubinterfaces.get(parent)) { result.addAll(getAllSubinterfaces(si)); } interfaceToAllSubinterfaces.putAll(parent, result); return result; }
/** * For an interface parent (MUST be an interface), returns set of all implementers of it but NOT their subclasses. * * This method can be used concurrently (is thread safe). * * @param parent * the parent interface. * @return an set, possibly empty */ public Set<SootClass> getAllImplementersOfInterface(SootClass parent) { parent.checkLevel(SootClass.HIERARCHY); Set<SootClass> result = interfaceToAllImplementers.get(parent); if (result.size() > 0) { return result; } result = new HashSet<>(); for (SootClass subinterface : getAllSubinterfaces(parent)) { if (subinterface == parent) { continue; } result.addAll(getAllImplementersOfInterface(subinterface)); } result.addAll(interfaceToImplementers.get(parent)); interfaceToAllImplementers.putAll(parent, result); return result; }
baseToSubTypes.putAll(base, newSubTypes);
mutated.putAll(dst, m);
baseToPossibleSubTypes.putAll(pair, types);
/** * Replace the current graph with its union with arg. * arg is not modified. */ void union(PurityGraph arg) { nodes.addAll(arg.nodes); paramNodes.addAll(arg.paramNodes); edges.putAll(arg.edges); locals.putAll(arg.locals); ret.addAll(arg.ret); globEscape.addAll(arg.globEscape); backEdges.putAll(arg.backEdges); backLocals.putAll(arg.backLocals); mutated.putAll(arg.mutated); if (doCheck) sanityCheck(); }
/** * Replace the current graph with its union with arg. * arg is not modified. */ void union(PurityGraph arg) { nodes.addAll(arg.nodes); paramNodes.addAll(arg.paramNodes); edges.putAll(arg.edges); locals.putAll(arg.locals); ret.addAll(arg.ret); globEscape.addAll(arg.globEscape); backEdges.putAll(arg.backEdges); backLocals.putAll(arg.backLocals); mutated.putAll(arg.mutated); if (doCheck) sanityCheck(); }
protected final boolean localsPutAll(Local local, Set nodes) { Iterator it = nodes.iterator(); while (it.hasNext()) { Object node = it.next(); backLocals.put(node,local); } return locals.putAll(local,nodes); }
protected final boolean localsPutAll(Local local, Set nodes) { Iterator it = nodes.iterator(); while (it.hasNext()) { Object node = it.next(); backLocals.put(node,local); } return locals.putAll(local,nodes); }
/** * Merges the given flows into the this method summary object * * @param newFlows The new flows to be merged */ public void merge(MultiMap<String, MethodFlow> newFlows) { if (newFlows != null && !newFlows.isEmpty()) flows.putAll(newFlows); }
/** For an interface parent (MUST be an interface), returns set of all * implementers of it but NOT their subclasses. */ public Set getAllImplementersOfInterface( SootClass parent ) { parent.checkLevel(SootClass.HIERARCHY); if( !interfaceToAllImplementers.containsKey( parent ) ) { for( Iterator subinterfaceIt = getAllSubinterfaces( parent ).iterator(); subinterfaceIt.hasNext(); ) { final SootClass subinterface = (SootClass) subinterfaceIt.next(); if( subinterface == parent ) continue; interfaceToAllImplementers.putAll(parent, getAllImplementersOfInterface( subinterface ) ); } interfaceToAllImplementers.putAll(parent, interfaceToImplementers.get( parent ) ); } return interfaceToAllImplementers.get( parent ); }
/** For an interface parent (MUST be an interface), returns set of all * implementers of it but NOT their subclasses. */ public Set getAllImplementersOfInterface( SootClass parent ) { parent.checkLevel(SootClass.HIERARCHY); if( !interfaceToAllImplementers.containsKey( parent ) ) { for( Iterator subinterfaceIt = getAllSubinterfaces( parent ).iterator(); subinterfaceIt.hasNext(); ) { final SootClass subinterface = (SootClass) subinterfaceIt.next(); if( subinterface == parent ) continue; interfaceToAllImplementers.putAll(parent, getAllImplementersOfInterface( subinterface ) ); } interfaceToAllImplementers.putAll(parent, interfaceToImplementers.get( parent ) ); } return interfaceToAllImplementers.get( parent ); }
/** For an interface parent (MUST be an interface), returns set of all * subinterfaces. */ protected Set getAllSubinterfaces( SootClass parent ) { parent.checkLevel(SootClass.HIERARCHY); if( !interfaceToAllSubinterfaces.containsKey( parent ) ) { interfaceToAllSubinterfaces.put( parent, parent ); for( Iterator it = interfaceToSubinterfaces.get( parent ).iterator(); it.hasNext(); ) { interfaceToAllSubinterfaces.putAll(parent, getAllSubinterfaces( (SootClass) it.next() ) ); } } return interfaceToAllSubinterfaces.get( parent ); }
/** For an interface parent (MUST be an interface), returns set of all * subinterfaces. */ protected Set getAllSubinterfaces( SootClass parent ) { parent.checkLevel(SootClass.HIERARCHY); if( !interfaceToAllSubinterfaces.containsKey( parent ) ) { interfaceToAllSubinterfaces.put( parent, parent ); for( Iterator it = interfaceToSubinterfaces.get( parent ).iterator(); it.hasNext(); ) { interfaceToAllSubinterfaces.putAll(parent, getAllSubinterfaces( (SootClass) it.next() ) ); } } return interfaceToAllSubinterfaces.get( parent ); }
public SootMethod generateDummyMainMethod(List<String> entryPoints, String sootClassName) { SootClass compSootClass = Scene.v().getSootClass(sootClassName); List<SootClass> androidClasses = new ArrayList<>(); androidClasses.add(compSootClass); SootMethod mainMethod = new SootMethod(DUMMY_MAIN_METHOD, new ArrayList<Type>(), VoidType.v(), Modifier.PUBLIC);// | Modifier.STATIC); //no need be static JimpleBody body = Jimple.v().newBody(mainMethod); mainMethod.setActiveBody(body); compSootClass.addMethod(mainMethod); //this is mandatory, the default dummyMainMethod is static, so they //do not deal thisIdentity. since we don't need static dummyMainMethod, //we should define it explicit body.insertIdentityStmts(); MultiMap<SootClass, SootMethod> callbackFunctions = new HashMultiMap<>(); callbackFunctions.putAll(compSootClass, getCallbackFunctions(compSootClass)); AndroidEntryPointCreator androidEPCreator = new AndroidEntryPointCreator(androidClasses); androidEPCreator.setCallbackFunctions(callbackFunctions); return androidEPCreator.createDummyMain(mainMethod); }
this.callbackMethods.putAll(jimpleClass.getCallbackMethods()); this.entrypoints.addAll(jimpleClass.getDynamicManifestComponents());