[Soot-list] Create CFG problem

Gias Uddin gias98 at gmail.com
Tue Aug 27 01:09:15 EDT 2013


That did not solve my problem, though :-(

[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: This operation
requires resolving level BODIES but java.lang.Object is at resolving
level SIGNATURES
If you are extending Soot, try to add the following call before
calling soot.Main.main(..):
Scene.v().addBasicClass(java.lang.Object,BODIES);
Otherwise, try whole-program mode (-w).
at soot.SootClass.checkLevel(SootClass.java:125)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:314)
at soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyCallGraphBuilder.java:532)
at soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.java:427)
at soot.jimple.spark.solver.OnFlyCallGraph.build(OnFlyCallGraph.java:55)
at soot.jimple.spark.builder.ContextInsensitiveBuilder.build(ContextInsensitiveBuilder.java:77)
at soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:84)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at ca.mcgill.cs.swevo.recfeat.jars.MethodCallGraph.createCallGraph(MethodCallGraph.java:79)
at ca.mcgill.cs.swevo.recfeat.jars.MethodCallGraph.main(MethodCallGraph.java:162)

Once again: here is my code - if somebody can help me.
==========================================================
public void createCallGraph(String className, String methodName)
{
Scene scene = Scene.v();
String classPaths = "/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:"
+"/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:"
+ "/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:"
+ "/temp/jars/joda-time-2.3.jar";
scene.setSootClassPath(classPaths);
SootClass sootClass = scene.loadClass(className,
SootClass.BODIES);//.loadClassAndSupport(className);
sootClass.setLibraryClass();
scene.loadBasicClasses();
scene.loadNecessaryClasses();
soot.options.Options.v().set_whole_program(true);

// SootResolver.v().resolveClass("org.joda.time.field.FieldUtils",
SootClass.SIGNATURES);
// SootResolver.v().resolveClass("java.lang.Object", SootClass.BODIES);
// SootResolver.v().resolveClass("org.joda.time.chrono.BasicChronology",
SootClass.BODIES);


Scene.v().setEntryPoints(sootClass.getMethods());
HashMap<String,String> sparkOptions = new HashMap<String,String>();
sparkOptions.put("enabled", "true");
sparkOptions.put("on-fly-cg", "true");
sparkOptions.put("set-impl", "hybrid");
sparkOptions.put("propagator", "worklist");
sparkOptions.put("verbose", "true");
SparkTransformer.v().transform("cg", sparkOptions);

SootMethod sMethod = sootClass.getMethod(methodName);
CallGraph callGraph = scene.getCallGraph();
Iterator iter = callGraph.edgesOutOf((MethodOrMethodContext)sMethod);

while (iter.hasNext()) {
System.out.println(iter.next());
}
}

public static void main(String[] args)
{

String className = "org.joda.time.chrono.CopticChronology";
String methodName = "public int getMinimumDaysInFirstWeek()";
MethodCallGraph methodCallGraph = new MethodCallGraph();
methodCallGraph.createCallGraph(className, methodName);
}

