Java 类soot.jimple.internal.JAssignStmt 实例源码

项目:JAADAS    文件:MoveResultInstruction.java   
public void jimplify (DexBody body) {
//        if (local != null && expr != null)
//            throw new RuntimeException("Both local and expr are set to move.");

        int dest = ((OneRegisterInstruction)instruction).getRegisterA();

//        if (local != null)
//            assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), local);
//        else if (expr != null)
//            assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);
//        else
//            throw new RuntimeException("Neither local and expr are set to move.");
        assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), body.getStoreResultLocal());
        setUnit(assign);
        addTags(assign);
        if (tag != null)
            assign.addTag(tag);
        body.add(assign);

        if (IDalvikTyper.ENABLE_DVKTYPER) {
            Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
          int op = (int)instruction.getOpcode().value;
          JAssignStmt jassign = (JAssignStmt)assign;
          DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox());
        }
    }
项目:JAADAS    文件:UnopInstruction.java   
public void jimplify (DexBody body) {
      if(!(instruction instanceof Instruction12x))
          throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

      Instruction12x cmpInstr = (Instruction12x)instruction;
      int dest = cmpInstr.getRegisterA();

      Local source = body.getRegisterLocal(cmpInstr.getRegisterB());
      Value expr = getExpression(source);

      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);

      setUnit(assign);
      addTags(assign);
      body.add(assign);

if (IDalvikTyper.ENABLE_DVKTYPER) {
    Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        //DalvikTyper.v().captureAssign((JAssignStmt)assign, op);
        JAssignStmt jass = (JAssignStmt)assign;
        DalvikTyper.v().setType((expr instanceof JCastExpr) ? ((JCastExpr) expr).getOpBox() : ((UnopExpr) expr).getOpBox(), opUnType[op - 0x7b], true);
        DalvikTyper.v().setType(jass.leftBox, resUnType[op - 0x7b], false);
      }
  }
