[Soot-list] ISSUES USING SOOT CALL GRAPH API

Marc-André Laverdière marc-andre.laverdiere-papineau at polymtl.ca
Fri Jul 25 11:38:57 EDT 2014


Hello,

I'm not sure what you're doing with this 'new Target' business, which
doesn't help me understand the issue. My guess is that you're not using
the 'source' end of the edge, bu the 'target'

Here is how I'm doing it (in Scala)
v.edgesInto(callee).asScala.map(_.getSrc.method())

The traversal to create those paths would be a simple tail-recursive method.

But keep in mind that Spark is context-insensitive by default, so that
means that you'll have spurious paths.

If that is a problem for you, then you can consider using the geometric
PTA variant of Spark, which will give you context-sensitive results.

Regards,

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 07/25/2014 07:52 AM, Michael Osho wrote:
> 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.
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
> 


More information about the Soot-list mailing list