[Soot-list] Incomplete CallGraph
Steven Arzt
Steven.Arzt at cased.de
Fri Jul 11 11:20:44 EDT 2014
Hi Xiangxing,
Please check whether the method containing the calls for which you do not find any callees in the callgraph is itself marked as reachable. If a method a() calls a method b(), you only get a corresponding call graph edge if a() is reachable in the first place. The check is easy: Scene.v().getReachableMethods().contains(myMethod).
If this is ok, then make sure that there is a constructor call for base object on which you invoke the method. Take the following example:
A a = new A();
a.foo();
In this case, there will be a call edge to A.foo(). But if you take the following example and assume that the factory method “makeA” is a phantom method for which we do not have a body, there will not be a callgraph edge:
A a = makeA();
a.foo();
Best regards,
Steven
Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von qpj
Gesendet: Freitag, 11. Juli 2014 17:13
An: soot-list
Betreff: [Soot-list] Incomplete CallGraph
Hi All,
When I use
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(sm));
I found sm do not have any targets if sm is a method came from a class whose name contains $(like cz.romario.opensudoku.gui.FileListActivity$2).
My code:
for(SootClass sootClass:Scene.v().getClasses()){
if(sootClass.getName().startsWith("cz.romario.opensudoku.gui.FileListActivity")){
innList.add(sootClass);
}
}
for(SootClass sc:innList){
for(SootMethod sm:sc.getMethods()){
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(sm));
System.out.println(sm+":");
while(targets.hasNext())
System.out.println(targets.next());
}
}
My result:
<cz.romario.opensudoku.gui.FileListActivity: void onCreate(android.os.Bundle)>:
targetMethod:<java.io.File: void <clinit>()>
targetMethod:<java.lang.StringBuilder: java.lang.String toString()>
targetMethod:<java.lang.StringBuilder: java.lang.StringBuilder append(java.lang.String)>
targetMethod:<java.lang.StringBuilder: java.lang.StringBuilder append(java.lang.String)>
targetMethod:<java.lang.StringBuilder: void <init>(java.lang.String)>
targetMethod:<java.util.Date: void <init>(long)>
targetMethod:<java.io.File: long lastModified()>
targetMethod:<java.io.File: java.lang.String getName()>
<cz.romario.opensudoku.gui.FileListActivity$2: void <init>(cz.romario.opensudoku.gui.FileListActivity)>:
targetMethod:<java.lang.Object: void <init>()>
<cz.romario.opensudoku.gui.FileListActivity$2: boolean accept(java.io.File)>:
no targets.
<cz.romario.opensudoku.gui.FileListActivity$3: void <init>(cz.romario.opensudoku.gui.FileListActivity)>:
targetMethod:<java.lang.Object: void <init>()>
<cz.romario.opensudoku.gui.FileListActivity$3: void onClick(android.content.DialogInterface,int)>:
no targets.
As you can see:
1. In cz.romario.opensudoku.gui.FileListActivity, I can get all targets of onCreate().
2. In cz.romario.opensudoku.gui.FileListActivity$2 and cz.romario.opensudoku.gui.FileListActivity$3, I cannot get any targets from accept() and onClick().
Do any one meet with this problem before?
Best Regard.
Xiangxing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140711/315eea0f/attachment-0001.html
More information about the Soot-list
mailing list