[Soot-list] Extracting field usage information with Soot

Eric Bodden eric.bodden at mail.mcgill.ca
Thu Jan 31 16:28:44 EST 2008


> I am developing a reference immutability inference tool for Java built
> on top of Soot.  As part of my analysis, I need to determine which
> SootFields are read in a SootMethod and which fields are written to in
> a method.  I believe the correct approach is to create a SceneVisitor
> and override visitBody() to use a custom
> soot.jimple.AbstractStmtSwitch to check each soot.jimple.Stmt,
> deconstructing a Stmt based on it's type.  Is this the correct
> approach, or is there some existing feature of Soot that I am not
> aware of?  Using this approach, would checking the result of
> Stmt.getFieldRef() suffice for determining field reads, and would
> checking the result of AssignStmt.getLeftOp() suffice for field writes?

Yes, that sounds correct to me.

> Additionally, is there any documentation for developers who wish to
> use and extend Soot programmatically?  The documentation at http://www.sable.mcgill.ca/soot/tutorial/
>   seems to be primarily for people who only want to use Soot as a tool
> from the command line.

The PLDI03 tutorial has a couple of slides on that. It's fairly easy, usually...

Eric

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


More information about the Soot-list mailing list