[Soot-list] Scene.v().getClasses = empty. How cand I load classes in the Scene without exceptions?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Tue Apr 20 03:49:54 EDT 2010


Hi Cristina. You should maybe read our tutorials, specifically
http://www.bodden.de/2008/09/22/soot-intra/

The problem is that you never call soot.Main.main(..);

The way you should normally use Soot is as follows:

1.) Add transformers to Soot. These will be run *later*, after calling
soot.Main.main(..).
2.) Modify the command-line parameters to Soot if needed.
3.) Call soot.Main.main(args) with "args" being an array holding these
modified parameters.

In general I recommend not using loadClassAndSupport(..) (I actually
wonder where people get this from.) but instead running all the
necessary code from within a transformer if possible.

Eric

--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 19 April 2010 23:00, Cristina Ilie <crysgirlro at yahoo.com> wrote:
> Hello,
>
> I extend soot in a project. I introduced a jtp phase:
>             Pack jtp = PackManager.v().getPack("jtp");
>             jtp.add(new Transform("jtp.ad", new
> ADiJaCForwardBodyInstrumenter()));
> and in ADiJaCForwardBodyInstrumenter I load java.lang.Math:
>             static {
>                 mathClass = Scene.v().loadClassAndSupport("java.lang.Math");
>                absFltMethodHandler = mathClass.getMethod("float
> abs(float)");
>                acosMethodHandler = mathClass.getMethod("double
> acos(double)");
>
> .......................................................................................................
> // other methods
>             }
>
> The problem is that at this point in Scene no class is loaded.
> G.v().out.println(Scene.v().getClasses()) returns []. I see
> loadClassAndSupport iterates on a worklist which contains necessary classes
> and the classes given in the command line. But Scene is empty and
> SootResolver throws an exception (line 174). I tried also with
> loadBasicClass in my Main and Scene.v().getClass("java.lang.Math") in
> "static { ...}" but it doesn't work.
>
> In internalTransform Scene.v().getClasses() returns all the needed classes,
> including my test class (AppSource). I guess this code performs after the
> code "static {..}". How can I load the classes in the Scene without
> exceptions?
>
> Thanks,
> Cristina
>
>
> _______________________________________________
> 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