[Soot-list] method has an invalid active body!

Ondrej Lhotak olhotak at sable.mcgill.ca
Tue Oct 12 23:33:11 EDT 2004


On Tue, Oct 12, 2004 at 10:52:18AM -0500, Uwe Dolinsky wrote:
> The transformer is added to phase "jop". The method body that is
> passed into the transformers internalTransform expectedly is a JimpleBody,
> but at this point all other method bodies (except the newly generated method)
> in my testclass have already been converted into Baf. 
> How do I get Soot to include that newly generated Jimple method into that 
> conversion into Baf?  

This is rather tricky. Soot processes code method-by-method rather than
phase-by-phase. This means that by the time you are processing the code
for some method, it is too late to add additional methods to be
processed. The recommended workaround is to add a SceneTransformer to
the cg phase, which is a whole program phase that runs before the body
packs, and before the set of methods to be processed is enumerated. An
alternative that may work for you is to duplicate code from the method
PackManager.runBodyPacks(SootClass) to run all the packs on your
newly-created method as soon as you create it.

Similar problems keep coming up, and it is always suggested to change
Soot to process code phase-by-phase. The last time they were discussed
at a Soot meeting, they were vetoed.

Ondrej


> Thanks 
> Uwe
> 
> 
> > > I've written a Jimple transformer that builds (in its internalTransform
> > > method)
> > > a new method using Jimple.
> > > This is a snippet of the code I use before adding statements to that new
> > > method:
> > >
> > >         DeclClass.addMethod(method);
> > >          JimpleBody body = Jimple.v().newBody(method);
> > >          method.setActiveBody(body);
> > 
> > This sounds like a phase ordering problem.  Which phase are you adding
> > your Jimple transformer to?  If you add it after other Jimple bodies have
> > been converted to Baf, then the code generator will get confused.  In
> > particular, in that phase, you should try and query a random method of
> > DeclClass and see what bodies it has.
> > 
> > pat
> > 
> > 
> > 
> 
> -- 
> ___________________________________________________________
> Sign-up for Ads Free at Mail.com
> http://promo.mail.com/adsfreejump.htm
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://www.sable.mcgill.ca/mailman/listinfo/soot-list
> 


More information about the Soot-list mailing list