[Soot-list] Problem in references of fields and methods

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Tue Mar 1 10:57:57 EST 2011


Hello Rasika.

The steps you propose sound reasonable (although I am not quite sure
what purpose your code transformations have). So what are your actual
questions?

About the code you sent: In your case, I would strongly suggest to use
a SceneTransformer instead of a BodyTransformer. (You would have to
add the SceneTransformer to the "wjpt" pack and enable that pack using
-w on the command line.) BodyTransformers are executed once for each
method body and hence it is not a good idea to alter the number of
method bodies (e.g. by adding methods) at the same time: Soot will
likely crash on realistic programs.

In the SceneTransformer (which is executed just once) you can use
Scene.v().getApplicationClasses() to retrieve a list of all the
classes of the analyzed programs. Then you can safely manipulate all
those classes and their methods. Using this approach, there's also no
need to write any code to write these changes back to disk: Soot will
automatically write out all class files after the modification of the
Scene has finished.

Eric

-- 
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt


More information about the Soot-list mailing list