[Soot-list] ISSUES USING SOOT CALL GRAPH API

Michael Osho mikosh2005 at yahoo.com
Fri Jul 25 07:52:35 EDT 2014


Dear Team,




Good day. First of all, we would like to commend you all for your efforts in creating and maintaining the Soot framework. We are a team of students and are trying to leverage on Soot's callgraph API. What we would like to achieve is to get all the execution trace that leads to a particular method. For example: 
org.package.Class1.method1()->org.package.Class2.anotherMethod()->org.package2.Class3.targetMethod()
where targetMethod() of Class3 is the target method in question and the above execution trace shows method calls leading to it.

We have studied the CallGraphExample tutorial and figured we should be able to achieve our aim using
 backward flow via using the CallGraph.edgesInto(...) method. However, the list returned always give a reference to itself rather than the methods that call the target method. See sample code below:

PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {

        @Override
        protected void internalTransform(String phaseName, Map options) {
               CHATransformer.v().transform();
               SootMethod tgtMethod = Scene.v().getSootClass("org.package2.Class3").getMethodByName("targetMethod");
                       
               CallGraph cg = Scene.v().getCallGraph();
               Iterator<MethodOrMethodContext> targetCallers = new Targets(cg.edgesInto(tgtMethod));
               while (targetCallers.hasNext()) {
                   SootMethod tgtCaller = (SootMethod)targetCallers.next();
                   System.out.println(tgtMethod + " may be called by " + tgtCaller);
               }
}

The output:
<org.package2.Class3: void targetMethod()> may be called by <org.package2.Class3: void targetMethod()>
rather than 
<org.package2.Class3: void targetMethod()> may be called by <org.package.Class2: void anotherMethod()> which is expected.
*NOTE: targetMethod() is not recursive and it is only being called in .anotherMethod().

Any assistance given will be highly appreciated.

Many
 Thanks,
Mike.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140725/d42bb4c6/attachment.html 


More information about the Soot-list mailing list