[Soot-list] java.lang.RuntimeException: cannot set body for non-concrete method!
Andrea Mattavelli
andrea.mattavelli at usi.ch
Mon Jan 21 09:36:52 EST 2013
Hi Michael,
unfortunately I've just realized that the last message exchanged with Eric is not on Soot-list.
I fixed the same problem by invoking soot.main.Main(…) and then getting the result by means of a SceneTransformer.
Here it is a naive example that I used some time ago:
public static void main(String args[]){
soot.options.Options.v().set_soot_classpath(...);
soot.options.Options.v().set_whole_program(true);
soot.options.Options.v().allow_phantom_refs();
soot.options.Options.v().setPhaseOption("jb","use-original-names:true");
PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {
@Override
protected void internalTransform(String arg0, Map arg1) {
…
soot.Scene.v().getCallGraph();
…
}
}));
soot.Main.main(new String[]{
"-f", "none",
"-main-class", "com.google.javascript.jscomp.CommandLineRunner",
"-process-dir", ".../closure-compiler/build/classes"
});
}
Hope this could help.
_________________________
Andrea Mattavelli
PhD Student
Faculty of Informatics
University of Lugano
via G. Buffi 13
CH-6900 Lugano - Switzerland
email: andrea.mattavelli at usi.ch<mailto:andrea.mattavelli at usi.ch>
phone: +41 58 666 4312
http://star.inf.usi.ch<http://star.inf.usi.ch/>
On 21-gen-2013, at 15:05, Michael Faes <rolve at trick17.ch<mailto:rolve at trick17.ch>> wrote:
Hi everyone,
I'm using Soot for a deadlock analysis tool and I'm encountering the
following exception:
java.lang.RuntimeException: cannot set body for non-concrete method!
<micro.chain.Service4: void doSomething()>
at soot.SootMethod.setActiveBody(SootMethod.java:338)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:322)
at ...OnFlyCallGraphBuilder.processNewMethod(...)
at ...OnFlyCallGraphBuilder.processReachables(...)
at ...CallGraphBuilder.build(CallGraphBuilder.java:84)
at ...CHATransformer.internalTransform(CHATransformer.java:43)
at soot.SceneTransformer.transform(SceneTransformer.java:39)
at soot.Transform.apply(Transform.java:89)
at soot.RadioScenePack.internalApply(RadioScenePack.java:57)
at ...CallGraphPack.internalApply(CallGraphPack.java:49)
at soot.Pack.apply(Pack.java:114)
at soot.PackManager.runWholeProgramPacks(PackManager.java:412)
at soot.PackManager.runPacks(PackManager.java:336)
at deadlockfinder.DeadlockFinder.findDeadlocks(DeadlockFinder.java:98)
The Service4 interface is very simple:
public interface Service4 {
void doSomething();
void doSomethingElse();
}
I found another message on this list that is probably about the same
issue
(http://www.sable.mcgill.ca/pipermail/soot-list/2012-January/004055.html) but
the answers didn't help me.
I don't use the Soot main method as I am loading classes and setting
custom entry points before running the packs. Here is what my main
method roughly looks like:
-----------------------------------------------------------
final soot.options.Options opts = soot.options.Options.v();
final Scene scene = Scene.v();
opts.set_output_format(soot.options.Options.output_format_none);
opts.set_via_shimple(true);
opts.set_whole_program(true);
opts.set_whole_shimple(true);
opts.set_omit_excepting_unit_edges(true);
opts.set_no_bodies_for_excluded(true);
opts.set_allow_phantom_refs(true);
opts.set_exclude(Arrays.asList("java.", "javax."));
List<String> classes = ...
opts.parse(classes.toArray(
new String[classes.size()]));
for(final Object name : opts.classes())
scene.forceResolve((String) name, SootClass.BODIES);
final String[] additionalClasses =
new String[]{"java.util.concurrent.locks.Lock"};
for(final String className : additionalClasses)
scene.forceResolve(className, SootClass.SIGNATURES);
scene.loadNecessaryClasses();
scene.setEntryPoints(SootUtils.allPublicMethods());
scene.setDefaultThrowAnalysis(new NoVmErrorsThrowAnalysis());
final LogConstructor logConstructor = new LogConstructor(options);
final LogCyclesFinder logCycles = new LogCyclesFinder(logConstructor);
PackManager.v().getPack("wstp").add(
new Transform("wstp.logconstruct", logConstructor));
PackManager.v().getPack("wstp").add(
new Transform("wstp.logcycles", logCycles));
PackManager.v().runPacks();
-----------------------------------------------------------
I understand that the allow_phantom_refs option may cause this problem,
but I can't disable it as the analysis would take far too long if the
JDK was included.
Am I doing something wrong or is this a bug? Can I somehow circumvent
it? Any help is much appreciated.
Thanks,
Michael
_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca<mailto:Soot-list at sable.mcgill.ca>
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
More information about the Soot-list
mailing list