[Soot-list] Adding transformations before a whole-program pack

Eric Bodden eric.bodden at mail.mcgill.ca
Wed Jan 31 21:48:26 EST 2007


Hi all.

Peng Li asked me this week how to add a transformation before any whole program analysis is applied. I thought that should be pretty easy but as I just found out, it is rather tricky. So here's a how-to.

First of all, in The Soot PLDI tutorial [1], page 100, you see Soot's packs. So you would think that adding a transform to the "jb" pack should work. Yes, but that won't work, because no matter what you add to the pack, it won't be executed. The pack is hardcoded. -> IS THAT A BUG? I would say so...

So all you can do is add it to the cg pack, at the *front*:

PackManager.v().getPack("cg").insertBefore(new Transform("cg.test", MyTest.v()), "cg.cha");

This works. However, here MyTest has to be a SceneTransformer and cannot be a body transformer. Hence, one has to iterate over all possible bodies manually :-/

Also, in order to enable the "cg" phase at all, you have to give the "-w" option on the Soot command line. AND the phase name "cg.test", you chose HAS TO START WITH THE PREFIX "cg". Otherwise you get weird errors.

I am not at all sure why this was designed that way, but apparently it is. I think this needs fixing. Can anybody of the more senior Soot developers comment on that?

@Peng: I have attached modified versions of the files you sent me. This should work now.

Eric

[1] http://www.sable.mcgill.ca/soot/tutorial/pldi03/tutorial.pdf

--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iter.java
Type: application/octet-stream
Size: 801 bytes
Desc: iter.java
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20070131/d9332dec/iter.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.java
Type: application/octet-stream
Size: 433 bytes
Desc: test.java
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20070131/d9332dec/test.obj


More information about the Soot-list mailing list