项目:petablox    文件:SimpleCtxtsAnalysis.java   
Type h2t(Unit h) {
    if(h instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)h;
        if(SootUtilities.isNewStmt(j)){
            NewExpr ne = (NewExpr)j.rightBox.getValue();
            return ne.getType();
        }else if(SootUtilities.isNewArrayStmt(j)){
            NewArrayExpr nae = (NewArrayExpr)j.rightBox.getValue();
            return nae.getType();
        }else if(SootUtilities.isNewMultiArrayStmt(j)){
            JNewMultiArrayExpr jnmae = (JNewMultiArrayExpr)j.rightBox.getValue();
            return jnmae.getType();
        }
    }
    return null;
}
项目:petablox    文件:CtxtsAnalysis.java   
Type h2t(Unit h) {
    if(h instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)h;
        if(SootUtilities.isNewStmt(j)){
            NewExpr ne = (NewExpr)j.rightBox.getValue();
            return ne.getType();
        }else if(SootUtilities.isNewArrayStmt(j)){
            NewArrayExpr nae = (NewArrayExpr)j.rightBox.getValue();
            return nae.getType();
        }else if(SootUtilities.isNewMultiArrayStmt(j)){
            JNewMultiArrayExpr jnmae = (JNewMultiArrayExpr)j.rightBox.getValue();
            return jnmae.getType();
        }
    }
    return null;
}
项目:petablox    文件:CtxtsAnalysis.java   
Type h2t(Unit h) {
    if(h instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)h;
        if(SootUtilities.isNewStmt(j)){
            NewExpr ne = (NewExpr)j.rightBox.getValue();
            return ne.getType();
        }else if(SootUtilities.isNewArrayStmt(j)){
            NewArrayExpr nae = (NewArrayExpr)j.rightBox.getValue();
            return nae.getType();
        }else if(SootUtilities.isNewMultiArrayStmt(j)){
            JNewMultiArrayExpr jnmae = (JNewMultiArrayExpr)j.rightBox.getValue();
            return jnmae.getType();
        }
    }
    return null;
}
项目:petablox    文件:DomH.java   
public static Type getType(Unit u) {                                 
    Type t=null;
    if(u instanceof JAssignStmt){
        JAssignStmt as = (JAssignStmt) u;
        Value right=as.rightBox.getValue();
        if (SootUtilities.isNewStmt(as)) 
            t = ((JNewExpr)right).getType();
        else if (SootUtilities.isNewArrayStmt(as)) 
            t = ((JNewArrayExpr)right).getType();
        else if (SootUtilities.isNewMultiArrayStmt(as))
            t = ((JNewMultiArrayExpr)right).getType();
    }
    else {
        assert (SootUtilities.isInvoke(u));
        t = null;
    }
    return t;
}
项目:petablox    文件:RelIinvkRet.java   
@Override
public void fill() {
    DomI domI = (DomI) doms[0];
    DomV domV = (DomV) doms[2];
    int numI = domI.size();
    for (int iIdx = 0; iIdx < numI; iIdx++) {
        Unit u = (Unit) domI.get(iIdx);           
        Local v = null;
        if (u instanceof JAssignStmt) v = (Local)((JAssignStmt)u).leftBox.getValue();
        if (v != null) {
            if (v.getType() instanceof RefLikeType) {
                int vIdx = domV.indexOf(v);
                assert (vIdx >= 0);
                add(iIdx, 0, vIdx);
            }
        }
    }
}
项目:petablox    文件:RelEF.java   
public void fill() {
    DomE domE = (DomE) doms[0];
    DomF domF = (DomF) doms[1];
    int numE = domE.size();
    for (int eIdx = 0; eIdx < numE; eIdx++) {
        Unit e = (Unit)domE.get(eIdx);
        //jq_Field f = e.getField();
        if(e instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)e;
            if(j.containsFieldRef()){
                SootField f = j.getFieldRef().getField();
                int fIdx = domF.indexOf(f);
                assert (fIdx >= 0);
                add(eIdx, fIdx);
            }
            else if(SootUtilities.isLoadInst(j) || SootUtilities.isStoreInst(j)){
                add(eIdx, 0);
            }
        }  
    }
}
项目:petablox    文件:DomE.java   
@Override
public void visitHeapInst(Unit u) {
    if (u instanceof JAssignStmt){
        JAssignStmt as = (JAssignStmt) u;

        if (SootUtilities.isFieldLoad(as)) {
            if(as.rightBox.getValue() instanceof InstanceFieldRef)
                if (!(((InstanceFieldRef)as.rightBox.getValue()).getBase() instanceof Local))
                    return;
        }
        if (SootUtilities.isFieldStore(as)) {
            if(as.rightBox.getValue() instanceof InstanceFieldRef)
                if (!(((InstanceFieldRef)as.leftBox.getValue()).getBase() instanceof Local))
                    return;
        }
    }

    add(u);
}
项目:petablox    文件:MetaBackAnalysis.java   
/**
 * Check whether current instruction is an instruction after a method invoke
 * 
 * @param wpe
 */