On Tue, Aug 27, 2013 at 1:02 AM, Christoph Dörr <Chris.Doerr at gmx.de> wrote:
> Oh, sorry, my fault. Indeed, I did not use the github version, but
> downloaded the latest nightly build from:
> http://vandyk.st.informatik.tu-darmstadt.de/abc/
>
>
> Am 27.08.2013 06:25, schrieb Gias Uddin:
>
>> I managed to have a successful build of the recent develop version of
>> soot using the following command: ant -lib libs/
>> where
>> ~/dev/soot/soot$ ls libs
>> AXMLPrinter2.jar  baksmali-1.3.2.jar  baksmali-2.0b5.jar
>> dexlib2-2.0b5-dev.jar  heros-trunk.jar  jasminclasses-2.5.0.jar
>> junit.jar  polyglot.jar
>>
>> However, this build did not produce any soot-trunk.jar file as it was
>> expected to produce.
>> One more thing, I don't see any soot-2.5.2 tag in github repo.
>>
>> - Gias
>>
>>
>> On Mon, Aug 26, 2013 at 11:15 PM, Gias Uddin <gias98 at gmail.com> wrote:
>>>
>>> Christoph, thanks for the reply.
>>> I tried to build the developer version of soot from git using the
>>> instructions in this link: https://github.com/Sable/soot/issues/71
>>> It failed:
>>>
>>> ....
>>>      [javac]     E extends Object declared in class ArrayList
>>>      [javac]
>>> /home/gias/dev/soot/soot/src/soot/util/JasminOutputStream.java:35:
>>> error: package jasmin does not exist
>>>      [javac]         jasmin.Main.assemble(bais, out, false);
>>>      [javac]               ^
>>>      [javac] Note: Some input files additionally use or override a
>>> deprecated API.
>>>      [javac] Note: Some input files use unchecked or unsafe operations.
>>>      [javac] Note: Recompile with -Xlint:unchecked for details.
>>>      [javac] 2 errors
>>>      [javac] 100 warnings
>>>
>>> BUILD FAILED
>>> /home/gias/dev/soot/soot/build.xml:24: Compile failed; see the
>>> compiler error output for details.
>>>
>>> Total time: 22 seconds
>>>
>>> Any idea?
>>>
>>> Thanks again,
>>> - Gias
>>>
>>> On Mon, Aug 26, 2013 at 7:29 PM, Christoph Dörr <Chris.Doerr at gmx.de>
>>> wrote:
>>>>
>>>> To have a guess:
>>>>
>>>> I got (not the same but) similar error shortly and was able to fix it
>>>> with
>>>> updating from Soot 2.5.0 to 2.5.2 (from github).
>>>>
>>>> Am 27.08.2013 00:09, schrieb Gias Uddin:
>>>>>
>>>>> I am trying to create Call Graph of a given method (code below).
>>>>>
>>>>> I get error:
>>>>> -------------------------
>>>>> [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: This operation
>>>>> requires resolving level BODIES but java.lang.Object is at resolving
>>>>> level SIGNATURES
>>>>> If you are extending Soot, try to add the following call before
>>>>> calling soot.Main.main(..):
>>>>> Scene.v().addBasicClass(java.lang.Object,BODIES);
>>>>> Otherwise, try whole-program mode (-w).
>>>>> ...
>>>>>
>>>>> My code:
>>>>> ---------------------------
>>>>> public void createCallGraph(String className, String methodName)
>>>>> {
>>>>> Scene scene = Scene.v();
>>>>> String classPaths = "/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:"
>>>>> +"/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:"
>>>>> + "/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:"
>>>>> + "/temp/jars/joda-time-2.3.jar";
>>>>> scene.setSootClassPath(classPaths);
>>>>> SootClass sootClass = scene.loadClassAndSupport(className);
>>>>> //sootClass.setLibraryClass();
>>>>> scene.loadBasicClasses();
>>>>> scene.loadNecessaryClasses();
>>>>> soot.options.Options.v().set_whole_program(true);
>>>>>
>>>>> Scene.v().setEntryPoints(sootClass.getMethods());
>>>>> HashMap<String,String> sparkOptions = new HashMap<String,String>();
>>>>> sparkOptions.put("enabled", "true");
>>>>> sparkOptions.put("on-fly-cg", "true");
>>>>> sparkOptions.put("set-impl", "hybrid");
>>>>> sparkOptions.put("propagator", "worklist");
>>>>> sparkOptions.put("verbose", "true");
>>>>> SparkTransformer.v().transform("cg", sparkOptions);
>>>>>
>>>>> SootMethod sMethod = sootClass.getMethod(methodName);
>>>>> CallGraph callGraph = scene.getCallGraph();
>>>>> Iterator iter = callGraph.edgesOutOf((MethodOrMethodContext)sMethod);
>>>>>
>>>>> while (iter.hasNext()) {
>>>>> System.out.println(iter.next());
>>>>> }
>>>>> }
>>>>>
>>>>> public static void main(String[] args)
>>>>> {
>>>>> String className = "org.joda.time.chrono.CopticChronology";
>>>>> String methodName = "public int getMinimumDaysInFirstWeek()";
>>>>> MethodCallGraph methodCallGraph = new MethodCallGraph();
>>>>> methodCallGraph.createCallGraph(className, methodName);
>>>>> }
>>>>>
>>>>> Am I doing anything wrong?
>>>>>
>>>>> -Gias
>>>>> _______________________________________________
>>>>> Soot-list mailing list
>>>>> Soot-list at sable.mcgill.ca
>>>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>>>
>>>>
>


More information about the Soot-list mailing list