Package soot.jimple

Examples of soot.jimple.InvokeExpr


        }
        else {
          from = quoteString(diff.getShortestExample(true));
        }
        if (stmt.containsInvokeExpr()) {
          InvokeExpr invoke = stmt.getInvokeExpr();
          for (int i=0; i<invoke.getArgCount(); i++) {
            if (box == invoke.getArgBox(i)) {
              stmt.addTag(new StringTag("Type mismatch: cannot convert argument number " + (i+1) + " from " + from + " to " + analyzer.getDescription(a)));
            }
          }
        }
        else if (stmt instanceof IdentityStmt) {
View Full Code Here


    boxStmtMap.put(box,stmt);
    boxAutomatonMap.put(box,automaton);
  }
 
  public void createHotspotsFromInvokeExpr(Stmt stmt) {
    InvokeExpr expr = stmt.getInvokeExpr();
    SootMethod target = expr.getMethod();
    for (int i=0; i<expr.getArgCount(); i++) {
      Value value = expr.getArg(i);
      ValueBox box = expr.getArgBox(i);
      if (isStringType(value.getType())) {
        Map<Integer,Automaton> pMap = parameterAutomatonMap.get(target);
        if (pMap != null && pMap.containsKey(i)) {
          Automaton automaton = pMap.get(i);
          createHotspot(stmt, box, automaton);
View Full Code Here

                    if (!seen.contains(target)) {
                        seen.add(target);
                        worklist.add(target);
                        map.addPage(SiteMapper.makePage(next));
                    }
                    InvokeExpr link = null;
                    if (transition instanceof WebMethodTransition)
                        link = ((WebMethodTransition) transition).getExpr();
                    map.addLink(map.getPageByName(currentName),
                            map.getPageByName(SiteMapper.makePageName(next)),
                            link);
View Full Code Here

                    CompleteUnitGraph cug = new CompleteUnitGraph(sm.retrieveActiveBody());
                    Iterator si = cug.iterator();
                    while (si.hasNext()) {
                        Stmt stmt = (Stmt) si.next();
                        if (stmt.containsInvokeExpr()) {
                            InvokeExpr expr = stmt.getInvokeExpr();
                            if (expr.getMethodRef().getSignature().equals(sig)) {
                                ValueBox box = expr.getArgBox(argnum);
                                list.add(box);
                            }
                        }
                    }
                }
View Full Code Here

                if (sm.isConcrete()) {
                   
                    for (Unit unit : sm.getActiveBody().getUnits()) {
                        Stmt stmt = (Stmt) unit;
                        if (stmt.containsInvokeExpr()) {
                            InvokeExpr expr = stmt.getInvokeExpr();
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: java.lang.String analyze(java.lang.String,java.lang.String)>")) {
                                ValueBox spot = expr.getArgBox(0);
                                Automaton expected = getRegExp(expr).toAutomaton(bindings);
                                hotspots.add(new RuntimeHotspot(spot, expected, HotspotKind.ANALYZE));
                            } else
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: java.lang.String analyze(java.lang.String,java.net.URL)>")) {
                                ValueBox spot = expr.getArgBox(0);
                                Automaton expected = bindings.getFromURL(bindings.getConstantURL(expr.getArg(1)));
                                hotspots.add(new RuntimeHotspot(spot, expected, HotspotKind.ANALYZE));
                            } else
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: java.lang.String check(java.lang.String,java.lang.String)>")) {
                                ValueBox spot = expr.getArgBox(0);
                                Automaton expected = getRegExp(expr).toAutomaton(bindings);
                                hotspots.add(new RuntimeHotspot(spot, expected, HotspotKind.CHECK));
                            } else
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: java.lang.String check(java.lang.String,java.net.URL)>")) {
                                ValueBox spot = expr.getArgBox(0);
                                Automaton expected = bindings.getFromURL(bindings.getConstantURL(expr.getArg(1)));
                                hotspots.add(new RuntimeHotspot(spot, expected, HotspotKind.CHECK));
                            }
                        }
                    }
                }
View Full Code Here

        // check all definitions, all must be invocations of next()
        for (Unit unit : defsOfAt) {
            if (unit instanceof AssignStmt) {
                AssignStmt assign = (AssignStmt) unit;
                if (assign.containsInvokeExpr()) {
                    InvokeExpr invokeExpr = assign.getInvokeExpr();
                    if (!resolver.isNext(invokeExpr.getMethod()))
                        return false;
                } else
                    // new, cast ...
                    return false;
            }
View Full Code Here

     * @see #buildCallGraph(StateMachine)
     */
    private List<SootMethod> handleInvocation(StateMachine stateMachine,
            SootMethod method, Stmt st) {
        assert (st.containsInvokeExpr());
        InvokeExpr expr = st.getInvokeExpr();
        List<SootMethod> queue = new ArrayList<SootMethod>();

        soot.Type exprType = expr.getType();
        SootMethod calledM = expr.getMethod();
        Collection<SootMethod> methods = resolver.getPossibleTargets(calledM);
        // go through all implementations of the invoked method -
        // one of them might return an interesting type.

        for (SootMethod calledMethod : methods) {
View Full Code Here

    private void checkWebAppParams(SootClass contextClass,
            WebMethodTransition transition, SootMethod enclosingMethod,
            Stmt enclosingStatement) {
        final SootClass targetClass = transition.getTarget().getMethod()
                .getDeclaringClass();
        InvokeExpr expr = transition.getExpr();

        // ignore transitions to the same class
        if (targetClass.equals(contextClass))
            return;

        Set<String> originParams = getWebAppParams(contextClass);
        Set<String> targetParams = getWebAppParams(targetClass);
        if (!originParams.equals(targetParams)
                && !resolver.isMappedMakeURL(expr.getMethod())) {
            // find the mismatch:

            HashSet<String> originCopy = new HashSet<String>(originParams);
            HashSet<String> targetCopy = new HashSet<String>(targetParams);
            originCopy.removeAll(targetParams);
View Full Code Here

                if (t instanceof HandlerTransition) {
                    // TODO move enough information into the HandlerTransition
                    // to do the analysis here?
                } else if (t instanceof WebMethodTransition) {
                    final WebMethodTransition webMethodTransition = (WebMethodTransition) t;
                    final InvokeExpr expr = webMethodTransition.getExpr();
                    MethodStatementContainer container = machine
                            .getMakeURLLocation(expr);
                    SootMethod enclosingMethod = container.getMethod();
                    Stmt enclosingStatement = container.getStatement();
View Full Code Here

     * @param enclosingStatement
     *            as the statement enclosing the invocation
     */
    private void typeCheckWebMethodInvocation(WebMethodTransition transition,
            SootMethod enclosingMethod, Stmt enclosingStatement) {
        InvokeExpr expr = transition.getExpr();
        SootMethod webMethod = transition.getTarget().getMethod();
        Type[] varArgTypes = null;
        Type varArgBase = null;
        CompleteUnitGraph graph = new CompleteUnitGraph(
                enclosingMethod.retrieveActiveBody());

        Value varArgs = expr.getArg(expr.getArgs().size() - 1);
        int varArgSize = -1;

        // go through all assignment to determine the varArg types given
        // to makeURL. It is assumed that the varargs array is generated by
        // soot.
View Full Code Here

TOP

Related Classes of soot.jimple.InvokeExpr

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.