public boolean hasNext() { if (position.getTgt() != m) { return false; } if (position.kind() == Kind.INVALID) { return false; } return true; }
public boolean hasNext() { if (position.getSrc() != m) { return false; } if (position.kind() == Kind.INVALID) { return false; } return true; }
public boolean hasNext() { if (position.srcUnit() != u) { return false; } if (position.kind() == Kind.INVALID) { return false; } return true; }
public List<SootMethod> find(Unit unit, CallGraph cg, boolean canBeNullList, boolean canBeNative) { List<SootMethod> target = new ArrayList<SootMethod>(); Iterator<Edge> it = cg.edgesOutOf(unit); while (it.hasNext()) { Edge edge = it.next(); SootMethod targetMethod = edge.tgt(); if (targetMethod.isNative() && !canBeNative) { continue; } if (edge.kind() == Kind.CLINIT) { continue; } target.add(targetMethod); } if (target.size() < 1 && !canBeNullList) { throw new RuntimeException("No target method for: " + unit); } return target; } }
private void processNewMethodContext(MethodOrMethodContext momc) { SootMethod m = momc.method(); Iterator<Edge> it = cicg.edgesOutOf(m); while (it.hasNext()) { Edge e = it.next(); cm.addStaticEdge(momc, e.srcUnit(), e.tgt(), e.kind()); } }
/** * Find the specific call edge that is going out from the callsite u and the call target is callee. Without advanced data * structure, we can only sequentially search for the match. Fortunately, the number of outgoing edges for a unit is not * too large. * * @param u * @param callee * @return */ public Edge findEdge(Unit u, SootMethod callee) { Edge e = srcUnitToEdge.get(u); while (e.srcUnit() == u && e.kind() != Kind.INVALID) { if (e.tgt() == callee) { return e; } e = e.nextByUnit(); } return null; }
private ArrayList<MethInfo> getSrcMethods(SootMethod method, boolean recurse) { // logger.debug("meth for srcs: "+method); ArrayList<MethInfo> list = new ArrayList<MethInfo>(); for (Iterator momcIt = methodToContexts.get(method).iterator(); momcIt.hasNext();) { final MethodOrMethodContext momc = (MethodOrMethodContext) momcIt.next(); Iterator callerEdges = cg.edgesInto(momc); while (callerEdges.hasNext()) { Edge callEdge = (Edge) callerEdges.next(); SootMethod methodCaller = callEdge.src(); if (methodCaller.getDeclaringClass().isLibraryClass()) { if (isShowLibMeths()) { if (recurse) { list.add( new MethInfo(methodCaller, hasTgtMethods(methodCaller) | hasSrcMethods(methodCaller), callEdge.kind())); } else { list.add(new MethInfo(methodCaller, true, callEdge.kind())); } } } else { if (recurse) { list.add(new MethInfo(methodCaller, hasTgtMethods(methodCaller) | hasSrcMethods(methodCaller), callEdge.kind())); } else { list.add(new MethInfo(methodCaller, true, callEdge.kind())); } } } } return list; }
if (!resolvedMethods.contains(tgt) && !anyEdge.kind().isFake()) { p = edgeMapping.get(anyEdge); p.is_obsoleted = true;
Edge e = (Edge) edges.next(); SootMethod m = e.tgt(); s.addTag(new LinkTag("CallGraph: Type: " + e.kind() + " Target Method/Context: " + e.getTgt().toString(), m, m.getDeclaringClass().getName(), "Call Graph")); "CallGraph: Source Type: " + callEdge.kind() + " Source Method/Context: " + callEdge.getSrc().toString(), src, methodCaller.getDeclaringClass().getName(), "Call Graph"));
while (edgeInIt.hasNext()) { Edge edge = (Edge) edgeInIt.next(); if (edge.kind() != Kind.THREAD && edge.kind() != Kind.EXECUTOR && edge.kind() != Kind.ASYNCTASK && thread.containsMethod(edge.src())) { ignoremethod = false; Iterator edgeInIt = callGraph.edgesInto(method); while (edgeInIt.hasNext()) { if (((Edge) edgeInIt.next()).kind() != Kind.THREAD) { ignoremethod = false;
while (edges.hasNext()) { Edge e = (Edge) edges.next(); cg.addEdge(new Edge(ct, newStmt, e.tgt(), e.kind())); cg.removeEdge(e);
if (e.isExplicit() || e.kind() == Kind.THREAD || e.kind() == Kind.ASYNCTASK) { addCallTarget(srcmpag, tgtmpag, (Stmt) e.srcUnit(), e.srcCtxt(), e.tgtCtxt(), e); } else if (e.kind() == Kind.EXECUTOR) { InvokeExpr ie = e.srcStmt().getInvokeExpr(); boolean virtualCall = callAssigns.containsKey(ie); } else if (e.kind() == Kind.HANDLER) { InvokeExpr ie = e.srcStmt().getInvokeExpr(); boolean virtualCall = callAssigns.containsKey(ie); } else if (e.kind() == Kind.PRIVILEGED) { } else if (e.kind() == Kind.FINALIZE) { Node srcThis = srcmpag.nodeFactory().caseThis(); srcThis = srcmpag.parameterize(srcThis, e.srcCtxt()); } else if (e.kind() == Kind.NEWINSTANCE) { Stmt s = (Stmt) e.srcUnit(); InstanceInvokeExpr iie = (InstanceInvokeExpr) s.getInvokeExpr(); callAssigns.put(s.getInvokeExpr(), pval); callToMethod.put(s.getInvokeExpr(), srcmpag.getMethod()); } else if (e.kind() == Kind.REFL_INVOKE) { } else if (e.kind() == Kind.REFL_CLASS_NEWINSTANCE || e.kind() == Kind.REFL_CONSTR_NEWINSTANCE) { if (e.kind() == Kind.REFL_CONSTR_NEWINSTANCE) { Value arg = iie.getArg(0); SootMethod tgt = e.getTgt().method();
public boolean hasNext() { if( position.getTgt() != m ) return false; if( position.kind() == Kind.INVALID ) return false; return true; } public Edge next() {
public boolean hasNext() { if( position.srcUnit() != u ) return false; if( position.kind() == Kind.INVALID ) return false; return true; } public Edge next() {
public boolean hasNext() { if( position.getSrc() != m ) return false; if( position.kind() == Kind.INVALID ) return false; return true; } public Edge next() {
private void processNewMethodContext( MethodOrMethodContext momc ) { SootMethod m = momc.method(); Object ctxt = momc.context(); Iterator it = cicg.edgesOutOf(m); while( it.hasNext() ) { Edge e = (Edge) it.next(); cm.addStaticEdge( momc, e.srcUnit(), e.tgt(), e.kind() ); } }
private void processNewMethodContext( MethodOrMethodContext momc ) { SootMethod m = momc.method(); Object ctxt = momc.context(); Iterator it = cicg.edgesOutOf(m); while( it.hasNext() ) { Edge e = (Edge) it.next(); cm.addStaticEdge( momc, e.srcUnit(), e.tgt(), e.kind() ); } }