[Soot-list] Java class static analysis with Soot in Eclipse (Loading the class)
hesam ghafouri
hsmghfr at yahoo.com
Wed Sep 14 16:27:10 EDT 2016
Hello all,
I am new to soot. My question might be very simple. I am using soot for static analysis for java classes. So lets say I have a java class here : Desktop/Javaclass/sample.java which I want to create the CFG.
I am using Soot Eclipse plugin and the following code. However the sample.java class is not loaded and classes.size() returns 0. How can I load the Sample.java class ??In other words how can I set the soot-class-path (to my sample.java path) in eclipse?
(In my project "arguments" in project "run configuration" I am using: -process-dir Desktop/Javaclass/ which I think it should load all java classes in this directory to analyze?!?)
public static void main(String[] args) {
Options.v().set_keep_line_number(true);
Options.v().set_whole_program(true);
Options.v().set_allow_phantom_refs(true);
Options.v().set_src_prec(Options.src_prec_java);
Options.v().set_output_format(Options.output_format_jimple);
Options.v().setPhaseOption("cg.spark", "on");
Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);
Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);
Chain<SootClass> classes =Scene.v().getClasses();
System.out.println(classes.size()); //returns 0 because class is not loaded
soot.Main.main(args);
}
Regards,Hesam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20160914/22a0e316/attachment.html
More information about the Soot-list
mailing list