[Soot-list] Getting the transformed Jimple and bytecode files after running some tranformers

Marc-André Laverdière-Papineau marc-andre.laverdiere-papineau at polymtl.ca
Mon Apr 22 12:37:51 EDT 2013


Glad you got that sorted out, but I encourage you to switch to Soot 
main. The troubleshooting can get pretty hard for more complicated cases.

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 13-04-22 12:04 PM, ASHISH MISHRA wrote:
> Thanks,
>
> I got the solution, FYI, I needed to explicitly call the
> PackManager.v().writeOutput(); in my MainDriver . Its called in
> soot.main.Main() internally.
>
> Its solved the issue .
>
> regards
> Ashish.
>
>
> On Mon, Apr 22, 2013 at 9:27 PM, ASHISH MISHRA
> <ashish123.mishragkp at gmail.com <mailto:ashish123.mishragkp at gmail.com>>
> wrote:
>
>     Hi Marc,
>
>     I tried running same file say abc.java with two approaches -
>
>     1) soot.Main.main(args)- This generated the sootOutput/abc.jimple
>     2) PackManager.v().runPacks(options)  - This didnt produce the
>     jimple output .
>
>
>     Now looking at the Main.main() - Internally it calls the same
>     runPacks(), so I am not able to figure out the problem.Secondly what
>     is the way about  to get the jimple with the runpacks(). Is this an
>     issue with runPacks().
>
>     regards
>
>
>
>
>     On Mon, Apr 22, 2013 at 9:03 PM, ASHISH MISHRA
>     <ashish123.mishragkp at gmail.com
>     <mailto:ashish123.mishragkp at gmail.com>> wrote:
>
>         Hi Marc,
>         As far as I can see, I have used appropriate flags for
>         generating output, I have customized entry points and I am
>         running soot from-
>         PackageManager.v().runPacks() instead of usual
>         soot.Main.main(options)
>
>         Is this the reason for the same.
>
>         Here is what I am trying to do in concise form
>
>         public static void main(String[] args) {
>           final String main_inputclass= args[0];
>         final String xmlinput_class = args[2];
>         final String resource = args[1];
>         List<String> argList= new ArrayList<String>(Arrays.asList(args));
>         String[] soot_options = new String[]{
>         "-w",
>         "-pp",
>         "-p",
>         "jb",
>         "use-original-names:true",
>         "-cp",
>         ".",
>         "-main-class",
>         args[0],
>         //"-app",
>         args[0],
>         "-allow-phantom-refs",
>         "-f",
>         "jimple"
>         };
>         argList.addAll(Arrays.asList(soot_options));
>         soot.Transform preprocessingTransfrom = new
>         soot.Transform("wjpp.refresolve", new SceneTransformer() {
>         @Override
>         protected void internalTransform(String phaseName, Map options) {
>         // TODO Auto-generated method stub
>         System.out.println("Performing String Analysis on the whole
>         application "+ main_inputclass);
>         *//Call to another soot analysis here *
>         }
>         });
>         soot.Transform inlineTransform= new
>         soot.Transform("jtp.rfinline",  new BodyTransformer() {
>         @Override
>         protected void internalTransform(Body b, String phaseName, Map
>         options) {
>         // TODO Auto-generated method stub
>         //perform some Body Transformations here using the results of
>         the first analysis
>         }
>         });
>         //add the Transformer to the wjpp phase
>         Pack wjpppack = PackManager.v().getPack("wjpp");
>         wjpppack.add(preprocessingTransfrom);
>         //add the body transformer to the jtp phase
>         PackManager.v().getPack("jtp").add(inlineTransform);
>         //load all the classes
>         Options.v().parse(soot_options);
>         Scene.v().forceResolve(args[0], SootClass.BODIES);
>         SootClass c =Scene.v().loadClassAndSupport(args[0]);
>         c.setApplicationClass();
>         Scene.v().getSootClass("java.util.Iterator");
>         Scene.v().loadNecessaryClasses();
>         //get the entry method , if it is not main
>         SootMethod m1= null;
>         try{
>         m1 = c.getMethodByName("doStruff");
>         }catch (Exception e) {
>         // TODO: handle exception
>         e.printStackTrace();
>         m1 = c.getMethodByName("main");
>         }
>         //soot.Main.main(soot_options);
>         //run the soot
>         List entryPoints= new ArrayList();
>         entryPoints.add(m1);
>         Scene.v().setEntryPoints(entryPoints);
>         PackManager.v().runPacks();
>         }
>
>         }
>
>         If runPacks() is the reason of the problem ?Is there a way  to
>         run the Analsysis using runPacks and still get the output jimple?
>
>
>
>
>
>         On Mon, Apr 22, 2013 at 8:19 PM, Marc-André Laverdière-Papineau
>         <marc-andre.laverdiere-papineau at polymtl.ca
>         <mailto:marc-andre.laverdiere-papineau at polymtl.ca>> wrote:
>
>             Hello,
>
>             I never had problem turning jimple output on or off. Have
>             you used those
>             flags indicated here?
>
>             http://www.sable.mcgill.ca/soot/tutorial/usage/usage.html#SECTION00043000000000000000
>
>
>             Marc-André Laverdière-Papineau
>             Doctorant - PhD Candidate
>
>             On 13-04-22 06:58 AM, ASHISH MISHRA wrote:
>              > Hi All,
>              >
>              > I ran a wjpp transform and a jtp transform on some input
>             files, and
>              > modified the jimple intermediate for some of the methods.
>             I can print
>              > the modified Jimple Body but am not getting the modified
>             jimple in
>              > *sootOutput.*
>              > *
>              > *
>              > *I aim at calling a Call Graph constructor like Paddle or
>             Spark and
>              > provide it the modified jimple from the first run. How
>             this can be done
>              > please help. Do I need to  write the modified Jimple to
>             some file
>              > explicitly.*
>              > *
>              > *
>              > *
>              > *
>              >
>              > --
>              > Regards,
>              > Ashish Mishra
>              > Graduate Student,
>              > Computer Science and Automation Department,IISc
>              > Cell : +91-9611194714
>              > Mailto : ashishmishra at csa.iisc.ernet.in
>             <mailto:ashishmishra at csa.iisc.ernet.in>
>              > <mailto:ashishmishra at csa.iisc.ernet.in
>             <mailto:ashishmishra at csa.iisc.ernet.in>>
>              >
>              >
>              >
>              > _______________________________________________
>              > Soot-list mailing list
>              > Soot-list at sable.mcgill.ca <mailto:Soot-list at sable.mcgill.ca>
>              > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>              >
>             _______________________________________________
>             Soot-list mailing list
>             Soot-list at sable.mcgill.ca <mailto:Soot-list at sable.mcgill.ca>
>             http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
>
>
>         --
>         Regards,
>         Ashish Mishra
>         Graduate Student,
>         Computer Science and Automation Department,IISc
>         Cell : +91-9611194714
>         Mailto : ashishmishra at csa.iisc.ernet.in
>         <mailto:ashishmishra at csa.iisc.ernet.in>
>
>
>
>
>     --
>     Regards,
>     Ashish Mishra
>     Graduate Student,
>     Computer Science and Automation Department,IISc
>     Cell : +91-9611194714
>     Mailto : ashishmishra at csa.iisc.ernet.in
>     <mailto:ashishmishra at csa.iisc.ernet.in>
>
>
>
>
> --
> Regards,
> Ashish Mishra
> Graduate Student,
> Computer Science and Automation Department,IISc
> Cell : +91-9611194714
> Mailto : ashishmishra at csa.iisc.ernet.in
> <mailto:ashishmishra at csa.iisc.ernet.in>
>


More information about the Soot-list mailing list