[Soot-list] BafBody or JimpleBody?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Fri May 28 07:01:46 EDT 2010


Hi Sai.

The problem appears to be that BodyTransformers are executed all in a
row, one method after the other. Depending on whether or not it
executes on the current body before it executes for the other method,
you will either get a jimple body or a baf body. This was discussed
just a few weeks ago:
http://www.sable.mcgill.ca/pipermail/soot-list/2010-April/002878.html

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 28 May 2010 09:47, Sai Zhang <racezhang at gmail.com> wrote:
>
> Hi all:
>
> I met a pretty confusing problem in using soot's BodyTransformer:
>
> The code extends the soot.Body.BodyTransformer class, and overrides
> the following methods.
>
>     protected void internalTransform(Body body, String phaseName, Map
> options) {
>         //code skeleton
>        SootClass c = body.getMethod().getDeclaringClass();
>        SootMethod m = findAMethod(c, body.getMethod);   //  find another
> method in the declaring class c
>        Body body = m.getBody();     //what type is this body variable, when
> using different options???
>     }
>
> The code implementation inside the above method did pretty sophisticated
> program
> transformations, such as copy the (jimple) instructions from one method to
> another method.
>
> I use the following command line to start soot:
> PackManager.v().getPack("jtp").add(new Transform("jtp.instrumenter",
> instrumenter));
> options:  -f jimple -w
>
> Everything works fine, and produce the correct jimple file!
>
> However, the "strange" thing happens if I change the options to be -w
> (remove the -f jimple to generate class file).
> The code does not work anymore.
>
> I debug through the implementation, and found the type of body in the
> overriden
> method  "protected void internalTransform(Body body, String phaseName, Map
> options) {  }"
> turns out be BafBody (it was JimpleBody when using -f jimple options).
>
> I guess the SootMethod which I get through findAMethod(c, body.getMethod);
> has
> already been translated into Baf. I am very uncertain about that. But feel
> strange enough
> on this point! I am note quite familiar with the Jimple-Baf translation
> procedure. Does soot
> translate each method one by one, or trasnlate all methods at once (after
> finishing the jimple phase)?
>
> Does anyone met this weird problem before, point help me out.
>
> thanks
>
> - Sai
>
> _______________________________________________
> 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