private void checkInvoke(IWrappedPE<Edge, Edge> wpe) {
    if (wpe.getWSE() != null) {  // if wse!=null, wpe is a path edge
        // immediately after a method call
        IWrappedPE<Edge, Edge> cwpe = wpe.getWPE();
        Unit inst = cwpe.getInst();
        // TODO: Verify Empty basic block case
        /*if (inst instanceof Block) { // an empty basic block
            assert ((Block) inst).getHead() == null;
            return;
        }*/
        Unit q = (Unit) inst;
        if (iterAnalysis.isThreadStart(q))
            return;
        soot.Value ro = null;
        if(q instanceof JAssignStmt){
            ro = ((JAssignStmt)q).leftBox.getValue();
        }
        retIdx = -1;
        if (ro != null && ro.getType() instanceof RefLikeType) {
            retIdx = iterAnalysis.getDomVIdx((Local)ro);
        }
        callStack.push(cwpe);
    }
}
项目:petablox    文件:RelQueryE.java   
@Override
public void fill() {
    ProgramRel relCheckExcludedE = (ProgramRel) ClassicProject.g().getTrgt("checkExcludedE");
    relCheckExcludedE.load();
    DomE domE = (DomE) doms[0];
    for (Unit q : domE) {
        if(q instanceof JAssignStmt){
            JAssignStmt jas = (JAssignStmt)q;
            if(SootUtilities.isStaticGet(jas) || SootUtilities.isStaticPut(jas))
                continue;
        }
        if (!relCheckExcludedE.contains(q))
            add(q);
    }
    relCheckExcludedE.close();
}
项目:petablox    文件:RelMputStatFldInst.java   
public void visitHeapInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isStaticPut(j)){
            SootField f = j.getFieldRef().getField();
            if(j.leftBox.getValue().getType() instanceof RefLikeType){
                if (j.rightBox.getValue() instanceof Local) {
                Local r = (Local)j.rightBox.getValue();
                int mIdx = domM.indexOf(ctnrMethod);
                 assert (mIdx >= 0);
                 int rIdx = domV.indexOf(r);
                 assert (rIdx >= 0);
                 int fIdx = domF.indexOf(f);
                 assert (fIdx >= 0);
                 add(mIdx, fIdx, rIdx);
                }
            }
        }
    }
}
项目:petablox    文件:RelPputStatFldInst.java   
public void visitHeapInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isStaticPut(j)){
            SootField f = j.getFieldRef().getField();
            if(j.leftBox.getValue().getType() instanceof RefLikeType &&
                    j.rightBox.getValue() instanceof Local){
                Local r = (Local)j.rightBox.getValue();
                int pIdx = domP.indexOf(q);
                assert (pIdx >= 0);
                int rIdx = domV.indexOf(r);
                assert (rIdx >= 0);
                int fIdx = domF.indexOf(f);
                assert (fIdx >= 0);
                add(pIdx, fIdx, rIdx);
            }
        }
    }
}
项目:petablox    文件:RelPgetStatFldInst.java   
public void visitHeapInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isStaticGet(j) &&
                j.rightBox.getValue().getType() instanceof RefLikeType){
            SootField f = j.getFieldRef().getField();
            Local l = (Local)j.leftBox.getValue();
            int pIdx = domP.indexOf(q);
            assert (pIdx >= 0);
            int lIdx = domV.indexOf(l);
            assert (lIdx >= 0);
            int fIdx = domF.indexOf(f);
            assert (fIdx >= 0);
            add(pIdx, lIdx, fIdx);
        }
    }
}
项目:petablox    文件:RelMgetStatFldInst.java   
public void visitHeapInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        Type right = j.rightBox.getValue().getType();
        if(SootUtilities.isStaticGet(j) && !(right instanceof PrimType)){
            SootField f = j.getFieldRef().getField();
            Local l = (Local)j.leftBox.getValue();
            int mIdx = domM.indexOf(ctnrMethod);
            assert (mIdx >= 0);
            int lIdx = domV.indexOf(l);
            assert (lIdx >= 0);
            int fIdx = domF.indexOf(f);
            assert (fIdx >= 0);
            add(mIdx, lIdx, fIdx);
        }
    }
}
项目:petablox    文件:RelPobjValAsgnInst.java   
public void fill() {
    DomP domP = (DomP) doms[0];
    DomV domV = (DomV) doms[1];
    DomH domH = (DomH) doms[2];
    int numH = domH.size();
    for (int hIdx = 1; hIdx < numH; hIdx++) {
        Unit h = (Unit) domH.get(hIdx);
        int pIdx = domP.indexOf(h);
        assert (pIdx >= 0);
        if(h instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)h;
            if(SootUtilities.isNewStmt(j) || SootUtilities.isNewArrayStmt(j)){
                Local v = (Local)j.leftBox.getValue();
                int vIdx = domV.indexOf(v);
                assert (vIdx >= 0);
                add(pIdx, vIdx, hIdx);
            }
        }
    }
}
项目:petablox    文件:RelMobjVarAsgnInst.java   
public void visitPhiInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        Value left = j.leftBox.getValue();
        Value right = j.rightBox.getValue();
        if(right instanceof SPhiExpr && left.getType() instanceof RefLikeType){
            SPhiExpr phi = (SPhiExpr)right;
            Local l =(Local)left;
            List<ValueUnitPair> args = phi.getArgs();
            for(ValueUnitPair vu : args){
                Value v = vu.getValue();
                if(v instanceof Local){
                    add(ctnrMethod, l, (Local)v);
                }
            }
        }
    }
}
项目:petablox    文件:RelMcheckCastInst.java   
public void visitCastInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        Value left = j.leftBox.getValue();
        Value right = j.rightBox.getValue();
        if(right instanceof JCastExpr){
            JCastExpr jce = (JCastExpr)right;
            Type t = jce.getCastType();
            if(jce.getOp() instanceof Local && t instanceof RefLikeType){
            Local src = (Local)jce.getOp();
            Local dst = (Local)left;
            int mIdx = domM.indexOf(ctnrMethod);
             assert (mIdx >= 0);
             int lIdx = domV.indexOf(dst);
             assert (lIdx >= 0);
             int tIdx = domT.indexOf(t);
             assert (tIdx >= 0);
             int rIdx = domV.indexOf(src);
             assert (rIdx >= 0);
             add(mIdx, lIdx, tIdx, rIdx);
        }
        }
    }
}
项目:petablox    文件:Instrumentor.java   
public static boolean isRelevant(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt as=(JAssignStmt)q;
        return
SootUtilities.isFieldLoad(as)||
         SootUtilities.isStoreInst(as) ||
         SootUtilities.isNewStmt(as)||
         SootUtilities.isLoadInst(as)||
         SootUtilities.isFieldStore(as) ||
         SootUtilities.isStaticGet(as)||
         SootUtilities.isStaticPut(as) ||
         SootUtilities.isInvoke(as) ||
         SootUtilities.isNewArrayStmt(as);  
    }
    return
        SootUtilities.isInvoke(q) ||
        (q instanceof JReturnStmt || q instanceof JReturnVoidStmt)||
        q instanceof MonitorStmt;
}
项目:petablox    文件:SSAUtilities.java   
public static void removeMoves(SootMethod m) {
    List<Unit> moves = new ArrayList<Unit>();
    Body b = m.retrieveActiveBody();
    PatchingChain<Unit> upc = b.getUnits();
    Iterator<Unit> uit = upc.iterator();
    while (uit.hasNext()) {
        Unit u = (Unit)uit.next();
        if (!(u instanceof IdentityStmt) && (u instanceof JAssignStmt) && SootUtilities.isMoveInst((JAssignStmt)u))
            moves.add(u);       
    }

    for (int i = 0; i < moves.size(); i++) {
        JAssignStmt curr = (JAssignStmt)moves.get(i);
        Local left = (Local)curr.leftBox.getValue();
        Local right = (Local)curr.rightBox.getValue();
        Unit currSucc = upc.getSuccOf(curr);
            moveLabel(m, curr, currSucc);
            upc.remove(curr);
            List<ValueBox> useList = b.getUseBoxes();
            for (int j = 0; j < useList.size(); j++) {
                if (useList.get(j).getValue() == left)
                    useList.get(j).setValue(right);
            }
    }   
}
项目:soot-inflow    文件:ListExampleWrapper.java   
@Override
public Set<AccessPath> getTaintsForMethod(Stmt stmt, AccessPath taintedPath) {
    // method add + added element is tainted -> whole list is tainted
    if(stmt.getInvokeExpr().getMethod().getSubSignature().equals("boolean add(java.lang.Object)"))
        if (taintedPath.getPlainValue().equals(stmt.getInvokeExpr().getArg(0)))
            return Collections.singleton(new AccessPath(((InstanceInvokeExpr) stmt.getInvokeExprBox().getValue()).getBase()));

    // method get + whole list is tainted -> returned element is tainted
    if(stmt.getInvokeExpr().getMethod().getSubSignature().equals("java.lang.Object get(int)"))
        if (stmt.getInvokeExpr() instanceof InstanceInvokeExpr) {
            InstanceInvokeExpr iiExpr = (InstanceInvokeExpr) stmt.getInvokeExpr();
            if (taintedPath.getPlainValue().equals(iiExpr.getBase()))
                if(stmt instanceof JAssignStmt)
                    return Collections.singleton(new AccessPath(((JAssignStmt)stmt).getLeftOp()));
        }

    // For the moment, we don't implement static taints on wrappers. Pass it on
    // not to break anything
    if(taintedPath.isStaticFieldRef())
        return Collections.singleton(taintedPath);

    return Collections.emptySet();
}
项目:jgs    文件:JimpleInjector.java   
/**
 * See method with same name in HandleStatement.
 *
 * @param pos   Statement / Unit where to insert setReturnLevelAfterInvokeStmt
 */
