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


Java StaticFieldRef.getField方法代码示例

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


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

示例1: hasPrefix

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
public boolean hasPrefix(Value v) { // if this has prefix v
	if (v instanceof Local) {
		if (local == null)
			return false;
		else
			return (local.equals(v));

	} else if (v instanceof InstanceFieldRef) {
		InstanceFieldRef ifr = (InstanceFieldRef) v;
		if (local == null) {
			if (ifr.getBase() != null)
				return false;
		} else if (!local.equals(ifr.getBase()))
			return false;
		if (fields.length > 0 && ifr.getField() == fields[0])
			return true;
		return false;

	} else if (v instanceof StaticFieldRef) {
		StaticFieldRef sfr = (StaticFieldRef) v;
		if (local != null)
			return false;
		if (fields.length > 0 && sfr.getField() == fields[0])
			return true;
		return false;

	} else if (v instanceof ArrayRef) {
		ArrayRef ar = (ArrayRef) v;
		if (local == null)
			return false;
		else
			return (local.equals(ar.getBase()));

	} else if (v instanceof Constant) {
		return false;
	} else
		throw new RuntimeException("Unexpected left side " + v.getClass());
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:39,代码来源:FlowAbstraction.java

示例2: buildStaticFieldPutInsn

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
private Insn buildStaticFieldPutInsn(StaticFieldRef destRef, Value source) {
	SootField destSootField = destRef.getField();
	Register sourceReg = regAlloc.asImmediate(source, constantV);
	BuilderFieldReference destField = DexPrinter.toFieldReference(destSootField, belongingFile);
	Opcode opc = getPutGetOpcodeWithTypeSuffix("sput", destField.getType());
	return new Insn21c(opc, sourceReg, destField);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:8,代码来源:StmtVisitor.java

示例3: analyzeStaticFieldRef

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
private AbsValue analyzeStaticFieldRef(StaticFieldRef r, Unit u, Set <Unit> seen ) {
	ProgramSpy.debug("************ STATIC FIELD REF ********");
	StaticFieldRef fr = (StaticFieldRef) r;
	SootField field = fr.getField();
	PointsToSet fdefs =pag.reachingObjects(fr.getField()); 
	//			((pag instanceof DemandCSPointsTo) ? ((DemandCSPointsTo) pag).getPAG() : pag).reachingObjects(fr.getField());
	if (P2SAux.is_simple(field.getType())) {
		ProgramSpy.debug("Simple field");
		AbsValue sb = possibleStringConstantsValue(str(fr),fdefs);
		String tailname = 
			field.getDeclaringClass().getName() + "_" +
			field.getName();
		// This is bogus but it seems that Soot incorectly ignores some clinit
		if (unresolved(sb)) { 
			if (!cc.doublon_field.containsKey(tailname)) {
				String name = "AF" + cc.count++ + "_" + tailname;
				ProgramSpy.debug("Registering field " + name);
				SpyField spy = new SpyField(name,fr.getField(),null);
				cc.doublon_field.put(tailname,spy);
				cc.registerField (fr.getField(), spy);
				return  new MarkValue(tailname, spy.getAbsValue());
			} else {
				AbsValue av = ((SpyField) cc.doublon_field.get(tailname)).getAbsValue();
				return  new MarkValue(tailname, av);
			}
		} else {
			return sb; 
		}
	} else
		return P2SAux.p2sContents(cc.nodeTable, fdefs);

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

示例4: addLevelInAssignStmt

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
/**
 * @param f
 * @param pos
 */
public static void addLevelInAssignStmt(StaticFieldRef f, Unit pos) {
	logger.info( "Adding Level of static Field " + f.toString() + " in assign stmt");
	
	SootField field = f.getField();

	String signature = getSignatureForField(field);
	
	ArrayList<Type> parameterTypes = new ArrayList<Type>();
	parameterTypes.add(RefType.v("java.lang.Object"));
	parameterTypes.add(RefType.v("java.lang.String"));
	
	SootClass sc = field.getDeclaringClass();
	
	Unit assignDeclaringClass	= Jimple.v().newAssignStmt(
			local_for_Objects, ClassConstant.v(sc.getName().replace(".", "/")));
	
	Unit assignSignature = Jimple.v().newAssignStmt(
			local_for_Strings, StringConstant.v(signature));
	
	Expr addObj = Jimple.v().newVirtualInvokeExpr(
			hs, Scene.v().makeMethodRef(Scene.v().getSootClass(HANDLE_CLASS),
			"joinLevelOfFieldAndAssignmentLevel", parameterTypes, 
			Scene.v().getObjectType(), false),
			local_for_Objects, local_for_Strings);
	Unit assignExpr = Jimple.v().newInvokeStmt(addObj);
	
	unitStore_Before.insertElement(
			unitStore_Before.new Element(assignDeclaringClass, pos));
	unitStore_Before.insertElement(unitStore_Before.new Element(assignSignature, pos));
	unitStore_Before.insertElement(unitStore_Before.new Element(assignExpr, pos));
	lastPos = pos;
}
 
开发者ID:proglang,项目名称:jgs,代码行数:37,代码来源:JimpleInjector.java

示例5: buildStaticFieldGetInsn

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
private Insn buildStaticFieldGetInsn(Register destinationReg, StaticFieldRef sourceRef) {
	SootField sourceSootField = sourceRef.getField();
	BuilderFieldReference sourceField = DexPrinter.toFieldReference(sourceSootField, belongingFile);
	Opcode opc = getPutGetOpcodeWithTypeSuffix("sget", sourceField.getType());
	return new Insn21c(opc, destinationReg, sourceField);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:7,代码来源:StmtVisitor.java

示例6: setLevelOfAssignStmt

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
/**
 * @param f
 * @param pos
 */
public static void setLevelOfAssignStmt(StaticFieldRef f, Unit pos) {
	logger.info( "Set Level of static Field " + f.toString() + " in assign stmt");
	
	SootField field = f.getField();

	String signature = getSignatureForField(field);
	System.out.println("Signature of static field in jimple injector " + signature);
	
	ArrayList<Type> parameterTypes = new ArrayList<Type>();
	parameterTypes.add(RefType.v("java.lang.Object"));
	parameterTypes.add(RefType.v("java.lang.String"));
	
	SootClass sc = field.getDeclaringClass();
	
	Unit assignDeclaringClass	= Jimple.v().newAssignStmt(
			local_for_Objects, ClassConstant.v(sc.getName().replace(".", "/")));
	
	Unit assignSignature = Jimple.v().newAssignStmt(
			local_for_Strings, StringConstant.v(signature));
	
	// insert: checkGlobalPC(Object, String)
	Expr checkGlobalPC	= Jimple.v().newVirtualInvokeExpr(
			hs, Scene.v().makeMethodRef(
			Scene.v().getSootClass(HANDLE_CLASS), "checkGlobalPC", 
			parameterTypes, VoidType.v(), false), 
			local_for_Objects, local_for_Strings);
	Unit checkGlobalPCExpr = Jimple.v().newInvokeStmt(checkGlobalPC);
	
	// Add setLevelOfField
	Expr addObj = Jimple.v().newVirtualInvokeExpr(
			hs, Scene.v().makeMethodRef(Scene.v().getSootClass(HANDLE_CLASS),
			"setLevelOfField", parameterTypes, 
			Scene.v().getObjectType(), false),
			local_for_Objects, local_for_Strings);
	Unit assignExpr = Jimple.v().newInvokeStmt(addObj);
	
	unitStore_Before.insertElement(
			unitStore_Before.new Element(assignDeclaringClass, pos));
	unitStore_Before.insertElement(unitStore_Before.new Element(assignSignature, pos));
	unitStore_Before.insertElement(unitStore_Before.new Element(checkGlobalPCExpr, pos));
	unitStore_Before.insertElement(unitStore_Before.new Element(assignExpr, pos));
	lastPos = pos;
}
 
开发者ID:proglang,项目名称:jgs,代码行数:48,代码来源:JimpleInjector.java

示例7: str

import soot.jimple.StaticFieldRef; //导入方法依赖的package包/类
/**
 * gives back a representation of the field 
 * @param fr an instance field
 * @return the result cl.name
 */
static String str(StaticFieldRef fr) {
	SootField sf = fr.getField ();
	return (sf.getDeclaringClass ()).getName () + "." + sf.getName () ;
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:10,代码来源:MethodSpyAnalysis.java


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