[Soot-list] Using Soot as a library / PhaseOptions

Eric Bodden eric.bodden at mail.mcgill.ca
Thu Nov 27 09:35:09 EST 2008


> Thanks again for the responses.  I have put together a small test class based
> on the example i took from an earlier message to the list.  In particular, i
> am not calling soot.Main.main():
> ...
> When running this program on a class, the jap phase is never executed.

Yes, that's not surprising. soot.Main.main() is the method that calls
the PackManager in order to execute the jap pack (and all other
packs). Not calling soot.Main.main() is not recommended at all - you
really need to know what you are doing.

> I have found that i can remedy the problem by calling PackManager.v().runPacks() each time a class is loaded (setting the output format to Jimple fixed the problem i had with this earlier).

Yes, you could do that, although this will invoke all the packs on all
the classes that were loaded into Soot, which could be quite a waste
of time. You could also apply certain packs selectively...

PackManager.getPack("jap").apply(b)

(where b is a body)

> Is this the best solution?  Is there any way to enable the phases after jb to
> run automatically when a class is loaded?

Yes, by calling soot.Main.main(..) ;-)

Are you loading classes into Soot "on demand" or all at the same time?

Eric

-- 
Eric Bodden
Sable Research Group, McGill University, Montréal, Canada
Got an interesting job offer? http://www.bodden.de/hire-me/


More information about the Soot-list mailing list