public static void setReturnLevelAfterInvokeStmt(Unit pos) {
    ArrayList<Type> paramTypes = new ArrayList<>();
    paramTypes.add(RefType.v("java.lang.String"));

    Expr setReturnLevel = Jimple.v().newVirtualInvokeExpr(
            hs, Scene.v().makeMethodRef(Scene.v().getSootClass(HANDLE_CLASS),
                    "setReturnLevelAfterInvokeStmt", paramTypes,
                    VoidType.v(),
                    false), local_for_Strings);
    Unit invoke = Jimple.v().newInvokeStmt(setReturnLevel);

    // only add setReturnLevelAfterInvokeStmt if the left side is dynamic
    if ( varTyping.getAfter(instantiation, (Stmt) pos, (Local) ((JAssignStmt) pos).leftBox.getValue() ).isDynamic() ) {
        unitStore_After.add(new UnitToInsert(invoke, pos));
    }
}
项目:JAADAS    文件:BinopInstruction.java   
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction23x))
         throw new IllegalArgumentException("Expected Instruction23x but got: "+instruction.getClass());

     Instruction23x binOpInstr = (Instruction23x)instruction;
     int dest = binOpInstr.getRegisterA();

     Local source1 = body.getRegisterLocal(binOpInstr.getRegisterB());
     Local source2 = body.getRegisterLocal(binOpInstr.getRegisterC());

     expr = getExpression(source1, source2);

     assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);
     assign.addTag(getTag());

     setUnit(assign);
     addTags(assign);
     body.add(assign);

     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
       int op = (int)instruction.getOpcode().value;
       BinopExpr bexpr = (BinopExpr)expr;
       JAssignStmt jassign = (JAssignStmt)assign;
       DalvikTyper.v().setType(bexpr.getOp1Box(), op1BinType[op-0x90], true);
       DalvikTyper.v().setType(bexpr.getOp2Box(), op2BinType[op-0x90], true);
       DalvikTyper.v().setType(jassign.leftBox, resBinType[op-0x90], false);
     }
 }
