[Soot-list] BafBody or JimpleBody?

Sai Zhang racezhang at gmail.com
Fri May 28 03:47:05 EDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100528/2793ef84/attachment.html 


More information about the Soot-list mailing list