[Soot-list] CallGraph -- No Method ( ERROR )
Abdejalil SETH
shait.abdeljalil at gmail.com
Sat Apr 13 11:25:56 EDT 2013
Hi everybody,
*
*
I have same problem with calling setAccessible() method
*
**CallGraphExample.JAVA*package callgraphs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import soot.MethodOrMethodContext;
import soot.PackManager;
import soot.Scene;
import soot.SceneTransformer;
import soot.SootClass;
import soot.SootMethod;
import soot.Transform;
import soot.jimple.toolkits.callgraph.CHATransformer;
import soot.jimple.toolkits.callgraph.CallGraph;
import soot.jimple.toolkits.callgraph.Targets;
public class CallGraphExample
{
public static void main(String[] args) {
List<String> argsList = new ArrayList<String>(Arrays.asList(args));
argsList.addAll(Arrays.asList(new String[]{
"-w",
"-main-class",
"ToDo.FieldAccessible",//main-class
"ToDo.FieldAccessible",//argument classes
"ToDo.FieldAccessible" //
}));
PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new
SceneTransformer() {
@Override
protected void internalTransform(String phaseName, Map options) {
CHATransformer.v().transform();
SootClass a = Scene.v().getSootClass("
ToDo.FieldAccessible");
SootMethod src = Scene.v().getMainClass().getMethodByName("setAccessible");
CallGraph cg = Scene.v().getCallGraph();
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesInto
(src));
while (targets.hasNext()) {
SootMethod tgt = (SootMethod)targets.next();
System.out.println(src + " may call " + tgt);
}
}
}));
args = argsList.toArray(new String[0]);
soot.Main.main(args);
}
}
OUTPUT :
Soot started on Sat Apr 13 17:04:59 CEST 2013
[Call Graph] For information on where the call graph may be incomplete, use
the verbose option to the cg phase.
[Call Graph] For information on where the call graph may be incomplete, use
the verbose option to the cg phase.
Exception in thread "main" java.lang.RuntimeException: No method
setAccessible in class ToDo.FieldAccessible
at soot.SootClass.getMethod(SootClass.java:297)
at soot.SootClass.getMethod(SootClass.java:321)
at
dk.brics.soot.callgraphs.CallGraphExample$1.internalTransform(CallGraphExample.java:40)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at soot.Transform.apply(Transform.java:89)
at soot.ScenePack.internalApply(ScenePack.java:43)
at soot.Pack.apply(Pack.java:114)
at soot.PackManager.runWholeProgramPacks(PackManager.java:418)
at soot.PackManager.runPacks(PackManager.java:336)
at soot.Main.run(Main.java:198)
at soot.Main.main(Main.java:141)
at callgraphs.CallGraphExample.main(CallGraphExample.java:54)
FieldAccessible.JAVA
package ToDo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class FieldAccessible {
public static class MyClass {
public String theField;
}
public static void main(String[] args) throws Exception {
MyClass myClass = new MyClass();
Field field1 = myClass.getClass().getDeclaredField("theField");
field1.*setAccessible(true)*;
System.out.println(field1.get(myClass));
}
}
I would like to get the path of *setAccessible , *eg: *FieldAccessible.main.
*SetAccessible
Thank you in advance,
I'd be really grateful for your support
Jalilos
This is a copy of my email :
http://soot-callgraph-analysing.blogspot.de/2013/04/callgraph-no-method.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130413/5abb27d7/attachment-0001.html
More information about the Soot-list
mailing list