项目:JAADAS    文件:BinopLitInstruction.java   
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction22s) && !(instruction instanceof Instruction22b))
         throw new IllegalArgumentException("Expected Instruction22s or Instruction22b but got: "+instruction.getClass());

     NarrowLiteralInstruction binOpLitInstr = (NarrowLiteralInstruction) this.instruction;
     int dest = ((TwoRegisterInstruction) instruction).getRegisterA();
     int source = ((TwoRegisterInstruction) instruction).getRegisterB();

     Local source1 = body.getRegisterLocal(source);

     IntConstant constant = IntConstant.v((int)binOpLitInstr.getNarrowLiteral());

     expr = getExpression(source1, constant);

     assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);
     assign.addTag(getTag());

     setUnit(assign);
     addTags(assign);
     body.add(assign);

     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
         int op = (int)instruction.getOpcode().value;
       if (op >= 0xd8) {
         op -= 0xd8;
       } else {
         op -= 0xd0;
       }
       BinopExpr bexpr = (BinopExpr)expr;
       //body.dvkTyper.setType((op == 1) ? bexpr.getOp2Box() : bexpr.getOp1Box(), op1BinType[op]);
       DalvikTyper.v().setType(((JAssignStmt)assign).leftBox, op1BinType[op], false);
     }
 }
