[Soot-list] Re: get java source statements from soot

Gerald Sit Gerald.Sit at student.cityu.edu.hk
Tue Aug 19 00:33:26 EDT 2008


Should it be called with "java soot.Main MyMain" in command line? If it does my result does not involve the those output I want..

Soot started on Tue Aug 19 12:24:40 CST 2008
Transforming soot.Main...
Writing to sootOutput\soot\Main.class
Soot finished on Tue Aug 19 12:24:45 CST 2008
Soot has run for 0 min. 22 sec.

I'm using Windows Vista command line with soot 2.2.5 right now, tried on Windows XP SP3 but it doesn't work either.

> You must be doing something wrong, I am just not sure what. The
> following class works perfectly fine for me:
> 
> /* Soot - a J*va Optimization Framework
> 
>  * Copyright (C) 2008 Eric Bodden
> 
>  *
> 
>  * This library is free software; you can redistribute it and/or
> 
>  * modify it under the terms of the GNU Lesser General Public
> 
>  * License as published by the Free Software Foundation; either
> 
>  * version 2.1 of the License, or (at your option) any later version.
> 
>  *
> 
>  * This library is distributed in the hope that it will be useful,
> 
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
> 
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> 
>  * Lesser General Public License for more details.
> 
>  *
> 
>  * You should have received a copy of the GNU Lesser General Public
> 
>  * License along with this library; if not, write to the
> 
>  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> 
>  * Boston, MA 02111-1307, USA.
> 
>  */
> 
> import java.util.Map;
> 
> 
> 
> import soot.Body;
> 
> import soot.BodyTransformer;
> 
> import soot.G;
> 
> import soot.PackManager;
> 
> import soot.Transform;
> 
> 
> 
> public class MyMain {
> 
> 
> 
>        public static void main(String[] args) {
> 
>                PackManager.v().getPack("jtp").add(
> 
>                                new Transform("jtp.myTransform", new BodyTransformer() {
> 
> 
> 
>                                        protected void internalTransform(Body body, String phase, Map options) {
> 
>                                                G.v().out.println("Hello World");
> 
>                                        }
> 
> 
> 
>                                }));
> 
> 
> 
>                soot.Main.main(args);
> 
>        }
> 
> 
> 
> }
> 
> 
> This prints the following to the shell if invoked with the argument
> class "soot.Main" (or any other class):
> 
> Soot started on Mon Aug 18 07:56:09 GMT-05:00 2008
> Transforming soot.Main...
> Hello World
> Hello World
> Hello World
> Hello World
> Hello World
> Hello World
> Hello World
> Hello World
> Hello World
> Writing to sootOutput/soot/Main.class
> 
> Eric


More information about the Soot-list mailing list