soot icon indicating copy to clipboard operation
soot copied to clipboard

Why SOOT Cannot find the method calls from a dynamic loaded class?

Open FlyTweety opened this issue 2 years ago • 1 comments

I am a beginner in learning soot and I was tormented by this strange problem: I create a instance of a class and I cannot find its methodcalls.

Here is the source code that I want to analyze: `package com.example.hello;

public class TestInputMain { public static void main(String[] args) {

    Calculator calc = new Calculator();  // another class in same package, written by me. 

    int result = calc.add(10, 20); // I CANNOT FIND IT!!!

    System.out.println("The result of adding 10 and 20 is " + result);
}

}`

Here is part of soot codes that I use: `…… //SET UP CALL GRAPH String[] sootArgs = { "-pp", "-process-dir", jarFilePath, //I put them in a jar. The result is same without a jar "-allow-phantom-refs", "-no-bodies-for-excluded", "-whole-program", "-verbose", "-p", "cg.cha", "enabled:true", "-dynamic-dir", jarFilePath, }; Options.v().parse(sootArgs);

    String sootClassPath = jarFilePath;
    Options.v().set_soot_classpath(sootClassPath);

    Scene.v().loadNecessaryClasses();

    PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTransform", new SceneTransformer() {
        @Override
        protected void internalTransform(String phaseName, Map<String, String> options) {
            CallGraph cg = Scene.v().getCallGraph();

…… //PRINT EVERY EDGE IN CALLGRAPH CallGraph callgraph = Scene.v().getCallGraph(); Iterator<Edge> edgesdebug = callgraph.iterator(); while (edgesdebug.hasNext()) { Edge it = edgesdebug.next(); System.out.println("??????" + it.src() + " =>> " + it.tgt()); }` The situation is, even if I print every edge in callgraph, including all kinds of lib functions, I still cannot find "add".

FlyTweety avatar Mar 30 '23 02:03 FlyTweety

me too

NiceAsiv avatar Apr 01 '24 02:04 NiceAsiv