项目:petablox    文件:RelInitTrackedH.java   
private boolean isTrackedType(Unit q){
    if(!isOnlyTrackedTypes)
        return true;

    if(q instanceof JAssignStmt){
        JAssignStmt q1 = (JAssignStmt)q;
        if ((SootUtilities.isNewStmt(q1) || SootUtilities.isNewArrayStmt(q1) || SootUtilities.isNewMultiArrayStmt(q1))){
            if(trackedTypes.contains(q1.rightBox.getValue().getType()))
                return true;
        }
    }

    return false;
}
项目:petablox    文件:DomH.java   
@Override
public void fill() {
    int numM = domM.size();
    add(null);    
    for (int mIdx = 0; mIdx < numM; mIdx++) {
        SootMethod m = domM.get(mIdx);
        if (m == null || !m.isConcrete())
            continue;
        ICFG cfg = SootUtilities.getCFG(m);
        for (Block bb : cfg.reversePostOrder()) {
            Iterator<Unit> uit = bb.iterator();
            while(uit.hasNext()){
                Unit u = uit.next();
                if(u instanceof JAssignStmt){
                    JAssignStmt as = (JAssignStmt) u;
                    if (SootUtilities.isNewStmt(as) || SootUtilities.isNewArrayStmt(as) || SootUtilities.isNewMultiArrayStmt(as)) 
                        add(u);
                }   
            }    
        }
    }

    lastA = size() - 1;
    Reflect reflect = Program.g().getReflect();
    processResolvedNewInstSites(reflect.getResolvedObjNewInstSites());
    processResolvedNewInstSites(reflect.getResolvedConNewInstSites());
    processResolvedNewInstSites(reflect.getResolvedAryNewInstSites());
    lastI = size() - 1;
    if (PHANTOM_CLASSES) {
        for (RefLikeType r : Program.g().getClasses()) {
            add(new PhantomClsVal(r));
        }
    }
}
项目:petablox    文件:DomP.java   
@Override
public String toFIString(Unit u) {       
    StringBuilder sb = new StringBuilder();
    boolean printId = Utils.buildBoolProperty("petablox.printrel.printID", false);
    if (printId) sb.append("(" + indexOf(u) + ")");
    String type;
    if(u instanceof JAssignStmt)
        type = "Assign";
    else if(u instanceof JBreakpointStmt)
        type = "Breakpoint";
    else if(u instanceof JGotoStmt)
        type = "Goto";
    else if(u instanceof JIfStmt) 
        type = "If";
    else if(u instanceof JIdentityStmt) 
        type = "Identity";
    else if(u instanceof JInvokeStmt) 
        type = "Invoke";
    else if(u instanceof JLookupSwitchStmt) 
        type = "LookupSwitch";
    else if(u instanceof JNopStmt)
        type = "Nop";
    else if(u instanceof JRetStmt) 
        type = "Return";
    else if(u instanceof JTableSwitchStmt) 
        type = "TablelSwitch";
    else if(u instanceof JThrowStmt) 
        type = "Throw";
    else
        type = "Other";
    sb.append(type);
    sb.append(": " + SootUtilities.getMethod(u).getName() + "@" + SootUtilities.getMethod(u).getDeclaringClass().getName());
    return sb.toString();
}
项目:petablox    文件:RelAryElemE.java   
public void fill() {
    DomE domE = (DomE) doms[0];
    int numE = domE.size();
    for (int eIdx = 0; eIdx < numE; eIdx++) {
        Unit e = (Unit) domE.get(eIdx);
        //Operator op = e.getOperator();
        if(e instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)e;
            if(SootUtilities.isLoadInst(j) || SootUtilities.isStoreInst(j)){
                add(eIdx);
            }
        }
    }
}
项目:petablox    文件:RelStatFldE.java   
public void fill() {
    DomE domE = (DomE) doms[0];
    int numE = domE.size();
    for (int eIdx = 0; eIdx < numE; eIdx++) {
        Unit e = (Unit) domE.get(eIdx);
        //Operator op = e.getOperator();
        if(e instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)e;
            if (SootUtilities.isStaticGet(j) || SootUtilities.isStaticPut(j)) {
                add(eIdx);
            }
        }

    }
}
项目:petablox    文件:RelInstFldE.java   
public void fill() {
    DomE domE = (DomE) doms[0];
    int numE = domE.size();
    for (int eIdx = 0; eIdx < numE; eIdx++) {
        Unit e = (Unit) domE.get(eIdx);
        //Operator op = e.getOperator();
        if(e instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)e;
            if (!SootUtilities.isStaticGet(j) && !SootUtilities.isStaticPut(j) && !SootUtilities.isLoadInst(j) && !SootUtilities.isStoreInst(j))
                add(eIdx);
        }

    }
}
项目:petablox    文件:RelWriteE.java   
public void fill() {
    DomE domE = (DomE) doms[0];
    int numE = domE.size();
    for (int eIdx = 0; eIdx < numE; eIdx++) {
        Unit e = (Unit) domE.get(eIdx);
        //Operator op = e.getOperator();
        if(e instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)e;
            if (SootUtilities.isFieldStore(j) || SootUtilities.isStaticPut(j) || SootUtilities.isStoreInst(j))
                add(eIdx);
        }

    }
}
项目:petablox    文件:DomE.java   
@Override
public String toFIString(Unit u) {         
    JAssignStmt as = (JAssignStmt)u;
    StringBuilder sb = new StringBuilder();
    boolean printId = Utils.buildBoolProperty("petablox.printrel.printID", false);
    if (printId) sb.append("(" + indexOf(u) + ")");
    String rdWr = (SootUtilities.isFieldStore(as) || SootUtilities.isStaticPut(as) || SootUtilities.isStoreInst(as))? "Wr" : "Rd";
    sb.append(rdWr+": " + SootUtilities.getMethod(u).getName() + "@" + SootUtilities.getMethod(u).getDeclaringClass().getName());
    return sb.toString();
}
项目:petablox    文件:DomE.java   
@Override
public String toXMLAttrsString(Unit u) {
    SootMethod m = SootUtilities.getMethod(u);
    JAssignStmt as = (JAssignStmt) u;
    String file = ((SourceFileTag)m.getDeclaringClass().getTag("SourceFileTag")).getSourceFile();
    int line = u.getJavaSourceStartLineNumber();
    int mIdx = domM.indexOf(m);
    return "file=\"" + file + "\" " + "line=\"" + line + "\" " +
        "Mid=\"M" + mIdx + "\"" +
        " rdwr=\"" + ((SootUtilities.isFieldStore(as) || SootUtilities.isStaticPut(as) || SootUtilities.isStoreInst(as))? "Wr" : "Rd") + "\"";
}
项目:petablox    文件:RelPobjNullAsgnInst.java   
public void visitMoveInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isMoveInst(j)){
            Local l = (Local)j.leftBox.getValue();
            Local r = (Local)j.rightBox.getValue();
            if(r instanceof NullConstant && l.getType() instanceof RefLikeType){
                add(q, l);
            }
        }
    }
}
项目:petablox    文件:RelPobjNullAsgnInst.java   
public void visitCastInst(Unit q) {
if(q instanceof JAssignStmt){
    JAssignStmt j = (JAssignStmt)q;
    if(j.rightBox.getValue() instanceof JCastExpr){
        JCastExpr jce = (JCastExpr)j.rightBox.getValue();
        Local l = (Local)j.leftBox.getValue();
        Value r = jce.getOp();
        if(r instanceof NullConstant && l.getType() instanceof RefLikeType){
            add(q, l);
        }
    }
}
  }
