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

ASHISH MISHRA ashish123.mishragkp at gmail.com
Mon Apr 22 11:33:35 EDT 2013


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> 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>
> >
> >
> >
> > _______________________________________________
> > Soot-list mailing list
> > 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
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130422/9ca2eadf/attachment-0001.html 


More information about the Soot-list mailing list