Search in sources :

Example 1 with TargetMethodsFinder

use of soot.jimple.toolkits.thread.mhp.TargetMethodsFinder in project soot by Sable.

the class MultiRunStatementsFinder method findMultiCalledMethodsIntra.

private void findMultiCalledMethodsIntra(Set<SootMethod> multiCalledMethods, CallGraph callGraph) {
    Iterator<Unit> it = multiRunStatements.iterator();
    while (it.hasNext()) {
        Stmt stmt = (Stmt) it.next();
        if (stmt.containsInvokeExpr()) {
            InvokeExpr invokeExpr = stmt.getInvokeExpr();
            List<SootMethod> targetList = new ArrayList<SootMethod>();
            SootMethod method = invokeExpr.getMethod();
            if (invokeExpr instanceof StaticInvokeExpr) {
                targetList.add(method);
            } else if (invokeExpr instanceof InstanceInvokeExpr) {
                if (method.isConcrete() && !method.getDeclaringClass().isLibraryClass()) {
                    TargetMethodsFinder tmd = new TargetMethodsFinder();
                    targetList = tmd.find(stmt, callGraph, true, true);
                }
            }
            if (targetList != null) {
                Iterator<SootMethod> iterator = targetList.iterator();
                while (iterator.hasNext()) {
                    SootMethod obj = iterator.next();
                    if (!obj.isNative()) {
                        multiCalledMethods.add(obj);
                    }
                }
            }
        }
    }
}
Also used : StaticInvokeExpr(soot.jimple.StaticInvokeExpr) TargetMethodsFinder(soot.jimple.toolkits.thread.mhp.TargetMethodsFinder) InstanceInvokeExpr(soot.jimple.InstanceInvokeExpr) StaticInvokeExpr(soot.jimple.StaticInvokeExpr) InvokeExpr(soot.jimple.InvokeExpr) ArrayList(java.util.ArrayList) SootMethod(soot.SootMethod) InstanceInvokeExpr(soot.jimple.InstanceInvokeExpr) Unit(soot.Unit) Stmt(soot.jimple.Stmt)

Aggregations

ArrayList (java.util.ArrayList)1 SootMethod (soot.SootMethod)1 Unit (soot.Unit)1 InstanceInvokeExpr (soot.jimple.InstanceInvokeExpr)1 InvokeExpr (soot.jimple.InvokeExpr)1 StaticInvokeExpr (soot.jimple.StaticInvokeExpr)1 Stmt (soot.jimple.Stmt)1 TargetMethodsFinder (soot.jimple.toolkits.thread.mhp.TargetMethodsFinder)1