[Soot-list] To get the statement of a FieldRef

Patrick Lam p.lam at ece.uwaterloo.ca
Wed Oct 10 09:09:26 EDT 2012


On 10/10/2012 05:56 AM, Zhoulai wrote:
> Dear all,
>
> I suppose there is a  1-1 correspondence between a FieldRef and the
> **single**  Jimple statement that contains the FieldRef.
> Is there an easy workaround to obtain the statement of a FieldRef. It
> is  counter-intuitive for me that there is no things like
> FieldRef.getStmt() .

It would be reasonable to think that Soot would track something like 
that, but it doesn't. (It makes for more invariants to manually 
maintain; since we don't generally need that invariant, we don't store 
that data.) You'll have to make a pass through the Jimple units and 
store that information in a HashMap or something yourself. Shouldn't 
take very long.

pat



More information about the Soot-list mailing list