Package soot.jimple.toolkits.callgraph

Examples of soot.jimple.toolkits.callgraph.CallGraph


     
        if(!Scene.v().hasCallGraph()) {
          throw new IllegalStateException("No call graph found!");
        }
             
      CallGraph cg = Scene.v().getCallGraph();
      ReachableMethods reachableMethods = new ReachableMethods(cg,Collections.<MethodOrMethodContext>singletonList(container));
      reachableMethods.update();
      for (Iterator<MethodOrMethodContext> iterator = reachableMethods.listener(); iterator.hasNext();) {
        SootMethod m = (SootMethod) iterator.next();
        if(m.hasActiveBody() &&
View Full Code Here


        Scene.v().releaseCallGraph();

        CallGraphBuilder cg = new CallGraphBuilder(DumbPointerAnalysis.v(),
                true);
        cg.build();
        CallGraph callGraph = Scene.v().getCallGraph();
        ReachableMethods reachableMethods = new ReachableMethods(callGraph,
                EntryPoints.v().application());

        reachableMethods.update();
View Full Code Here

        Filter instanceInvokesFilter = new Filter(new InstanceInvokeEdgesPred());
        String modifierOptions = "unsafe";
        //HashMap instanceToStaticMap = new HashMap();

        Scene.v().setCallGraph(new CallGraph());
        CallGraph cg = Scene.v().getCallGraph();

        Iterator classesIt = Scene.v().getApplicationClasses().iterator();

        while (classesIt.hasNext()) {
            SootClass c = (SootClass) classesIt.next();

            LinkedList methodsList = new LinkedList();
            methodsList.addAll(c.getMethods());

            while (!methodsList.isEmpty()) {
                SootMethod container = (SootMethod) methodsList.removeFirst();

                if (!container.isConcrete()) {
                    // System.out.println("skipping " + container + ": not concrete");
                    continue;
                }

                if (!instanceInvokesFilter.wrap(cg.edgesOutOf(container))
                        .hasNext()) {
                    continue;
                }

                JimpleBody b = (JimpleBody) container.getActiveBody();

                List unitList = new ArrayList();
                unitList.addAll(b.getUnits());

                Iterator unitIt = unitList.iterator();

                while (unitIt.hasNext()) {
                    Stmt s = (Stmt) unitIt.next();

                    if (!s.containsInvokeExpr()) {
                        continue;
                    }

                    InvokeExpr ie = s.getInvokeExpr();

                    if (ie instanceof StaticInvokeExpr
                            || ie instanceof SpecialInvokeExpr) {
                        // System.out.println("skipping " + container + ":" +
                        //        s + ": not virtual");
                        continue;
                    }

                    Iterator targets = new Targets(cg.edgesOutOf(s));

                    if (!targets.hasNext()) {
                        continue;
                    }
View Full Code Here

        // Care must be taken in what goes inside this if block. All trails
        // that terminate at leaf nodes must be inside it.
        if (!_isLeaf(method)) {
            // Add all methods shown by the local callGraph to be called
            // by this method.
            CallGraph callGraph = Scene.v().getCallGraph();
            Iterator outEdges = callGraph.edgesOutOf(method);

            while (outEdges.hasNext()) {
                Edge edge = (Edge) outEdges.next();
                SootMethod targetMethod = edge.tgt();
                _add(targetMethod);
View Full Code Here

        _methodToEffectFlow = new HashMap();
        _unprocessedMethods = new ChunkedQueue();

        Iterator methods = _unprocessedMethods.reader();

        CallGraph callGraph = Scene.v().getCallGraph();
        _reachables = new ReachableMethods(callGraph, EntryPoints.v()
                .application());
        _reachables.update();

        // Process all the reachableMethods.
        for (Iterator reachableMethods = _reachables.listener(); reachableMethods
                .hasNext();) {
            _addMethod((SootMethod) reachableMethods.next());
        }

        while (methods.hasNext()) {
            SootMethod nextMethod = (SootMethod) methods.next();
            EffectFlow in = _getEffectFlow(nextMethod);
            EffectFlow out = _processMethod(nextMethod);

            // If the flow has changed, then add all the reachable
            // methods that invoke this method.
            if (!in.equals(out)) {
                _setEffectFlow(nextMethod, out);

                for (Iterator invokers = new Sources(callGraph
                        .edgesInto(nextMethod)); invokers.hasNext();) {
                    SootMethod invoker = (SootMethod) invokers.next();

                    if (_reachables.contains(invoker)) {
                        _addMethod(invoker);
View Full Code Here

        // method contains each invocation and what method(s) can be
        // targeted by that invocation.
        CallGraphBuilder cg = new CallGraphBuilder(DumbPointerAnalysis.v(),
                true);
        cg.build();
        CallGraph callGraph = Scene.v().getCallGraph();
        Scene.v().setCallGraph(callGraph);

        SideEffectAnalysis analysis = new SideEffectAnalysis();

        for (Iterator classes = Scene.v().getApplicationClasses().iterator(); classes
View Full Code Here

        // method contains each invocation and what method(s) can be
        // targeted by that invocation.
        CallGraphBuilder cg = new CallGraphBuilder(DumbPointerAnalysis.v(),
                true);
        cg.build();
        CallGraph callGraph = Scene.v().getCallGraph();
        ReachableMethods reachables = new ReachableMethods(callGraph,
                forcedReachableMethodSet);
        reachables.update();

        Scene.v().setCallGraph(callGraph);
View Full Code Here

TOP

Related Classes of soot.jimple.toolkits.callgraph.CallGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.