当前位置: 首页>>代码示例>>Java>>正文


Java IdentityStmt.getLeftOp方法代码示例

本文整理汇总了Java中soot.jimple.IdentityStmt.getLeftOp方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityStmt.getLeftOp方法的具体用法?Java IdentityStmt.getLeftOp怎么用?Java IdentityStmt.getLeftOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soot.jimple.IdentityStmt的用法示例。


在下文中一共展示了IdentityStmt.getLeftOp方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
	Value l = stmt.getLeftOp();
	Value r = stmt.getRightOp();

	if (l instanceof Local) {
		if (((Local) l).getType() instanceof IntegerType) {
			TypeNode left = ClassHierarchy.v().typeNode(
					(((Local) l).getType()));
			TypeNode right = ClassHierarchy.v().typeNode(r.getType());

			if (!right.hasAncestor_1(left)) {
				if (fix) {
					((soot.jimple.internal.JIdentityStmt) stmt)
							.setLeftOp(insertCastAfter((Local) l,
									getTypeForCast(left),
									getTypeForCast(right), stmt));
				} else {
					error("Type Error(16)");
				}
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:24,代码来源:ConstraintChecker.java

示例2: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
	Value l = stmt.getLeftOp();
	Value r = stmt.getRightOp();

	if (l instanceof Local) {
		TypeVariable left = resolver.typeVariable((Local) l);

		if (!(r instanceof CaughtExceptionRef)) {
			TypeVariable right = resolver.typeVariable(r.getType());
			right.addParent(left);
		} else {
			List<RefType> exceptionTypes = TrapManager.getExceptionTypesOf(stmt, stmtBody);
			Iterator<RefType> typeIt = exceptionTypes.iterator();

			while (typeIt.hasNext()) {
				Type t = typeIt.next();

				resolver.typeVariable(t).addParent(left);
			}

			if (uses) {
				left.addParent(resolver.typeVariable(RefType.v("java.lang.Throwable")));
			}
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:ConstraintCollector.java

示例3: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseIdentityStmt(IdentityStmt stmt) {
	Value lhs = stmt.getLeftOp();
	Value rhs = stmt.getRightOp();
	if (rhs instanceof CaughtExceptionRef) {
		// save the caught exception with move-exception
		Register localReg = regAlloc.asLocal(lhs);
		
           addInsn(new Insn11x(Opcode.MOVE_EXCEPTION, localReg), stmt);

           this.insnRegisterMap.put(insns.get(insns.size() - 1), LocalRegisterAssignmentInformation.v(localReg, (Local)lhs));
	} else if (rhs instanceof ThisRef || rhs instanceof ParameterRef) {
		/* 
		 * do not save the ThisRef or ParameterRef in a local, because it always has a parameter register already.
		 * at least use the local for further reference in the statements
		 */
		Local localForThis = (Local) lhs;
		regAlloc.asParameter(belongingMethod, localForThis);
		
		parameterInstructionsList.add(LocalRegisterAssignmentInformation.v(regAlloc.asLocal(localForThis).clone(), localForThis));
	} else {
		throw new Error("unknown Value as right-hand side of IdentityStmt: " + rhs);
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:25,代码来源:StmtVisitor.java

示例4: getParameterLocal

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/** Return LHS of the first identity stmt assigning from \@parameter i. **/
public Local getParameterLocal(int i)
{
    for (Unit s : getUnits())
    {
        if (s instanceof IdentityStmt &&
            ((IdentityStmt)s).getRightOp() instanceof ParameterRef)
        {
            IdentityStmt is = (IdentityStmt)s;
            ParameterRef pr = (ParameterRef)is.getRightOp();
            if (pr.getIndex() == i)
                return (Local)is.getLeftOp();
        }
    }

    throw new RuntimeException("couldn't find parameterref" + i +"! in "+getMethod());
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:Body.java

示例5: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public final void caseIdentityStmt(IdentityStmt s) {
statement = s;
Value lhs = s.getLeftOp();
Value rhs = s.getRightOp();
if( !( lhs.getType() instanceof RefType ) 
&& !(lhs.getType() instanceof ArrayType ) ) {
     caseUninterestingStmt( s );
     return;
}
Local llhs = (Local) lhs;
if( rhs instanceof CaughtExceptionRef ) {
    caseCatchStmt( llhs, (CaughtExceptionRef) rhs );
} else {
    IdentityRef rrhs = (IdentityRef) rhs;
    caseIdentityStmt( llhs, rrhs );
}
  }
 
开发者ID:petablox-project,项目名称:petablox,代码行数:18,代码来源:FGStmtSwitch.java

示例6: findparamlocal

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findparamlocal(PatchingChain<Unit> units) {
    // TODO HACK! assume the second identity stmt is always for the required
    // parameter
    boolean thislocalseen = false;
    for (Unit unit : units)
    {
        if (unit instanceof IdentityStmt)
        {
            if (thislocalseen)
            {
                IdentityStmt istmt = (IdentityStmt) unit;
                return (Local) istmt.getLeftOp();
            }
            else
            {
                thislocalseen = true;
            }
        }
    }
    throw new RuntimeException("Parameter Local not found (maybe method has no parameters?)");
}
 
开发者ID:ravibhoraskar,项目名称:bladedroid,代码行数:22,代码来源:Util.java

示例7: findsecondparamlocal

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findsecondparamlocal(PatchingChain<Unit> units)
{
    // TODO HACK! assume the second identity stmts are in the order
    // "this","param1","param2"...
    int localsseen = 0;
    for (Unit unit : units)
    {
        if (unit instanceof IdentityStmt)
        {
            if (localsseen == 2)
            {
                IdentityStmt istmt = (IdentityStmt) unit;
                return (Local) istmt.getLeftOp();
            }

            localsseen++;
        }
    }
    throw new RuntimeException("Parameter Local not found (maybe method has no parameters?)");
}
 
开发者ID:ravibhoraskar,项目名称:bladedroid,代码行数:21,代码来源:Util.java

示例8: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
	Value l = stmt.getLeftOp();
	Value r = stmt.getRightOp();

	if (l instanceof Local) {
		if (((Local) l).getType() instanceof IntegerType) {
			TypeVariable left = resolver.typeVariable((Local) l);

			TypeVariable right = resolver.typeVariable(r.getType());
			right.addParent(left);
		}
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:14,代码来源:ConstraintCollector.java

示例9: findthislocal

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findthislocal(Chain<Unit> units)
{
    // TODO: HACK! assume the first identity stmt is always for 'this'
    for (Unit unit : units)
    {
        if (unit instanceof IdentityStmt)
        {
            IdentityStmt istmt = (IdentityStmt) unit;
            return (Local) istmt.getLeftOp();
        }
    }
    return null;
}
 
开发者ID:ravibhoraskar,项目名称:bladedroid,代码行数:14,代码来源:Util.java

示例10: caseInvokeStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseInvokeStmt(InvokeStmt stmt) {
	InvokeExpr invokeExpr = stmt.getInvokeExpr();
	SootClass declaringClass = invokeExpr.getMethod().getDeclaringClass();
	if(exprVisitor.isExpressionThatNeedsToBeConvertedToSMT(invokeExpr))
		exprVisitor.convertSpecialExpressionsToSMT(invokeExpr, stmt);
	else if(UtilInstrumenter.isAppDeveloperCode(declaringClass)) {
		SootMethod method = invokeExpr.getMethod();
		Body body = method.retrieveActiveBody();
		
		SMTBinding newRhs = getBindingForTaintedValue(stmt);
		//if there is no taint-tracking involved (newRhs == null), we do not have to do anything here
		if(newRhs == null)
			return;
		
		int indexOfInterest = -1;
		for(int i = 0; i < invokeExpr.getArgCount(); i++) {
			if(newRhs.getVariableName().equals(invokeExpr.getArg(i).toString())) {
				indexOfInterest = i;
				break;
			}
		}
		
		if(indexOfInterest == -1)
			return;
		
		
		for(Unit unit : body.getUnits()) {
			if(unit instanceof IdentityStmt) {
				IdentityStmt identity = (IdentityStmt)unit;
				Value rhs = identity.getRightOp();
				if(rhs instanceof ParameterRef) {
					ParameterRef param = (ParameterRef)rhs;
					if(param.getIndex() == indexOfInterest) {
						Value lhs = identity.getLeftOp();
						SMTBinding newLhs = createNewBindingForValue(lhs);
						addValueBindingToVariableDeclaration(lhs, newLhs);
						SMTSimpleAssignment simpleAssignment = new SMTSimpleAssignment(newLhs, new SMTBindingValue(newRhs));
						SMTAssertStatement assignmentAssert = new SMTAssertStatement(simpleAssignment);
						addAssertStmtToAllPrograms(assignmentAssert);
					}
				}					
			}
		}
	}		
	else {
		System.err.println(String.format("Double-Check if the following method contains useful information which can be extracted: \n%s", stmt));
	}
	
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:51,代码来源:JimpleStmtVisitorImpl.java

示例11: updateNewBody

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
private void updateNewBody(Body b) {

        SootClass servicesInitClass = Scene.v().getSootClass(
                servicesInitClassName);

        // since method is static, just remove first statement if necessary
        // // change reference to @this type
        // Unit first = b.getUnits().getFirst();
        // if (!(first instanceof IdentityStmt))
        // throw new
        // RuntimeException("error: first statement not instance of IdentityStmt: "+
        // first);
        // IdentityStmt idstmt = (IdentityStmt)first;
        // Local left = (Local) idstmt.getLeftOp();
        // Value right = idstmt.getRightOp();
        // RefType t = servicesInitClass.getType();
        // ThisRef newThisRef = Jimple.v().newThisRef(t);
        // left.setType(t);
        // Unit newIdentityStmt = Jimple.v().newIdentityStmt(left, newThisRef);
        // b.getUnits().swapWith(first, newIdentityStmt);
        b.getUnits().removeFirst();
        //

        // if context parameter is present redirect it
        Unit second = b.getUnits().getFirst(); // .getSuccOf(newIdentityStmt);
        if (second instanceof IdentityStmt) {
            IdentityStmt pStmt = (IdentityStmt) second;
            Local l = (Local) pStmt.getLeftOp();
            Value r = pStmt.getRightOp();
            SootField sf = servicesInitClass
                    .getFieldByName("androidcontentContext");
            Value newR = Jimple.v().newStaticFieldRef(sf.makeRef());
            AssignStmt newStmt = Jimple.v().newAssignStmt(l, newR);
            b.getUnits().swapWith(pStmt, newStmt);
        }

        // redirect getService methods
        RedirectService rs = new RedirectService();
        List<Unit> getSystemService = rs.hasCallToGetSystem(b);
        if (getSystemService.size() != 0) {
            System.out.println("redirecting getService for body");
            List<String> servicesCalled = ServiceMapper.v().getServiceNames(b,
                    getSystemService);
            rs.redirectGetSystemServiceCalls(b, getSystemService,
                    servicesCalled, servicesInitClass);
        }

        redirectContextFieldAssignments(b);
        
        checkUsageofR0(b);

    }
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:53,代码来源:GenerateServiceInit.java

示例12: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/**
 * Method, which should process the given statement of type
 * {@link IdentityStmt}. Therefore the method looks up the
 * <em>security level</em> of the right hand side (the level depends on the
 * annotation if it is a parameter reference, but if it is a this reference,
 * then the level is the weakest available <em>security level</em>). For the
 * assignment of parameter to a local variable also the name and type of
 * them are checked.
 * 
 * @param stmt
 *            Statement that should be processed to check for security
 *            violations.
 * @see soot.jimple.StmtSwitch#caseIdentityStmt(soot.jimple.IdentityStmt)
 */
@Override
public void caseIdentityStmt(IdentityStmt stmt) {
    Value left = stmt.getLeftOp();
    Value right = stmt.getRightOp();
    updateIdentityLevel(right, left, stmt.toString());
}
 
开发者ID:proglang,项目名称:jgs,代码行数:21,代码来源:SecurityLevelStmtSwitch.java


注:本文中的soot.jimple.IdentityStmt.getLeftOp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。