[Soot-list] How to determine whether there exists a use for a variable definition later on in the cfg

John Dean jdean4 at kc.rr.com
Fri Jul 27 11:16:37 EDT 2012


Hi all,

For a given instruction's definition within a loop, I need to determine
whether there exists a use for that definition outside of the loop. By
"definition," I mean a variable is assigned a value. By "use," I mean the
variable is accessed at some later point in the flow of the method's CFG.
I've already been able to gather the instructions in a loop, so I don't need
help with that.

I've looked through the soot api, and the only strategy I can come up with
is to find all the instructions in the cfg that might follow the variable
definition's instruction (while ignoring the instructions in the loop, of
course). And to do that, I would call cfg.getSuccsOf(unit) recursively and
avoid infinite recursive loops by storing all the found instructions in a
list and only adding new instructions if they're not in the list already.

That seems like a lot of work on my part, and I don't want to reinvent the
wheel if there's a better way. Any suggestions?

Thanks,
john



More information about the Soot-list mailing list