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


Java IdentityStmt.getRightOp方法代码示例

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


在下文中一共展示了IdentityStmt.getRightOp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getParameterLocals

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/**
 * Get all the LHS of the identity statements assigning from parameter references.
 *
 * @return a list of size as per <code>getMethod().getParameterCount()</code> with all elements ordered as per the parameter index.
 * @throws RuntimeException if a parameterref is missing
 */
public List<Local> getParameterLocals(){
    final int numParams = getMethod().getParameterCount();
    final List<Local> retVal = new ArrayList<Local>(numParams);

    //Parameters are zero-indexed, so the keeping of the index is safe
    for (Unit u : getUnits()){
        if (u instanceof IdentityStmt){
            IdentityStmt is = ((IdentityStmt)u);
            if (is.getRightOp() instanceof ParameterRef){
                ParameterRef pr = (ParameterRef) is.getRightOp();
                retVal.add(pr.getIndex(), (Local) is.getLeftOp());
            }
        }
    }
    if (retVal.size() != numParams){
    	//FLANKER FIX BEGIN
        //throw new RuntimeException("couldn't find parameterref! in " + getMethod());
    	return retVal;
    	//FLANKER FIX END
    }
    return retVal;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:29,代码来源:Body.java

示例6: 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

示例7: propagateNormalFlow

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public KillGenInfo propagateNormalFlow(Trackable taint, Unit curr, Unit succ) {
	if (!(curr instanceof IdentityStmt))
		return identity();
	IdentityStmt idStmt = (IdentityStmt) curr;
	Value left = AnalysisUtil.getBackwardsBase(idStmt.getLeftOp());

	Taint t = (Taint) taint;

	if (!AnalysisUtil.maybeSameLocation(t.value, left))
		return identity();

	if (idStmt.getRightOp() instanceof ParameterRef) {
		if (t.value instanceof Local) {
			SootMethod m = context.icfg.getMethodOf(idStmt);
			if (AnalysisUtil.methodMayBeCallableFromApplication(m) && transitiveSinkCaller.isTransitiveCallerOfAnySink(m)) {
				context.reporter.reportTrackable(new Report(context, taint, curr));
			}
		}
	}
	return identity();
}
 
开发者ID:johanneslerch,项目名称:FlowTwist,代码行数:23,代码来源:ArgumentSourceHandler.java

示例8: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseIdentityStmt(IdentityStmt stmt) {

	AnnotationValueSwitch valueSwitch = new AnnotationValueSwitch(stmt, StmtContext.IDENTITY);

	logger.fine("\n > > > Identity statement identified < < <");

	// for all statements i = parameter[0]
	if (stmt.getRightOp() instanceof ParameterRef) {
		if (!body.getMethod().isMain()) {
			int posInArgList = ((ParameterRef) stmt.getRightOp())
					.getIndex();
			JimpleInjector.assignArgumentToLocal(posInArgList,
                       (Local) stmt.getLeftOp());
		}
	} else if (stmt.getRightOp() instanceof ThisRef) {
		// TODO im Grunde nicht nötig...
	} else if (stmt.getRightOp() instanceof CaughtExceptionRef) {
		logger.fine("Right operand in IdentityStmt is a CaughtException");
		throw new InternalAnalyzerException("Catching exceptions is not supported");
	} else {
		throw new InternalAnalyzerException(
				"Unexpected type of right value "
						+ stmt.getRightOp().toString() + " in IdentityStmt");
	}
}
 
开发者ID:proglang,项目名称:jgs,代码行数:27,代码来源:AnnotationStmtSwitch.java

示例9: getFirstNonIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/**
 * Gets the first statement in the body of the given method that does not
 * assign the "this" local or a parameter local
 * @param sm The method in whose body to look
 * @return The first non-identity statement in the body of the given method.
 */
private Unit getFirstNonIdentityStmt(SootMethod sm) {
	for (Unit u : sm.getActiveBody().getUnits()) {
		if (!(u instanceof IdentityStmt))
			return u;
		
		IdentityStmt id = (IdentityStmt) u;
		if (!(id.getRightOp() instanceof ThisRef)
				&& !(id.getRightOp() instanceof ParameterRef))
			return u;
	}
	return null;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:InterproceduralConstantValuePropagator.java

示例10: 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

示例11: isDexInstruction

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
private boolean isDexInstruction(Unit unit) {
	if (unit instanceof IdentityStmt) {
		IdentityStmt is = (IdentityStmt) unit;
		return !(is.getRightOp() instanceof ThisRef
				|| is.getRightOp() instanceof ParameterRef);
	}
	return true;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:9,代码来源:FastDexTrapTightener.java

示例12: isSource

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public boolean isSource(Stmt sCallSite, InterproceduralCFG<Unit, SootMethod> cfg) {
	if (super.isSource(sCallSite, cfg))
		return true;
	
	if (sCallSite instanceof IdentityStmt) {
		IdentityStmt is = (IdentityStmt) sCallSite;
		if (is.getRightOp() instanceof ParameterRef)
			if (this.parameterTaintMethods != null && this.parameterTaintMethods.contains
					(cfg.getMethodOf(sCallSite).getSignature()))
				return true;
	}
	
	return false;
}
 
开发者ID:0-14N,项目名称:soot-inflow,代码行数:16,代码来源:DefaultSourceSinkManager.java

示例13: caseIdentityStmt

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseIdentityStmt(IdentityStmt stmt) {

	valueSwitch.callingStmt = stmt;

	valueSwitch.actualContext = StmtContext.IDENTITY;

	logger.fine("\n > > > Identity statement identified < < <");

	if (stmt.getRightOp() instanceof ParameterRef) {
		if (!body.getMethod().isMain()) {
			int posInArgList = ((ParameterRef) stmt.getRightOp())
					.getIndex();
			JimpleInjector.assignArgumentToLocal(posInArgList,
					(Local) stmt.getLeftOp(), stmt);
		}
	} else if (stmt.getRightOp() instanceof ThisRef) {
		// TODO im Grunde nicht nötig...
	} else if (stmt.getRightOp() instanceof CaughtExceptionRef) {
		logger.fine("Right operand in IdentityStmt is a CaughtException");
	} else {
		throw new InternalAnalyzerException(
				"Unexpected type of right value "
						+ stmt.getRightOp().toString() + " in IdentityStmt");
	}

	valueSwitch.actualContext = StmtContext.UNDEF;
}
 
开发者ID:proglang,项目名称:jgs,代码行数:29,代码来源:AnnotationStmtSwitch.java

示例14: 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

示例15: getArrayFromMethod

import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/**
   * Get the definition of the Array starting from an ArrayRef.
   * Two possibilities:
   * 1) array = IdentityStmt in which case the previous method in the stack is analyzed
   * 2) array = newarray in which case all statements array[i] = r are analyzed
   * @param stack
   * @param curDepth
   * @param ar
   * @param mpSet
   */
  private static void getArrayFromMethod (Stack<SootMethod> stack, int curDepth, ArrayRef ar, Set<String> mpSet) {
    
    SootMethod targetM = stack.elementAt(curDepth);
    logger.info("getArrayFromMethod target: "+ targetM);
    
    Body b = targetM.getActiveBody();
    System.out.println("body: "+ b); // TODO: change to logger.debug
    UnitGraph eug = new ExceptionalUnitGraph( b ); 

    LocalDefinition ld = new LocalDefinition(b);
    Local l = (Local)ar.getBase();
  
    List<Unit> arrayDefs = ld.collectDefinitionsWithAliases(l);
    for (Unit arrayDef: arrayDefs) {
      if (arrayDef instanceof IdentityStmt) {
        logger.info("array: right is IdentityStmt");
        IdentityStmt ids = (IdentityStmt)arrayDef;
        ParameterRef pref = (ParameterRef)ids.getRightOp();
        int paramPos = pref.getIndex();
        logger.info("index of array parameter: "+ paramPos); // TODO: should be debug
//        List<MethodCall> methodCallsList = getStringParameterInCall(stack.elementAt(curDepth - 1), targetM, paramPos, mpSet);
//        getArrayFromMethod (stack, stack.size()-1, ar, mpSet);
        getStringFromMethod (stack, curDepth-1, targetM, paramPos, mpSet);
      } else if (arrayDef instanceof AssignStmt) {
        AssignStmt ass = (AssignStmt) arrayDef;
        Value right = ass.getRightOp();
        if (right instanceof NewArrayExpr) {
          logger.info("array: right is NewArray");
          // get the unit array[i] = str
          // TODO: Limitation: we suppose the array is initialized in the body where it is created
          // and that it is not aliased
          Local arrayLocal = (Local)ass.getLeftOp();
          List<Value> arrayInitValues = retrieveArrayInitStmts (b, arrayLocal);
          for (Value v: arrayInitValues) {
            if (v instanceof StringConstant) {
              StringConstant sc = (StringConstant)v;
              String p = sc.value;
              mpSet.add(p);
              logger.info("add perm from array inif: "+ p);
            } else {
              logger.warn("not handling this value for array init: "+ v);
            }
          }
        } else if (right instanceof Local){
          logger.info("alias "+ ass); // definitions *and* aliases are collected, so no need to handle them separately
        } else {
          throw new RuntimeException("error: right not instance of NewArrayExpr nor Local! "+ ass);
        }
      }
    }

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


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