use of soot.SootClass in project soot by Sable.
the class JavaTranslator method getTargetsOf.
public List<SootMethod> getTargetsOf(Value v, SootMethod m) {
SootClass rc;
Type t = v.getType();
if (t instanceof ArrayType) {
rc = Scene.v().getSootClass("java.lang.Object");
} else {
rc = ((RefType) v.getType()).getSootClass();
}
List<SootMethod> targets = h.resolveAbstractDispatch(rc, m);
return targets;
}
use of soot.SootClass in project soot by Sable.
the class JavaTranslator method makeMethods.
void makeMethods() {
Collection<SootClass> app = Scene.v().getApplicationClasses();
for (SootClass ac : app) {
List<SootMethod> sootMethods = ac.getMethods();
for (SootMethod sm : sootMethods) {
List<Variable> vars = new LinkedList<Variable>();
List<Type> params = sm.getParameterTypes();
for (Type pt : params) {
Variable v = makeVariable(pt);
vars.add(v);
}
Variable[] var_array = (Variable[]) vars.toArray(new Variable[0]);
Method m = new Method(sm.getName(), var_array);
methods.add(m);
methodsignaturToMethod.put(sm.getSignature(), m);
}
}
}
use of soot.SootClass in project soot by Sable.
the class PointsToAnalysis method main.
public static void main(String[] args) {
loadClass("Item", false);
loadClass("Container", false);
SootClass c = loadClass(args[1], true);
soot.Scene.v().loadNecessaryClasses();
soot.Scene.v().setEntryPoints(EntryPoints.v().all());
if (args[0].equals("paddle"))
setPaddlePointsToAnalysis();
else if (args[0].equals("spark"))
setSparkPointsToAnalysis();
SootField f = getField("Container", "item");
Map /*<Local>*/
ls = getLocals(c, args[2], "Container");
printLocalIntersects(ls);
printFieldIntersects(ls, f);
}
use of soot.SootClass in project soot by Sable.
the class ExprTranslator method handleSpecialCall.
// any type
boolean handleSpecialCall(InstanceInvokeExpr expr, SootMethod target) {
String mn = target.getName();
int np = target.getParameterCount();
SootClass dc = target.getDeclaringClass();
// Is it a method in a Foo object?
if (isFoo(dc)) {
if (mn.equals("foo") && np == 1) {
Variable lvar = new Variable(Variable.Type.FOO);
Method foo = new Method("foo", new Variable[0]);
FooMethodCall fmc = new FooMethodCall(foo);
fmc.setAssignmentTarget(lvar);
st.addStatement(fmc);
return true;
}
// Unknown Foo method
return false;
}
// Not a special call
return false;
}
use of soot.SootClass in project soot by Sable.
the class ExprTranslator method caseSpecialInvokeExpr.
public void caseSpecialInvokeExpr(SpecialInvokeExpr expr) {
// Constructor calls, maybe
Variable bvar = st.getLocalVariable((Local) expr.getBase());
SootMethod m = expr.getMethod();
if (m.getName().equals("<init>")) {
SootClass dc = m.getDeclaringClass();
if (isFoo(dc)) {
FooInit fi = new FooInit();
fi.setAssignmentTarget(bvar);
st.addStatement(fi);
return;
}
}
handleCall(expr, expr.getMethod());
}
Aggregations