[Soot-list] Fwd: try catch in methods issue

dinesh chhatani dinustudy at gmail.com
Mon Mar 29 06:13:42 EDT 2010


---------- Forwarded message ----------
From: dinesh chhatani <dinustudy at gmail.com>
Date: Mon, Mar 29, 2010 at 3:41 PM
Subject: Re: [Soot-list] try catch in methods issue
To: Eric Bodden <bodden at st.informatik.tu-darmstadt.de>


Hi Eric,

Thanks for Responding,
How to fetch  each and every method from a class file using transformer as
you said???



On Mon, Mar 29, 2010 at 2:52 PM, Eric Bodden <
bodden at st.informatik.tu-darmstadt.de> wrote:

> Hi Dinesh.
>
> Using loadClassAndSupport is not recommended. Could you try not using
> loadClassAndSupport but instead using a transformer instead?
>
> public static void main(String[] args) {
>  PackManager.v().getPack("jtp").add(
>    new Transform("jtp.myTransform", new BodyTransformer() {
>      protected void internalTransform(Body body, String phase, Map options)
> {
>        //do something with body here
>      }
>    }));
>  soot.Main.main(args);
> }
>
> This should avoid any such problems.
> See also here: http://www.bodden.de/2008/09/22/soot-intra/
>
> Eric
>
> --
> Dr. Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>
>
>
> On 29 March 2010 10:56, dinesh chhatani <dinustudy at gmail.com> wrote:
> > thanks for answering Eric,
> >
> > See this is the part of code,
> >
> >
> > SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
> >
> > sClass.setApplicationClass();
> >
> > Iterator methodIt = sClass.getMethods().iterator();
> >
> > while (methodIt.hasNext()) {
> >
> > SootMethod m = (SootMethod)methodIt.next();
> >
> > Body b = m.retrieveActiveBody();............this line throws Null pointer
> > exception for the  method of given class in arg[] (if that contains
> > try/catch block)
> >
> > On Mon, Mar 29, 2010 at 1:41 PM, Eric Bodden
> > <bodden at st.informatik.tu-darmstadt.de> wrote:
> >>
> >> Hi Dinesh.
> >>
> >> > I want to create UnitGraphs for all my methods in the class
> >> > Now if my method is having try/catch block then when the body of that
> >> > method
> >> > is retrieved by m.retrieveactivebody at this point it throws null
> >> > pointer
> >> > exception.
> >>
> >> Normally whether or not a method has a try-catch block should have no
> >> impact on whether you can retrieve a body or not. I suspect that you
> >> are using Soot incorrectly but that is hard to say without seeing your
> >> code.
> >>
> >> > also what are limitations of soot as far as version is control(Is it
> >> > working
> >> > for all jdk's) and upcoming versions in future
> >>
> >> This really depends what you want to use Soot for. Most functionality
> >> should work fine with any JDK.
> >>
> >> Eric
> >
> >
> >
> > --
> > Regards,
> > Dinesh Chhatani
> >
>



-- 
Regards,
Dinesh Chhatani



-- 
Regards,
Dinesh Chhatani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100329/c421419f/attachment-0001.html 


More information about the Soot-list mailing list