[Soot-list] getting jimple bodies from soot methods
Jennifer Lhotak
jlhotak at cs.mcgill.ca
Thu Jun 9 22:36:50 EDT 2005
Hi,
You could use sm.retrieveActiveBody() which will create the body if
necessary and will return the active body.
Jennifer
On Thu, 9 Jun 2005, Suhabe Bugrara wrote:
> Hi,
>
> I'm trying to access the JimpleBody of a SootMethod in the code snippet
> below, but I get the following runtime exception when I call
> "getActiveBody" on the SootMethod object. I can't figure out what else I
> need to do to get JimpleBody's set in the SootMethods.
>
> Suhabe
>
> ---------------------------------------------------------------------
> public static void main (String[] args) {
>
> soot.Main.main(new String[] {
> "HelloWorld",
> "-cp",
> "c:\\layers\\src;c:\\java\\jdk1.5.0_03\\jre\\lib\\rt.jar",
> "-f", "jimple",
> });
>
>
> SootClass sc = Scene.v().getSootClass("HelloWorld");
> SootMethod sm = sc.getMethodByName("say");
>
> //RuntimeException thrown at the following line
> JimpleBody b = (JimpleBody) sm.getActiveBody();
> }
>
> ----------------------------------------------------------------------
> Exception in thread "main" java.lang.RuntimeException: no active body
> present for method <HelloWorld: void say()>
> at soot.SootMethod.getActiveBody(SootMethod.java:279)
> at SootTest.main(SootTest.java:21)
>
> _______________________________________________
> 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