[Soot-list] Private methods are not being
Clarissa Grixti
clarissa_14_4 at hotmail.com
Sun Mar 18 08:40:39 EDT 2012
Hi all,
I'm using SOOT to be able to generate a call graph and then get the target nodes according to the methods that I need. The problem is that when I input a method name which is private, the target nodes are not being returned.
What's weird is that I am using the exclude and "-no-bodies-for-excluded" so that methods in the java. package will not be included in the Call graph. And in this case when I try to get the nodes for a private method, nothing is returned. However when I remove the exclude and the "-no-bodies-for-excluded", then the target nodes are being returned. However I still want to be able to use the the exclude as it is taking a lot of time to give me a result and I don't need any information regarding these methods.
I have the following code:
public static void main(String[] args) { List<String> argsList = new ArrayList<String>(); argsList.addAll(Arrays.asList(new String[]{ "-w", "-main-class", "Addition2",//main-class "Addition2",//argument classes "edu.Calculator", "-exclude", "java.", "-no-bodies-for-excluded" // }));
PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {
@Override protected void internalTransform(String phaseName, Map options) { CHATransformer.v().transform(); getTargets(); } }));
args = argsList.toArray(new String[0]); soot.Main.main(args); } public static void getTargets() { SootMethod src = Scene.v().getMainClass().getMethodByName("jButton1ActionPerformed"); // this is a private method in the main Class: Addition2 CallGraph cg = Scene.v().getCallGraph();
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(src)); while (targets.hasNext()) { SootMethod tgt = (SootMethod)targets.next(); CG.method.add(tgt); System.out.println("Target: " + tgt.getName()); } }This is when no targets for private methods are being outputted. I have tried it with other private methods in other classes and no targets were outputted. Does someone maybe know why this is happening please?
Thanks for your help and regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120318/f8273167/attachment.html
More information about the Soot-list
mailing list