[Soot-list] Scripting with soot

Patrick Lam plam at sable.mcgill.ca
Tue Nov 25 13:51:07 EST 2014


On 25/11/14 01:35 PM, Mihir Mehta wrote:
> There is no way for me to iterate through the method Bodys. I need to
> call soot.Main.main at the end of my class, which I believe is the
> standard. Once I do that, soot takes over and eventually calls
> internalTransform on each of the Bodys. I have a work-around in mind,
> but it's somewhat kludgy: I store all the relevant method names and the
> relevant assertions in a static data structure, and in the
> internalTransform method, I check the current Body against this static
> data structure and check assertions if any. You can see how storing
> assertions in a data structure is messy in a language such as java,
> which doesn't allow me to simply store functions as first-class values.
> This is why I'm wondering if there's a way for me to iterate through the
> method Bodys, which feels like a cleaner solution.

Right. Soot does the iteration for you if you use BodyTransformer. As 
Steven pointed out, SceneTransformer may be a better option if you want 
to do the iteration yourself. I also don't think it's that messy to 
store assertions (possibly in an assertion AST) in a data structure.

pat




More information about the Soot-list mailing list