Iterator it = (new LinkedList(edges.get(src))).iterator(); while (it.hasNext()) { PurityEdge e = (PurityEdge) it.next(); edges.remove(src, e); edges.put(dst, ee); backEdges.remove(n, e); backEdges.put(n, ee); it = (new LinkedList(backEdges.get(src))).iterator(); while (it.hasNext()) { PurityEdge e = (PurityEdge) it.next(); edges.remove(n, e); edges.put(n, ee); backEdges.remove(src, e); backEdges.put(dst, ee); it = (new LinkedList(backLocals.get(src))).iterator(); while (it.hasNext()) { Local l = (Local) it.next(); locals.remove(l, src); backLocals.remove(src, l); locals.put(l, dst); backLocals.put(dst, l); Set m = mutated.get(src); mutated.remove(src); mutated.putAll(dst, m);
public void addInvokeArgType(AllocDotField df, Context context, Type type) { if (!allocDotFieldToLocal.containsKey(df)) { return; } for (Local l : allocDotFieldToLocal.get(df)) { addInvokeArgType(l, context, type); } }
/** 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 ); }
/** * Adds a callback method found in an XML file to the result set * * @param layoutFile * The XML file in which the callback has been found * @param callback * The callback found in the given XML file */ private void addCallbackMethod(String layoutFile, String callback) { layoutFile = layoutFile.replace("/layout-large/", "/layout/"); callbackMethods.put(layoutFile, callback); // Recursively process any dependencies we might have collected before // we have processed the target if (includeDependencies.containsKey(layoutFile)) for (String target : includeDependencies.get(layoutFile)) addCallbackMethod(target, callback); }
for (UnitBox boxToTrack : boxesToTrack) { if (!boxToTrack.isBranchTarget()) { trackedPhiToBoxes.put(boxToPhiNode.get(boxToTrack), boxToTrack); Iterator<UnitBox> boxesIt = trackedPhiToBoxes.values().iterator(); while (boxesIt.hasNext()) { SUnitBox box = getSBox(boxesIt.next()); Set<UnitBox> boxes = trackedPhiToBoxes.get(u); if (boxes != null) { for (UnitBox ub : boxes) { trackedPhiToBoxes.remove(u); Iterator<UnitBox> boxesIt = trackedPhiToBoxes.values().iterator(); while (boxesIt.hasNext()) { SUnitBox box = getSBox(boxesIt.next());
/** 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. * * 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; }
/** * Removes all units that have previously been created by the instrumenter */ public void undoInstrumentation() { // Remove the redirection methods for (SootMethod sm : source2RedirectMethod.values()) sm.getDeclaringClass().removeMethod(sm); for (Body body : instrumentedUnits.keySet()) { for (Unit u : instrumentedUnits.get(body)) { body.getUnits().remove(u); } } instrumentedUnits.clear(); source2RedirectMethod.clear(); }
/** A local variable is used in an unknown construct. */ void localEscapes(Local l) { // nodes escape globally globEscape.addAll(locals.get(l)); if (doCheck) { sanityCheck(); } }
if (!this.callbackFunctions.containsKey(applicationClass)) return; for (SootClass sc : applicationCallbackClasses.keySet()) for (String methodSig : applicationCallbackClasses.get(sc)){ SootMethodAndClass methodAndClass = SootMethodRepresentationParser.v().parseSootMethodString(methodSig); String subSig = methodAndClass.getSubSignature(); if (activityLifecycleCallbacks.containsKey(sc)) if (AndroidEntryPointConstants.getActivityLifecycleCallbackMethods().contains(subSig)) continue;
public void dump() { for (Iterator vIt = pag.getVarNodeNumberer().iterator(); vIt.hasNext();) { final VarNode v = (VarNode) vIt.next(); mergedNodes.put(v.getReplacement(), v); if (v instanceof LocalVarNode) { SootMethod m = ((LocalVarNode) v).getMethod(); if (m != null) { methodToNodes.put(m, v); } } } try { JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(new File(output_dir, "pag.jar"))); for (Iterator vIt = mergedNodes.keySet().iterator(); vIt.hasNext();) { final VarNode v = (VarNode) vIt.next(); dumpVarNode(v, jarOut); } for (Iterator mIt = methodToNodes.keySet().iterator(); mIt.hasNext();) { final SootMethod m = (SootMethod) mIt.next(); dumpMethod(m, jarOut); } addSymLinks(pag.getVarNodeNumberer().iterator(), jarOut); jarOut.close(); } catch (IOException e) { throw new RuntimeException("Couldn't dump html" + e); } }
public boolean equals(Object o) { if (!(o instanceof PurityGraph)) { return false; } PurityGraph g = (PurityGraph) o; return nodes.equals(g.nodes) // && paramNodes.equals(g.paramNodes) // redundant info && edges.equals(g.edges) && locals.equals(g.locals) && ret.equals(g.ret) && globEscape.equals(g.globEscape) // && backEdges.equals(g.backEdges) // redundant info // && backLocals.equals(g.backLocals) // redundant info && mutated.equals(g.mutated); }