项目:petablox    文件:RelPobjVarMoveInst.java   
public void visitMoveInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isMoveInst(j)){
            Local l = (Local)j.leftBox.getValue();
            Local r = (Local)j.rightBox.getValue();
            if(r.getType() instanceof RefLikeType){
                add(q, l, r);
            }
        }
    }
}
项目:petablox    文件:RelMobjValAsgnInst.java   
public void fill() {
    DomM domM = (DomM) doms[0];
    DomV domV = (DomV) doms[1];
    DomH domH = (DomH) doms[2];
    int numA = domH.getLastA() + 1;
    for (int hIdx = 1; hIdx < numA; hIdx++) {
        Unit q = (Unit) domH.get(hIdx);
        SootMethod m = SootUtilities.getMethod(q);
        int mIdx = domM.indexOf(m);
        assert (mIdx >= 0);
        Local vo=null;
        if(q instanceof JAssignStmt){
            JAssignStmt j = (JAssignStmt)q;
            Value left = j.leftBox.getValue();
            if(SootUtilities.isNewStmt(j))
                vo = (Local)left;
            else if(SootUtilities.isNewArrayStmt(j))
                vo = (Local)left;
            else if(SootUtilities.isNewMultiArrayStmt(j))
                vo = (Local)left;
            else if(j.containsInvokeExpr())
                vo = (Local)left;
            else{
                Messages.fatal("Unknown quad in domain H: " + q);
                vo = null;
            }
        }
        int vIdx = domV.indexOf(vo);
        if (vIdx >= 0)
            add(mIdx, vIdx, hIdx);
    }
}
项目:petablox    文件:RelMobjVarAsgnInst.java   
public void visitMoveInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(SootUtilities.isMoveInst(j)){
            if(j.rightBox.getValue().getType() instanceof RefLikeType){
                Local r = (Local)j.rightBox.getValue();
                Local l = (Local)j.leftBox.getValue();
                add(ctnrMethod, l, r);
            }
        }
    }
}
项目:petablox    文件:RelMobjVarAsgnInst.java   
public void visitCastInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        Value left = j.leftBox.getValue();
        Value right = j.rightBox.getValue();
        if(right instanceof JCastExpr){
            Local l = (Local)left;
            Value rv = ((JCastExpr)right).getOp();
            if(rv.getType() instanceof RefLikeType && rv instanceof Local){
                Local r = (Local)rv;
                add(ctnrMethod, l, r);
            }
        }
    }
}
项目:petablox    文件:RelPobjVarCastInst.java   
public void visitCastInst(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt j = (JAssignStmt)q;
        if(j.rightBox.getValue() instanceof JCastExpr){
            JCastExpr jce = (JCastExpr)j.rightBox.getValue();
            if(jce.getOp() instanceof Local){
            Local r = (Local)jce.getOp();
            if(r.getType() instanceof RefLikeType){
                Local l = (Local)j.leftBox.getValue();
                add(q, l, r);
            }
            }
        }
    }
}