[Soot-list] How to transform a Grimp file into class file

Bodden, Eric eric.bodden at sit.fraunhofer.de
Mon Oct 28 04:53:51 EDT 2013


Hi.

Please try the -via-grimp option:
http://www.sable.mcgill.ca/soot/tutorial/usage/

This should give you GrimpBody instances in general, which can then hold Grimp instructions.

Cheers,
Eric


On 24.10.2013, at 23:43, Yongzhi Wang <wang.yongzhi2009 at gmail.com> wrote:

> Dear All,
> 
> I want to transform java program into a class file with some manipulations. My original transformation step is as follows. The transformation is performed in "jtp" step.
> 
> Java --> Jimple --> class
> 
> However, since Jimple can only accommodate three operators in each expression. I create some Grimp expressions (using Grimp.v().newXXX() function) during the java to jimple transformation. Therefore, the generated jimple file contains statements containing more than three operators. When I transform the generated Jimple into class, I got the following error.
> 
> My question is how can I transform my generated jimple file (containing multiple operators) into class file? Or I simply shouldn't use the Grimp.v().newXXX() functions in the jtp transformation step? I know I can transform the generated expressions into jimple standard three operator format. However, I just want to see if there's any quicker way as I tried.
> 
> java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at ca.mcgill.sable.soot.launching.SootThread.run(SootThread.java:138)
> Caused by: java.lang.ClassCastException: soot.grimp.internal.GAddExpr cannot be cast to soot.jimple.ConvertToBaf
> 	at soot.jimple.internal.AbstractStaticInvokeExpr.convertToBaf(AbstractStaticInvokeExpr.java:135)
> 	at soot.jimple.internal.JIfStmt.convertToBaf(JIfStmt.java:277)
> 	at soot.baf.BafBody.<init>(BafBody.java:104)
> 	at soot.baf.Baf.newBody(Baf.java:560)
> 	at soot.PackManager.runBodyPacks(PackManager.java:793)
> 	at soot.PackManager.runBodyPacks(PackManager.java:463)
> 	at soot.PackManager.runBodyPacks(PackManager.java:380)
> 	at soot.PackManager.runPacks(PackManager.java:357)
> 	at soot.Main.run(Main.java:198)
> 	at soot.Main.main(Main.java:141)
> 
> Thanks!
> 
> Yongzhi
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering  at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt



More information about the Soot-list mailing list