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

Bodden, Eric eric.bodden at sit.fraunhofer.de
Fri Apr 19 05:32:27 EDT 2013


Hi Saswat.

The class should have a static initializer method <clinit> containing the code you are looking for.

Eric

On 18.04.2013, at 23:19, 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

--
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering Group at 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