[Soot-list] Fwd: getting method active body

suraj kath surajkath108 at gmail.com
Sat Feb 26 02:50:09 EST 2011


---------- Forwarded message ----------
From: suraj kath <surajkath108 at gmail.com>
Date: Fri, Feb 25, 2011 at 10:10 AM
Subject: getting method active body
To: soot-list at sable.mcgill.ca


hi there,

actually i am a new user to soot.
i was trying to get active body of the method but i am unable
below is a small piece of code that i used
could u please let me know what is wrong with this code.


how can i get active body of method
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110225/af3eb844/attachment-0001.html 
-------------- next part --------------
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcs;

import java.util.Iterator;

import soot.*;
import soot.jimple.*;
import soot.options.Options;
import soot.util.*;
import java.io.*;
import java.util.*;
import soot.Body;
import soot.G;
import soot.Scene;
import soot.SootClass;
import soot.SootField;
import soot.SootMethod;
import soot.javaToJimple.ClassLiteralMethodSource;

public class Main {
	public static void main(String[] args)throws FileNotFoundException,IOException {

		Scene.v().setSootClassPath("E:\\classfiles;C:\\Program Files\\Java\\jre6\\lib\\rt.jar;C:\\Program Files\\Java\\jre6\\lib\\jce.jar");


                soot.Main.main(args);

                Scene scene = G.v().soot_Scene();



               


		      SootClass c = (SootClass)scene.loadClassAndSupport("abc");

                      System.out.println(c.containsBafBody());

                      c.setInScene(true);
                      c.setApplicationClass();
                      System.out.println("class : " + c.getName());



                       SootMethod m1=c.getMethod("void func()");


               


                

                    


                     try
                    {

                        System.out.println("the name is "+m1.toString());

                     }
                    catch(Exception e)
                    {
                        e.printStackTrace();
                    }

		 
                       
                    System.out.println("the source is "+m1.getSource());

                       System.out.println("body is "+m1.hasActiveBody());
                 //why has active body is showing false   
                 
	}


}



More information about the Soot-list mailing list