[Soot-list] How to get the type of locals in a FlowAnalysis?
Jochen Wuttke
wuttkej at usi.ch
Wed Jun 23 04:03:14 EDT 2010
Hi,
I'm trying to build a very simple analysis that effectively counts the
number and type of local variables occurring in a method.
I tried to use the normal ExceptionalUnitGraph to extract this
information. However, when I run the analysis on the following method,
the variable 'x' is reported to have type 'byte', not 'int'. Guessing
from the documentation of some of the phase options to Soot, it looks
like the standard type assigner does not care about the declared type
of locals, but tries to infer the minimum size the actually values fit
in. So in my case, byte rather than int, because I only assign a small
numeric value.
After digging a little in the API of Soot I saw that there is a
package soot.tootlkits.astmetrics that seems to contain a bunch of
things working on the AST provided by Polyglot. Is there a way that I
can hook up my own AST metric and run it together with the others? I
guess that could solve my problem?
Thanks for any advice,
Jochen
public void hasOnlyPrimitives() {
int x = 9;
long y = 0;
x++;
y += x;
}
More information about the Soot-list
mailing list