Java 类soot.jimple.LengthExpr 实例源码

项目:JAADAS    文件:ArrayLengthInstruction.java   
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction12x))
         throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

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

     Local arrayReference = body.getRegisterLocal(lengthOfArrayInstruction.getRegisterB());

     LengthExpr lengthExpr = Jimple.v().newLengthExpr(arrayReference);

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

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

     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
       DalvikTyper.v().setType(assign.getLeftOpBox(), IntType.v(), false);      
     }
 }
项目:JAADAS    文件:ValueTemplatePrinter.java   
public void caseLengthExpr(LengthExpr v) {
    String oldName = varName;

    Value op = v.getOp();
    suggestVariableName("op");
    String opName = varName;
    op.apply(this);

    p.println("Value "+oldName+" = Jimple.v().newLengthExpr("+opName+");");
    varName = oldName;
}
项目:JAADAS    文件:ExprVisitor.java   
@Override
public void caseLengthExpr(LengthExpr le) {
    Value array = le.getOp();
    constantV.setOrigStmt(origStmt);
    // In buggy code, the parameter could be a NullConstant.
    // This is why we use .asImmediate() and not .asLocal()
    Register arrayReg = regAlloc.asImmediate(array, constantV);
       stmtV.addInsn(new Insn12x(Opcode.ARRAY_LENGTH, destinationReg, arrayReg), origStmt);
}
项目:JAADAS    文件:DavaBody.java   
private void javafy_unop_expr(ValueBox vb) {
    UnopExpr uoe = (UnopExpr) vb.getValue();

    javafy(uoe.getOpBox());

    if (uoe instanceof LengthExpr)
        vb.setValue(new DLengthExpr(((LengthExpr) uoe).getOp()));
    else if (uoe instanceof NegExpr)
        vb.setValue(new DNegExpr(((NegExpr) uoe).getOp()));
}
项目:bixie    文件:SootValueSwitch.java   
@Override
public void caseLengthExpr(LengthExpr arg0) {
    this.isLeftHandSide = false;
    arg0.getOp().apply(this);
    Expression base = this.getExpression();
    this.stmtSwitch.getErrorModel().createNonNullGuard(base);
    this.expressionStack
            .push(GlobalsCache.v().getArraySizeExpression(base));
}
项目:petablox    文件:RelLengthExpr.java   
@Override
public void visit(Value e) {
    if (e instanceof LengthExpr) {
        LengthExpr le = (LengthExpr) e;
        add(e, le.getOp());
    }
}
项目:jar2bpl    文件:SootValueSwitch.java   
@Override
public void caseLengthExpr(LengthExpr arg0) {
    this.isLeftHandSide = false;
    arg0.getOp().apply(this);
    Expression base = this.getExpression();
    this.stmtSwitch.getErrorModel().createNonNullGuard(base);
    this.expressionStack
            .push(GlobalsCache.v().getArraySizeExpression(base));
}
项目:jgs    文件:AnnotationValueSwitch.java   
/**
     * It is supposed that it is not neccessay to treat the length expression since
     * it always comes with the corresponding array and the level of the array (which is
     * the same as its length level) will always be already treated.
     * @param v length expression
     */
    @Override
    public void caseLengthExpr(LengthExpr v) {
        rightElement = RightElement.NOT;
        logger.finest("LengthExpr identified: " + v.toString());
//      if (actualContext == StmtContext.ASSIGNRIGHT) {
//          // JimpleInjector.addLevelInAssignStmt(v, callingStmt);
//          System.out.println(v.getType());
//          System.out.println(v.getUseBoxes().get(0).toString());
//
//          new InternalAnalyzerException();
//      } else {
//          new InternalAnalyzerException();            
//      }
    }
项目:FuzzDroid    文件:JimpleExprVisitorImpl.java   
@Override
public void caseLengthExpr(LengthExpr v) {
    throw new RuntimeException("todo");

}
项目:JAADAS    文件:UnitThrowAnalysis.java   
public void caseLengthExpr(LengthExpr expr) {
    result = result.add(mgr.NULL_POINTER_EXCEPTION);
    result = result.add(mightThrow(expr.getOp()));
}
项目:jgs    文件:SecurityConstraintValueWriteSwitch.java   
@Override
public void caseLengthExpr(LengthExpr v) {
    throwInvalidWriteException(v);
}
项目:jgs    文件:SecurityConstraintValueReadSwitch.java   
@Override
public void caseLengthExpr(LengthExpr v) {
    handleUnaryExpr(v.getOp());
}
项目:jgs    文件:SecurityLevelValueWriteSwitch.java   
/**
 * The method should update the <em>security level</em> of an expression
 * with type {@link LengthExpr}, but it is not possible to update the level
 * of such an expression.
 * 
 * @param v
 *            The expression for which the <em>security level</em> should be
 *            updated.
 * @see soot.jimple.ExprSwitch#caseLengthExpr(soot.jimple.LengthExpr)
 * @throws InvalidSwitchException
 *             Always, because the update is not possible.
 */
@Override
public void caseLengthExpr(LengthExpr v) {
    throw new SwitchException(getMsg("exception.analysis.switch.update_error",
                                     this.getClass().getSimpleName(),
                                     v.getClass().getSimpleName(),
                                     v.toString(),
                                     getSourceLine()));
}
项目:jgs    文件:AnnotationValueSwitch.java   
/**
 * DOC
 * 
 * @see soot.jimple.ExprSwitch#caseLengthExpr(soot.jimple.LengthExpr)
 */
@Override
public void caseLengthExpr(LengthExpr v) {
    v.getOp().apply(this);
}
项目:jgs    文件:SecurityLevelValueReadSwitch.java   
/**
 * Looks up the <em>security level</em> for the given length expression and
 * stores the level in {@link SecurityLevelValueReadSwitch#level}. The
 * resulting level is the level of the array.
 * 
 * @param v
 *            The length expression for which the <em>security level</em>
 *            should be looked up.
 * @see soot.jimple.ExprSwitch#caseLengthExpr(soot.jimple.LengthExpr)
 * @see SecurityLevelValueReadSwitch#handleUnaryOperation(UnopExpr)
 */
@Override
public void caseLengthExpr(LengthExpr v) {
    handleUnaryOperation(v);
}