soot.jimple.toolkits.callgraph.Edge Java Examples
The following examples show how to use
soot.jimple.toolkits.callgraph.Edge.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThrowRiskTf.java From Decca with MIT License | 7 votes |
@Override protected void internalTransform(String phaseName, Map option) { Map<String, String> cgMap = new HashMap<String, String>(); cgMap.put("enabled", "true"); cgMap.put("apponly", "true"); List<SootMethod> entryMthds = new ArrayList<SootMethod>(); for (SootClass sootClass : Scene.v().getApplicationClasses()) { if (entryClses.contains(sootClass.getName())) {// entry class for (SootMethod method : sootClass.getMethods()) { entryMthds.add(method); } } } Scene.v().setEntryPoints(entryMthds); CHATransformer.v().transform("wjtp", cgMap); CallGraph cg = Scene.v().getCallGraph(); Iterator<Edge> ite = cg.iterator(); riskMthds = getRiskMthds(); while (ite.hasNext()) { Edge edge = ite.next(); if (isRiskCall(edge)) { riskRlts.add(new MethodCall(edge.src().getSignature(), edge.tgt().getSignature())); } } }
Example #2
Source File: ObservableDynamicICFG.java From SPDS with Eclipse Public License 2.0 | 6 votes |
private boolean potentiallyHasMoreEdges(Iterator<Edge> chaEdgeIterator, Iterator<Edge> knownEdgeIterator) { // Make a map checking for every edge in the CHA call graph whether it is in the known edges // Start by assuming no edge is covered HashMap<Edge, Boolean> wasEdgeCovered = new HashMap<>(); while (chaEdgeIterator.hasNext()) { wasEdgeCovered.put(chaEdgeIterator.next(), false); } // Put true for all known edges while (knownEdgeIterator.hasNext()) { wasEdgeCovered.put(knownEdgeIterator.next(), true); } // If any single edge is not covered, return false for (Boolean edgeWasCovered : wasEdgeCovered.values()) { if (!edgeWasCovered) { return true; } } // All edges were covered return false; }
Example #3
Source File: JimpleBasedInterproceduralCFG.java From JAADAS with GNU General Public License v3.0 | 6 votes |
@Override public Collection<SootMethod> load(Unit u) throws Exception { ArrayList<SootMethod> res = null; //only retain callers that are explicit call sites or Thread.start() Iterator<Edge> edgeIter = new EdgeFilter().wrap(cg.edgesOutOf(u)); while(edgeIter.hasNext()) { Edge edge = edgeIter.next(); SootMethod m = edge.getTgt().method(); if(m.hasActiveBody()) { if (res == null) res = new ArrayList<SootMethod>(); res.add(m); } else if(IDESolver.DEBUG) System.err.println("Method "+m.getSignature()+" is referenced but has no body!"); } if (res != null) { res.trimToSize(); return res; } else return Collections.emptySet(); }
Example #4
Source File: CallGraphDebugger.java From SPDS with Eclipse Public License 2.0 | 6 votes |
private void computeCallGraphStatistics() { numOfEdgesInCallGraph = callGraph.size(); for (Edge edge : callGraph) { Unit srcUnit = edge.srcUnit(); totalCallSites.add(srcUnit); if (edge.kind().equals(Kind.VIRTUAL)) { virtualCallSites.put(srcUnit, edge.tgt()); predecessors.put(edge.tgt(), srcUnit); } } computeVirtualCallSiteMetrics(); computePredecessorMetrics(); if (icfg != null) { numEdgesFromPrecomputed = icfg.getNumberOfEdgesTakenFromPrecomputedGraph(); } if (numEdgesFromPrecomputed < 0) { numEdgesFromPrecomputed = numOfEdgesInCallGraph; } }
Example #5
Source File: ObservableDynamicICFG.java From SPDS with Eclipse Public License 2.0 | 6 votes |
@Override public void addCallerListener(CallerListener<Unit, SootMethod> listener) { if (!callerListeners.put(listener.getObservedCallee(), listener)) { return; } SootMethod method = listener.getObservedCallee(); logger.debug("Queried for callers of {}.", method); // Notify the new listener about what we already now Iterator<Edge> edgeIterator = demandDrivenCallGraph.edgesInto(method); while (edgeIterator.hasNext()) { Edge edge = edgeIterator.next(); listener.onCallerAdded(edge.srcUnit(), method); } }
Example #6
Source File: HasNextStateMachine.java From SPDS with Eclipse Public License 2.0 | 6 votes |
@Override public Set<WeightedForwardQuery<TransitionFunction>> generateSeed(SootMethod method, Unit unit) { Iterator<Edge> edIt = Scene.v().getCallGraph().edgesOutOf(unit); while (edIt.hasNext()) { SootMethod m = edIt.next().getTgt().method(); if (retrieveIteratorConstructors().contains(m)) { Stmt stmt = ((Stmt) unit); InvokeExpr invokeExpr = stmt.getInvokeExpr(); if (stmt instanceof AssignStmt) { AssignStmt assignStmt = (AssignStmt) stmt; InstanceInvokeExpr iie = (InstanceInvokeExpr) invokeExpr; return Collections .singleton(new WeightedForwardQuery<>( new Statement(stmt, method), new AllocVal(assignStmt.getLeftOp(), method, assignStmt.getLeftOp(), new Statement((Stmt) unit, m)), initialTransition())); } } } return Collections.emptySet(); }
Example #7
Source File: SootCg.java From Decca with MIT License | 6 votes |
public Graph getGraph() { Set<Node> nds = new HashSet<Node>(); List<MethodCall> calls = new ArrayList<MethodCall>(); // form calls and nds CallGraph cg = Scene.v().getCallGraph(); if (cg != null) { Iterator<Edge> ite = cg.iterator(); while (ite.hasNext()) { Edge edge = ite.next(); if (Conf.FLT_INTERFACE) { if (edge.kind().name().equals("INTERFACE")) continue; } String srcClsName = edge.src().getDeclaringClass().getName(); String tgtClsName = edge.tgt().getDeclaringClass().getName(); if (entryClses.contains(tgtClsName)) { // edge to entry-jar } else if (conflictJarClses.contains(srcClsName)) { // edge from conflict-jar } else { String tgtMthdName = edge.tgt().getSignature(); String srcMthdName = edge.src().getSignature(); calls.add(new MethodCall(srcMthdName, tgtMthdName)); nds.add(new Node(srcMthdName, entryClses.contains(srcClsName))); nds.add(new Node(tgtMthdName, entryClses.contains(tgtClsName))); } } } return new Graph(nds, calls); }
Example #8
Source File: IntValueAnalysis.java From DroidRA with GNU Lesser General Public License v2.1 | 5 votes |
/** * Return all possible values for an integer local variable. * * @param start The statement where the analysis should start. * @param local The local variable whose values we are looking for. * @param visitedStmts The set of visited statement. * @return The set of possible values for the local variable. */ private Set<Object> findIntAssignmentsForLocal(Stmt start, Local local, Set<Stmt> visitedStmts) { List<DefinitionStmt> assignStmts = findAssignmentsForLocal(start, local, true, new HashSet<Pair<Unit, Local>>()); Set<Object> result = new HashSet<>(assignStmts.size()); for (DefinitionStmt assignStmt : assignStmts) { Value rhsValue = assignStmt.getRightOp(); if (rhsValue instanceof IntConstant) { result.add(((IntConstant) rhsValue).value); } else if (rhsValue instanceof LongConstant) { result.add(((LongConstant) rhsValue).value); } else if (rhsValue instanceof ParameterRef) { ParameterRef parameterRef = (ParameterRef) rhsValue; Iterator<Edge> edges = Scene.v().getCallGraph() .edgesInto(AnalysisParameters.v().getIcfg().getMethodOf(assignStmt)); while (edges.hasNext()) { Edge edge = edges.next(); InvokeExpr invokeExpr = edge.srcStmt().getInvokeExpr(); Value argValue = invokeExpr.getArg(parameterRef.getIndex()); if (argValue instanceof IntConstant) { result.add(((IntConstant) argValue).value); } else if (argValue instanceof LongConstant) { result.add(((LongConstant) argValue).value); } else if (argValue instanceof Local) { Set<Object> newResults = findIntAssignmentsForLocal(edge.srcStmt(), (Local) argValue, visitedStmts); result.addAll(newResults); } else { result.add(TOP_VALUE); } } } else { return Collections.singleton((Object) TOP_VALUE); } } return result; }
Example #9
Source File: SignatureStateMachine.java From SPDS with Eclipse Public License 2.0 | 5 votes |
@Override public Collection<WeightedForwardQuery<TransitionFunction>> generateSeed(SootMethod m, Unit unit) { for (SootMethod cons : constructor()) { Iterator<Edge> edIt = Scene.v().getCallGraph().edgesOutOf(unit); while (edIt.hasNext()) { SootMethod calledMethod = edIt.next().getTgt().method(); if (calledMethod.equals(cons)) return getLeftSideOf(m, unit); } } return Collections.emptySet(); }
Example #10
Source File: DefaultJimpleRepresentation.java From vasco with GNU Lesser General Public License v2.1 | 5 votes |
/** * Resolves virtual calls using the default call graph and returns * a list of methods which are the targets of explicit edges. * TODO: Should we consider thread/clinit edges? */ @Override public List<SootMethod> resolveTargets(SootMethod method, Unit node) { List<SootMethod> targets = new LinkedList<SootMethod>(); Iterator<Edge> it = Scene.v().getCallGraph().edgesOutOf(node); while(it.hasNext()) { Edge edge = it.next(); if (edge.isExplicit()) { targets.add(edge.tgt()); } } return targets; }
Example #11
Source File: ObservableDynamicICFG.java From SPDS with Eclipse Public License 2.0 | 5 votes |
public CallGraph getCallGraphCopy() { CallGraph copy = new CallGraph(); for (Edge edge : demandDrivenCallGraph) { Edge edgeCopy = new Edge(edge.src(), edge.srcUnit(), edge.tgt(), edge.kind()); copy.addEdge(edgeCopy); } return copy; }
Example #12
Source File: InfoFlowAnalysis.java From JAADAS with GNU General Public License v3.0 | 5 votes |
protected HashMutableDirectedGraph<EquivalentValue> getInvokeInfoFlowSummary( InvokeExpr ie, Stmt is, SootMethod context) { // get the data flow graph for each possible target of ie, // then combine them conservatively and return the result. HashMutableDirectedGraph<EquivalentValue> ret = null; SootMethodRef methodRef = ie.getMethodRef(); String subSig = methodRef.resolve().getSubSignature(); CallGraph cg = Scene.v().getCallGraph(); for(Iterator<Edge> edges = cg.edgesOutOf(is); edges.hasNext();) { Edge e = edges.next(); SootMethod target = e.getTgt().method(); // Verify that this target is an implementation of the method we intend to call, // and not just a class initializer or other unintended control flow. if(target.getSubSignature().equals(subSig)) { HashMutableDirectedGraph<EquivalentValue> ifs = getMethodInfoFlowSummary( target, context.getDeclaringClass().isApplicationClass()); if(ret == null) ret = ifs; else { for(EquivalentValue node : ifs.getNodes()) { if(!ret.containsNode(node)) ret.addNode(node); for(EquivalentValue succ : ifs.getSuccsOf(node)) ret.addEdge(node, succ); } } } } return ret; // return getMethodInfoFlowSummary(methodRef.resolve(), context.getDeclaringClass().isApplicationClass()); }
Example #13
Source File: CallGraphTest.java From vasco with GNU Lesser General Public License v2.1 | 5 votes |
public static List<SootMethod> getSparkExplicitEdges(Unit callStmt) { Iterator<Edge> edges = Scene.v().getCallGraph().edgesOutOf(callStmt); List<SootMethod> targets = new LinkedList<SootMethod>(); while (edges.hasNext()) { Edge edge = edges.next(); if (edge.isExplicit()) { targets.add(edge.tgt()); } } return targets; }
Example #14
Source File: ObservableDynamicICFG.java From SPDS with Eclipse Public License 2.0 | 5 votes |
@Override public void addCalleeListener(CalleeListener<Unit, SootMethod> listener) { if (!calleeListeners.put(listener.getObservedCaller(), listener)) { return; } // Notify the new listener about edges we already know Unit unit = listener.getObservedCaller(); Stmt stmt = (Stmt) unit; Iterator<Edge> edgeIterator = demandDrivenCallGraph.edgesOutOf(unit); while (edgeIterator.hasNext()) { Edge edge = edgeIterator.next(); listener.onCalleeAdded(unit, edge.tgt()); } InvokeExpr ie = stmt.getInvokeExpr(); // Now check if we need to find new edges if ((ie instanceof InstanceInvokeExpr)) { // If it was invoked on an object we might find new instances if (ie instanceof SpecialInvokeExpr) { // If it was a special invoke, there is a single target addCallIfNotInGraph(unit, ie.getMethod(), Kind.SPECIAL); // If the precomputed graph has more edges than our graph, there may be more edges to find } else if (precomputedCallGraph != null && potentiallyHasMoreEdges(precomputedCallGraph.edgesOutOf(unit), demandDrivenCallGraph.edgesOutOf(unit))) { // Query for callees of the unit and add edges to the graph queryForCallees(unit); } } else { // Call was not invoked on an object. Must be static addCallIfNotInGraph(unit, ie.getMethod(), Kind.STATIC); } }
Example #15
Source File: ObservableStaticICFG.java From SPDS with Eclipse Public License 2.0 | 5 votes |
private void addEdgesForCallees(SootMethod sootMethod, HashSet<SootMethod> visited, CallGraph copy) { visited.add(sootMethod); for (Unit callsite : precomputedGraph.getCallsFromWithin(sootMethod)) { for (SootMethod callee : precomputedGraph.getCalleesOfCallAt(callsite)) { copy.addEdge(new Edge(sootMethod, (Stmt) callsite, callee)); if (!visited.contains(callee)) { addEdgesForCallees(callee, visited, copy); } } } }
Example #16
Source File: CallGraphTest.java From vasco with GNU Lesser General Public License v2.1 | 5 votes |
public static List<SootMethod> getSparkExplicitEdges(SootMethod sootMethod) { Iterator<Edge> edges = Scene.v().getCallGraph().edgesOutOf(sootMethod); List<SootMethod> targets = new LinkedList<SootMethod>(); while (edges.hasNext()) { Edge edge = edges.next(); if (edge.isExplicit()) { targets.add(edge.tgt()); } } return targets; }
Example #17
Source File: CallGraphDebugger.java From SPDS with Eclipse Public License 2.0 | 5 votes |
/** * Add all edges to string builder. The nodes between which edges run will be included, other methods will not. */ private void addMethodsToDotfile(StringBuilder stringBuilder) { for (Edge edge : callGraph) { addMethodToDotFile(stringBuilder, edge.src()); stringBuilder.append(" -> "); addMethodToDotFile(stringBuilder, edge.tgt()); stringBuilder.append("; \n"); } }
Example #18
Source File: JimpleBasedInterproceduralCFG.java From JAADAS with GNU General Public License v3.0 | 5 votes |
@Override public Collection<Unit> load(SootMethod m) throws Exception { ArrayList<Unit> res = new ArrayList<Unit>(); //only retain callers that are explicit call sites or Thread.start() Iterator<Edge> edgeIter = new EdgeFilter().wrap(cg.edgesInto(m)); while(edgeIter.hasNext()) { Edge edge = edgeIter.next(); res.add(edge.srcUnit()); } res.trimToSize(); return res; }
Example #19
Source File: JimpleBasedInterproceduralCFG.java From JAADAS with GNU General Public License v3.0 | 5 votes |
protected EdgeFilter() { super(new EdgePredicate() { @Override public boolean want(Edge e) { return e.kind().isExplicit() || e.kind().isThread() || e.kind().isExecutor() || e.kind().isAsyncTask() || e.kind().isClinit() || e.kind().isPrivileged(); } }); }
Example #20
Source File: CallGraphTest.java From vasco with GNU Lesser General Public License v2.1 | 5 votes |
private static long countCallChains(SootMethod method, int k) { if (k == 0) return 1; long count = 1; Iterator<Edge> edges = Scene.v().getCallGraph().edgesOutOf(method); while(edges.hasNext()) { Edge edge = edges.next(); if (edge.isExplicit()) { SootMethod target = edge.tgt(); count = count + countCallChains(target, k-1); } } return count; }
Example #21
Source File: SootCallgraphConstructor.java From steady with Apache License 2.0 | 5 votes |
/** * Normalizing a soot callgraph to a general graph represented by ConstructId * * @return a {@link com.ibm.wala.util.graph.Graph} object. */ public Graph<com.sap.psr.vulas.shared.json.model.ConstructId> getCallgraph() { final Graph<com.sap.psr.vulas.shared.json.model.ConstructId> graph = SlowSparseNumberedGraph.make(); if (this.callgraph != null) { int edges_no = 0; com.sap.psr.vulas.shared.json.model.ConstructId src_cid = null, tgt_cid = null; MethodOrMethodContext src_node = null; Iterator<Edge> edges = null; final Iterator<MethodOrMethodContext> src_nodes = callgraph.sourceMethods(); while (src_nodes.hasNext()) { src_node = src_nodes.next(); src_cid = getCid(src_node.method()); graph.addNode(src_cid); //add edges edges = this.callgraph.edgesOutOf(src_node); while (edges.hasNext()) { tgt_cid = getCid(edges.next().tgt()); graph.addNode(tgt_cid); if (!graph.hasEdge(src_cid, tgt_cid)) { graph.addEdge(src_cid, tgt_cid); edges_no++; } } } SootCallgraphConstructor.log.info("Normalized call graph has [" + graph.getNumberOfNodes() + " nodes] (with distinct ConstructId) and [" + edges_no + "] edges"); } // No callgraph exists else { throw new IllegalStateException("There exists no call graph"); } return graph; }
Example #22
Source File: GeomPointsTo.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** * Data structures that only specific to geometric solver are created here. * The initialized container sizes are empirically chosen from the primes. * We believe most of the machine today can afford the memory overhead. */ private void prepareContainers() { // All kinds of variables consG = new HashMap<Node, IVarAbstraction>(39341); // Only the pointer variables pointers = new ZArrayNumberer<IVarAbstraction>(25771); // Only the heap variables allocations = new ZArrayNumberer<IVarAbstraction>(); // The constraints extracted from code constraints = new ZArrayNumberer<PlainConstraint>(25771); // The statements that fork a new thread thread_run_callsites = new HashSet<Stmt>(251); // The virtual callsites that have multiple call targets multiCallsites = new HashSet<Stmt>(251); // The fake virtual call edges created by SPARK // obsoletedEdges = new Vector<CgEdge>(4021); // A linkedlist used for traversing the call graph queue_cg = new LinkedList<Integer>(); // Containers for functions and call graph edges func2int = new HashMap<SootMethod, Integer>(5011); int2func = new HashMap<Integer, SootMethod>(5011); edgeMapping = new HashMap<Edge, CgEdge>(19763); consG.clear(); constraints.clear(); func2int.clear(); edgeMapping.clear(); }
Example #23
Source File: GeomQueries.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** * Standard K-CFA querying for field expression. * * @param callEdgeChain: callEdgeChain[0] is the farthest call edge in the chain. * @param l * @param field * @param visitor * @return */ @SuppressWarnings("rawtypes") public boolean contextByCallChain(Edge[] callEdgeChain, Local l, SparkField field, PtSensVisitor visitor) { // We first obtain the points-to information for l Obj_full_extractor pts_l = new Obj_full_extractor(); if ( contextsByCallChain(callEdgeChain, l, pts_l) == false ) return false; // We compute the points-to information for l.field visitor.prepare(); for ( IntervalContextVar icv : pts_l.outList ) { AllocNode obj = (AllocNode)icv.var; AllocDotField obj_f = geomPts.findAllocDotField(obj, field); if ( obj_f == null ) continue; IVarAbstraction objField = geomPts.findInternalNode(obj_f); if ( objField == null ) continue; long L = icv.L; long R = icv.R; assert L < R; objField.get_all_context_sensitive_objects(L, R, visitor); } pts_l = null; visitor.finish(); return visitor.numOfDiffObjects() != 0; }
Example #24
Source File: AnalyzeJimpleClass.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private boolean isInheritedMethod(Stmt stmt, String... classNames) { Iterator<Edge> edgeIt = Scene.v().getCallGraph().edgesOutOf(stmt); while (edgeIt.hasNext()) { Edge edge = edgeIt.next(); String targetClass = edge.getTgt().method().getDeclaringClass().getName(); for (String className : classNames) if (className.equals(targetClass)) return true; } return false; }
Example #25
Source File: GeomQueries.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** * Searching the points-to results for field expression such as p.f. * * @param sootEdge * @param l * @param field * @param visitor * @return */ @SuppressWarnings("rawtypes") public boolean contextsByAnyCallEdge(Edge sootEdge, Local l, SparkField field, PtSensVisitor visitor) { Obj_full_extractor pts_l = new Obj_full_extractor(); if ( contexsByAnyCallEdge(sootEdge, l, pts_l) == false ) return false; visitor.prepare(); for ( IntervalContextVar icv : pts_l.outList ) { AllocNode obj = (AllocNode)icv.var; AllocDotField obj_f = geomPts.findAllocDotField(obj, field); if ( obj_f == null ) continue; IVarAbstraction objField = geomPts.findInternalNode(obj_f); if ( objField == null ) continue; long L = icv.L; long R = icv.R; assert L < R; objField.get_all_context_sensitive_objects(L, R, visitor); } pts_l = null; visitor.finish(); return visitor.numOfDiffObjects() != 0; }
Example #26
Source File: SootInfo.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public static int countCallEdgesForCallsite(Stmt callsite, boolean stopForMutiple) { CallGraph cg = Scene.v().getCallGraph(); int count = 0; for ( Iterator<Edge> it = cg.edgesOutOf(callsite); it.hasNext(); ) { it.next(); ++count; if ( stopForMutiple && count > 1) break; } return count; }
Example #27
Source File: PAG.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public Pair<Node, Node> addInterproceduralAssignment(Node from, Node to, Edge e) { Pair<Node, Node> val = new Pair<Node, Node>(from, to); if ( runGeomPTA ) { Set<Edge> sets = assign2edges.get(val); if ( sets == null ) { sets = new HashSet<Edge>(); assign2edges.put(val, sets); } sets.add(e); } return val; }
Example #28
Source File: GeomPointsTo.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override public PointsToSet reachingObjects(Context c, Local l) { if ( !hasExecuted ) return super.reachingObjects(c, l); if ( hasTransformed || !(c instanceof Unit) ) return reachingObjects(l); LocalVarNode vn = findLocalVarNode(l); if ( vn == null ) return EmptyPointsToSet.v(); // Lookup the context sensitive points-to information for this pointer IVarAbstraction pn = consG.get(vn); if ( pn == null ) return vn.getP2Set(); pn = pn.getRepresentative(); // Obtain the context sensitive points-to result SootMethod callee = vn.getMethod(); Edge e = Scene.v().getCallGraph().findEdge((Unit) c, callee); if (e == null) return vn.getP2Set(); // Compute the contexts interval CgEdge myEdge = getInternalEdgeFromSootEdge(e); if (myEdge == null) return vn.getP2Set(); long low = myEdge.map_offset; long high = low + max_context_size_block[myEdge.s]; // Lookup the cache ContextVarNode cvn = vn.context(c); if ( cvn != null ) { PointsToSetInternal ans = cvn.getP2Set(); if ( ans != EmptyPointsToSet.v() ) return ans; } else { // Create a new context sensitive variable // The points-to vector is set to empty at start cvn = makeContextVarNode(vn, c); } // Fill PointsToSetInternal ptset = cvn.makeP2Set(); for ( AllocNode an : pn.get_all_points_to_objects() ) { if ( pn.pointer_interval_points_to(low, high, an) ) ptset.add(an); } return ptset; }
Example #29
Source File: ClassThrowTf.java From Decca with MIT License | 4 votes |
@Override protected boolean isRiskCall(Edge edge) { return thrownMthds.contains(edge.tgt().getSignature()); }
Example #30
Source File: DummyMainGenerator.java From DroidRA with GNU Lesser General Public License v2.1 | 4 votes |
public SootMethod appendNonComponents(SootMethod mainMethod) { Set<String> coveredMethods = new HashSet<String>(); CallGraph cg = Scene.v().getCallGraph(); for (Iterator<Edge> iter = cg.iterator(); iter.hasNext(); ) { Edge edge = iter.next(); coveredMethods.add(edge.src().getSignature()); coveredMethods.add(edge.tgt().getSignature()); } Chain<SootClass> sootClasses = Scene.v().getApplicationClasses(); for (Iterator<SootClass> iter = sootClasses.iterator(); iter.hasNext();) { SootClass sc = iter.next(); List<SootMethod> methodList = sc.getMethods(); for (SootMethod sm : methodList) { if (sm.getDeclaringClass().getName().startsWith("android.support")) { continue; } if (sc.isPhantom() || ! sm.isConcrete()) { continue; } if (sm.getName().equals("<init>") || sm.getName().equals("<clinit>")) { continue; } if (coveredMethods.contains(sm.getSignature())) { //Already covered. continue; } mainMethod = addMethod(mainMethod, sm.getSignature()); } } return mainMethod; }