[prev in list] [next in list] [prev in thread] [next in thread]
List: soot-list
Subject: [Soot-list] getting jimple bodies from soot methods
From: sbugrara () MIT ! EDU (Suhabe Bugrara)
Date: 2005-06-10 6:01:17
Message-ID: Pine.GSO.4.58L.0506100550310.15486 () mint-square ! mit ! edu
[Download RAW message or body]
Thanks for the reply. I tried calling the retrieveActiveBody method, but I
get the following NullPointerException. Apparently, the MethodSource
field of the SootMethod object is not set.
Suhabe
---------------------------------------------------------------------
Exception in thread "main" java.lang.NullPointerException
at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:80)
at soot.SootMethod.retrieveActiveBody(SootMethod.java:304)
at SootTest.main(SootTest.java:20)
On Thu, 9 Jun 2005, Jennifer Lhotak wrote:
> 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@sable.mcgill.ca
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic