Examples of BriefUnitGraph


Examples of soot.toolkits.graph.BriefUnitGraph

     
      // this is necessary even though it seems like it shouldn't be
      units.insertBeforeNoRedirect((Unit)pushZero.clone(), first);
      units.insertBeforeNoRedirect((Unit)storZero.clone(), first);
     
      BriefUnitGraph graph = new BriefUnitGraph(b);
      List l = graph.getPredsOf(begUnit);

      // add initializer seq for try - sets local to zero and loads null exc
      units.add(pushZero);
      units.add(storZero);
     
View Full Code Here

Examples of soot.toolkits.graph.BriefUnitGraph

      ct.addSucc(translations.get(trap.getHandlerUnit()).getFirst());
    }
       
        // connect according to normal flow
        AssertionContext assertionContext = new AssertionContext(jt, definitions, translations, sootMethod);
        BriefUnitGraph normalFlow = new BriefUnitGraph(body);
        for (Unit stmt : body.getUnits()) {
            Statement tail = translations.get(stmt).getLast();
           
            if (stmt instanceof IfStmt) {
                // branching statement: link assertion in-between its successors
                IfStmt ifstmt = (IfStmt)stmt;
               
                Stmt trueSuccessor = ifstmt.getTarget();
                Stmt falseSuccessor = (Stmt)body.getUnits().getSuccOf(ifstmt);
                AssertionBranches assertions = assertionCreator.createAssertions(ifstmt, assertionContext);
               
                tail.addSucc(assertions.getWhenFalse().getFirst());
                tail.addSucc(assertions.getWhenTrue().getFirst());
               
                assertions.getWhenFalse().getLast().addSucc(translations.get(falseSuccessor).getFirst());
                assertions.getWhenTrue().getLast().addSucc(translations.get(trueSuccessor).getFirst());
            }
            else if (stmt instanceof LookupSwitchStmt) {
              LookupSwitchStmt sw = (LookupSwitchStmt)stmt;
             
              // add cases
              List<Integer> values = new ArrayList<Integer>();
              for (int i=0; i<sw.getTargetCount(); i++) {
                Stmt succ = (Stmt)sw.getTarget(i);
                AssertionBranch assertion = assertionCreator.createSwitchAssertions(sw.getKeyBox(), sw.getLookupValue(i), sw, assertionContext);
               
                tail.addSucc(assertion.getFirst());
                assertion.getLast().addSucc(translations.get(succ).getFirst());
               
                values.add(sw.getLookupValue(i));
              }
             
              // add default case
              AssertionBranch assertion = assertionCreator.createSwitchDefaultAssertions(sw.getKeyBox(), values, sw, assertionContext);
              tail.addSucc(assertion.getFirst());
              assertion.getLast().addSucc(translations.get(sw.getDefaultTarget()).getFirst());
            }
            else {
                // normal statement
              for (Unit succ : normalFlow.getSuccsOf(stmt)) {
                  tail.addSucc(translations.get(succ).getFirst());
              }
            }
        }
       
        // connect first statements to the head
        for (Unit stmt : normalFlow.getHeads()) {
          method.getEntry().addSucc(translations.get(stmt).getFirst());
        }
       
        // connect according to exceptional flow
        List<Catch> activeCatchers = new LinkedList<Catch>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.