[Soot-list] Call graph building error when using averroes (soot.AbstractSootFieldRef$FieldResolutionFailedException: Class java.lang.System doesn't have field err)
Danilo Arcidiacono
dnlnet2005 at yahoo.it
Mon May 4 13:36:58 EDT 2015
Hi,
I'm trying to compute the call graph of a simple application, with the aid of averroes and SPARK (I'm using the JDK 7 Update 79 on Windows 64-bit).
My input application consists of two jars:
- TracingTest.jar
- Annotations.jar, referred by TracingTest.jar
I've managed to run averroes which generates the usual jars (organizedApplication / organizedLibrary / placeholderLibrary).
However, when I try to compute the call graph with SPARK, an exception is thrown:
No main class given. Inferred 'Main' as main class.
[Call Graph] For information on where the call graph may be incomplete, use the verbose option to the cg phase.
Exception in thread "main" soot.AbstractSootFieldRef$FieldResolutionFailedException: Class java.lang.System doesn't have field err : java.io.PrintStream; failed to resolve in superclasses and interfacesLooking in java.lang.System which has fields [<java.lang.System: java.io.PrintStream out>]
Looking in java.lang.Object which has fields [] at soot.AbstractSootFieldRef.resolve(AbstractSootFieldRef.java:116)
at soot.AbstractSootFieldRef.resolve(AbstractSootFieldRef.java:75)
[... snip ...]
at soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:84)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at main.main(main.java:62)
Picked up _JAVA_OPTIONS: -Xmx1200m -Xms256m
I use the following code to invoke SPARK:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap; import soot.G;
import soot.Scene;
import soot.SootClass;
import soot.jimple.spark.SparkTransformer;
import soot.jimple.toolkits.callgraph.CallGraph;
import soot.options.Options;
public class main
{
public static void configure(String classpath)
{
Options.v().set_verbose(false);
Options.v().set_keep_line_number(true);
Options.v().set_src_prec(Options.src_prec_only_class);
Options.v().set_soot_classpath(classpath);
Options.v().set_prepend_classpath(true);
Options.v().set_allow_phantom_refs(true);
Options.v().set_whole_program(true);
}
public static void main(String[] args) throws FileNotFoundException
{
G.reset();
// code copied from Scene.getDefaultClasspath
StringBuffer sb = new StringBuffer();
sb.append("D:\\averroes\\TracingTest\\output\\organizedApplication.jar");
sb.append(File.pathSeparator);
sb.append("D:\\averroes\\TracingTest\\output\\placeholderLibrary.jar"); configure(sb.toString());
// Do not load standard JRE classes
// Scene.v().loadBasicClasses(); SootClass sootClass = Scene.v().forceResolve("Main", SootClass.BODIES);
sootClass.setApplicationClass(); // Do not load standard JRE classes
// Scene.v().loadNecessaryClasses();
// CHA
//CHATransformer.v().transform();
// SPARK
HashMap<String, String> opt = new HashMap<String, String>();
opt.put("enabled", "true");
opt.put("verbose", "true");
opt.put("propagator", "worklist");
opt.put("simple-edges-bidirectional", "false");
opt.put("on-fly-cg", "true");
opt.put("set-impl", "double");
opt.put("double-set-old", "hybrid");
opt.put("double-set-new", "hybrid");
opt.put("whole-program", "true");
SparkTransformer.v().transform("", opt);
CallGraph g = Scene.v().getCallGraph();
}
}
}
The System.class file generated by averroes does not contain the System.err field indeed:
/* compiled from Jasmin */ public final static java.io.PrintStream out; public System()
{
0 aload_0;
1 invokespecial 19; /* java.lang.Object() */
4 aload_0;
5 putstatic 26; /* ca.uwaterloo.averroes.Library.libraryPointsTo */
8 invokestatic 13; /* void ca.uwaterloo.averroes.Library.doItAll() */
11 return;
}
Is this a bug of averroes? If I don't use it and let SPARK analyze the real Java Runtime Library, I get no errors.
Here's a link to an archive containing all the relevant files:
https://drive.google.com/file/d/0B1gS1nNBmRjaVTRhVWV4TE93NjQ
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150504/03f52214/attachment.html
More information about the Soot-list
mailing list