[Soot-list] Traversing the static Instructions of a class which has no methods

Saswat Anand saswat78 at gmail.com
Thu Apr 18 17:38:03 EDT 2013


You should look for AssignStmt's whose getLeftOp() correspond to the
static fields in the <clinit> method of a class. Printing the jimple
code may be helpful.

On Thu, Apr 18, 2013 at 2:19 PM, ASHISH MISHRA
<ashish123.mishragkp at gmail.com> wrote:
> Dear All,
>
> I have a situation similar to this
>
> public final class A {
>     public static final class B {
>        public static final string ab = "teststring";
>     }
>     public static final class C {
>         public static final int cd=23;
>     }
>     public static final class D{
>        public static final String ef = "teststring2";
>        public static final int gh=34;
>     }
>
> }
>
> I need to traverse all the field and the Instructions to collect the Fields
> and their values -
>  like ab- teststring etc.
>
> I get all the classes using
> Chain<SootClass> sclist = Scene.v().getApplicationClasses();
> for(SootClass sc : sclist){
> Chain<SootField> sflist = sc.getFields();
> for(SootField sf : sflist){
> System.out.println("Sig "+sf.getSignature()+"name "+ sf.getNeme() );
> }
> }
>
> I can get the declared fields in the classes , but I could not get the
> instructions and the RHS value for them. I tried looking for the issue in
> soot-list but no success. Please help.
>
>
>
>
>
>
>
>
> --
> Regards,
> Ashish Mishra
> Graduate Student,
> Computer Science and Automation Department,IISc
> Cell : +91-9611194714
> 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
>


More information about the Soot-list mailing list