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


Java ParameterRef类代码示例

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


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

示例1: caseParameterRef

import soot.jimple.ParameterRef; //导入依赖的package包/类
public void caseParameterRef(ParameterRef v) {
	String oldName = varName;
	
	Type paramType= v.getType();
	suggestVariableName("paramType");
	String paramTypeName = this.varName;
	ttp.setVariableName(paramTypeName);
	paramType.apply(ttp);
	
	int number = v.getIndex();
	suggestVariableName("number");
	p.println("int "+varName+"=" + number+ ";");
	
	p.println("Value "+oldName+" = Jimple.v().newParameterRef("+paramTypeName+", "+varName+");");
	varName = oldName;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:17,代码来源:ValueTemplatePrinter.java

示例2: caseIdentityStmt

import soot.jimple.ParameterRef; //导入依赖的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

示例3: getParameterLocal

import soot.jimple.ParameterRef; //导入依赖的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

示例4: getParameterLocals

import soot.jimple.ParameterRef; //导入依赖的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

示例5: getIntConstantsFromLocal

import soot.jimple.ParameterRef; //导入依赖的package包/类
void getIntConstantsFromLocal(SimpleLocalDefs sld, Local l, Unit u, List<String> whats) throws IOException {
	Iterator<Unit> iter = sld.getDefsOfAt(l, u).iterator();
	while (iter.hasNext()) {
		Unit def = iter.next();
		if (! (def instanceof DefinitionStmt)) continue;
		DefinitionStmt assign = (DefinitionStmt) def;
		Value rightOp = assign.getRightOp();
		if (rightOp instanceof IntConstant) {
			whats.add(rightOp.toString());
		} else if (rightOp instanceof ParameterRef){
			whats.add(rightOp.toString());
		} else if (rightOp instanceof Local) {
			getIntConstantsFromLocal(sld, (Local)rightOp, def, whats);
			print("getIntConstantsFromLocal -> local");
		} else {
			print("???"+def.toString());
		}
	}
}
 
开发者ID:USC-NSL,项目名称:SIF,代码行数:20,代码来源:FindMessage.java

示例6: analyzeParameterRef

import soot.jimple.ParameterRef; //导入依赖的package包/类
private AbsValue analyzeParameterRef(ParameterRef r, Unit u, Set <Unit> seen ) {
	ProgramSpy.debug("************ PARAMETER ********");
	ArrayList<Integer> args = new ArrayList<Integer> ();
	int pos = ((ParameterRef) r).getIndex() + 1;
	args.add (Integer.valueOf(pos));
	String tailname = 
		method.getDeclaringClass().getName() + "_" + 
		method.getName() + "_" + pos;
	if (acf.treatSpyParameter()) {
		if (!cc.doublon.containsKey(tailname)) {
			String name = "AP" + cc.count++ + "_" + tailname;
			ProgramSpy.debug("Registering " + method.getName() + "," + 
					pos + " under " + name);
			SpyMethodArgs spy = new SpyMethodArgs(name,method,args,null);
			cc.doublon.put(tailname,spy);
			cc.register (name, spy);
			return new MarkValue(tailname, spy.getAbsValue());
		} else {
			AbsValue av = ((SpyMethodArgs) cc.doublon.get(tailname)).getAbsValue();
			return new MarkValue(tailname, av);
		}
	} else {
		return new UnknownValue(r.toString());
	}

}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:27,代码来源:MethodSpyAnalysis.java

示例7: propagateNormalFlow

import soot.jimple.ParameterRef; //导入依赖的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: getParameterValues

import soot.jimple.ParameterRef; //导入依赖的package包/类
private Value[] getParameterValues(SootMethod destinationMethod) {
	int paramsFound = 0;
	Value[] result = new Value[destinationMethod.getParameterCount()];
	for (Unit unit : destinationMethod.getActiveBody().getUnits()) {
		if (!(unit instanceof IdentityStmt))
			continue;

		Value rightOp = ((IdentityStmt) unit).getRightOp();
		if (!(rightOp instanceof ParameterRef))
			continue;

		ParameterRef paramRef = (ParameterRef) rightOp;
		result[paramRef.getIndex()] = paramRef;
		paramsFound++;

		if (paramsFound == result.length)
			break;
	}
	return result;
}
 
开发者ID:johanneslerch,项目名称:FlowTwist,代码行数:21,代码来源:DefaultTaintPropagator.java

示例9: caseIdentityStmt

import soot.jimple.ParameterRef; //导入依赖的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

示例10: methodIsAndroidStub

import soot.jimple.ParameterRef; //导入依赖的package包/类
/**
 * Checks whether the given method is a library stub method
 * @param method The method to check
 * @return True if the given method is an Android library stub, false
 * otherwise
 */
private boolean methodIsAndroidStub(SootMethod method) {		
	if (!(Options.v().src_prec() == Options.src_prec_apk
			&& method.getDeclaringClass().isLibraryClass()
			&& SystemClassHandler.isClassInSystemPackage(
					method.getDeclaringClass().getName())))
		return false;
	
	// Check whether there is only a single throw statement
	for (Unit u : method.getActiveBody().getUnits()) {
		if (u instanceof DefinitionStmt) {
			DefinitionStmt defStmt = (DefinitionStmt) u;
			if (!(defStmt.getRightOp() instanceof ThisRef)
					&& !(defStmt.getRightOp() instanceof ParameterRef)
					&& !(defStmt.getRightOp() instanceof NewExpr))
				return false;
		}
		else if (u instanceof InvokeStmt) {
			InvokeStmt stmt = (InvokeStmt) u;
			
			// Check for exception constructor invocations
			SootMethod callee = stmt.getInvokeExpr().getMethod();
			if (!callee.getSubSignature().equals("void <init>(java.lang.String)"))
				// Check for super class constructor invocation
				if (!(method.getDeclaringClass().hasSuperclass()
						&& callee.getDeclaringClass() == method.getDeclaringClass().getSuperclass()
						&& callee.getName().equals("<init>")))
					return false;
		}
		else if (!(u instanceof ThrowStmt))
			return false;
	}
	return true;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:40,代码来源:InterproceduralConstantValuePropagator.java

示例11: getFirstNonIdentityStmt

import soot.jimple.ParameterRef; //导入依赖的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

示例12: isDexInstruction

import soot.jimple.ParameterRef; //导入依赖的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

示例13: getParameterRefs

import soot.jimple.ParameterRef; //导入依赖的package包/类
/**
  * Returns the list of parameter references used in this body. The list is as long as
  * the number of parameters declared in the associated method's signature.
  * The list may have <code>null</code> entries for parameters not referenced in the body.
  * The returned list is of fixed size.
  */
 public List<Value> getParameterRefs()
 {
 	Value[] res = new Value[getMethod().getParameterCount()];
     for (Unit s : getUnits()) {
         if (s instanceof IdentityStmt) {
	Value rightOp = ((IdentityStmt)s).getRightOp();
	if (rightOp instanceof ParameterRef) {
		ParameterRef parameterRef = (ParameterRef) rightOp;
		res[parameterRef.getIndex()] = parameterRef;
	}
}
     }
     return Arrays.asList(res);
 }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:21,代码来源:Body.java

示例14: isApplicable

import soot.jimple.ParameterRef; //导入依赖的package包/类
@Override
public boolean isApplicable(UnitGraph graph, Set<Unit> input, Unit node, Set<Unit> output,
                            Set<Value> taintedValues, Queue<MethodAnalysis> queue, Set<MethodAnalysis> processed) {
    return !input.isEmpty() &&
           node instanceof IdentityStmt &&
           ((IdentityStmt)node).getRightOp() instanceof ParameterRef;
}
 
开发者ID:uwdb,项目名称:pipegen,代码行数:8,代码来源:ParameterSinkExpression.java

示例15: findIntAssignmentsForLocal

import soot.jimple.ParameterRef; //导入依赖的package包/类
/**
 * Return all possible values for an integer local variable.
 * 
 * @param start The statement where the analysis should start.
 * @param local The local variable whose values we are looking for.
 * @param visitedStmts The set of visited statement.
 * @return The set of possible values for the local variable.
 */
private Set<Object> findIntAssignmentsForLocal(Stmt start, Local local, Set<Stmt> visitedStmts) {
  List<DefinitionStmt> assignStmts =
      findAssignmentsForLocal(start, local, true, new HashSet<Pair<Unit, Local>>());
  Set<Object> result = new HashSet<>(assignStmts.size());

  for (DefinitionStmt assignStmt : assignStmts) {
    Value rhsValue = assignStmt.getRightOp();
    if (rhsValue instanceof IntConstant) {
      result.add(((IntConstant) rhsValue).value);
    } else if (rhsValue instanceof LongConstant) {
      result.add(((LongConstant) rhsValue).value);
    } else if (rhsValue instanceof ParameterRef) {
      ParameterRef parameterRef = (ParameterRef) rhsValue;
      Iterator<Edge> edges =
          Scene.v().getCallGraph()
              .edgesInto(AnalysisParameters.v().getIcfg().getMethodOf(assignStmt));
      while (edges.hasNext()) {
        Edge edge = edges.next();
        InvokeExpr invokeExpr = edge.srcStmt().getInvokeExpr();
        Value argValue = invokeExpr.getArg(parameterRef.getIndex());
        if (argValue instanceof IntConstant) {
          result.add(((IntConstant) argValue).value);
        } else if (argValue instanceof LongConstant) {
          result.add(((LongConstant) argValue).value);
        } else if (argValue instanceof Local) {
          Set<Object> newResults =
              findIntAssignmentsForLocal(edge.srcStmt(), (Local) argValue, visitedStmts);
          result.addAll(newResults);
        } else {
          result.add(TOP_VALUE);
        }
      }
    } else {
      return Collections.singleton((Object) TOP_VALUE);
    }
  }

  return result;
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:48,代码来源:IntValueAnalysis.java


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