soot.jimple.InstanceOfExpr Java Examples

The following examples show how to use soot.jimple.InstanceOfExpr. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstanceOfInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      Instruction22c i = (Instruction22c)instruction;
      int dest = i.getRegisterA();
      int source = i.getRegisterB();

      Type t = DexType.toSoot((TypeReference)(i.getReference()));

      InstanceOfExpr e = Jimple.v().newInstanceOfExpr(body.getRegisterLocal(source), t);
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), e);
      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().?
      }
  }
 
Example #2
Source File: DavaBody.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
private void javafy_expr(ValueBox vb) {
	Expr e = (Expr) vb.getValue();

	if (e instanceof BinopExpr)
		javafy_binop_expr(vb);
	else if (e instanceof UnopExpr)
		javafy_unop_expr(vb);
	else if (e instanceof CastExpr)
		javafy_cast_expr(vb);
	else if (e instanceof NewArrayExpr)
		javafy_newarray_expr(vb);
	else if (e instanceof NewMultiArrayExpr)
		javafy_newmultiarray_expr(vb);
	else if (e instanceof InstanceOfExpr)
		javafy_instanceof_expr(vb);
	else if (e instanceof InvokeExpr)
		javafy_invoke_expr(vb);
	else if (e instanceof NewExpr)
		javafy_new_expr(vb);
}
 
Example #3
Source File: ValueTemplatePrinter.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void caseInstanceOfExpr(InstanceOfExpr v) {
	String oldName = varName;
	
	suggestVariableName("type");
	String lhsName = varName;
	ttp.setVariableName(varName);
	v.getType().apply(ttp);
	
	String rhsName = printValueAssignment(v.getOp(), "op");
	
	p.println("Value "+oldName+" = Jimple.v().newInstanceOfExpr("+lhsName+","+rhsName+");");
	
	varName = oldName;	
}
 
Example #4
Source File: ExprVisitor.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void caseInstanceOfExpr(InstanceOfExpr ioe) {
	final Value referenceToCheck = ioe.getOp();
	
	// There are some strange apps that use constants here
	constantV.setOrigStmt(origStmt);
	Register referenceToCheckReg = regAlloc.asImmediate(referenceToCheck, constantV);
	
	BuilderReference checkType = DexPrinter.toTypeReference(ioe.getCheckType(),
			stmtV.getBelongingFile());
       stmtV.addInsn(new Insn22c(Opcode.INSTANCE_OF, destinationReg, referenceToCheckReg,
               checkType), origStmt);
}
 
Example #5
Source File: ForwardBoomerangSolver.java    From SPDS with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isInstanceOfStatement(Stmt curr, Val fact) {
    if (curr instanceof AssignStmt) {
        AssignStmt as = (AssignStmt) curr;
        if (as.getRightOp() instanceof InstanceOfExpr && query.getType() instanceof NullType) {
            InstanceOfExpr instanceOfExpr = (InstanceOfExpr) as.getRightOp();
            if (instanceOfExpr.getOp().equals(fact.value())) {
                return true;
            }
        }
    }
    return false;
}
 
Example #6
Source File: JimpleExprVisitorImpl.java    From FuzzDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void caseInstanceOfExpr(InstanceOfExpr v) {
	throw new RuntimeException("todo");
	
}
 
Example #7
Source File: DavaBody.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
private void javafy_instanceof_expr(ValueBox vb) {
	InstanceOfExpr ioe = (InstanceOfExpr) vb.getValue();
	javafy(ioe.getOpBox());
}
 
Example #8
Source File: UnitThrowAnalysis.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public void caseInstanceOfExpr(InstanceOfExpr expr) {
    result = result.add(mgr.RESOLVE_CLASS_ERRORS);
    result = result.add(mightThrow(expr.getOp()));
}