本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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 () ;
}