[Soot-list] How retrieve a method's list of parameters?
Phil Pratt-Szeliga
pcpratts at syr.edu
Sat Aug 4 16:33:41 EDT 2012
Hi John,
If you have a Body object named body:
SootMethod method = body.getMethod();
int num_params = method.getParameterCount();
See: http://www.sable.mcgill.ca/soot/doc/soot/SootMethod.html
Phil Pratt-Szeliga
Syracuse University
On Sat, Aug 4, 2012 at 3:37 PM, John Dean <jdean4 at kc.rr.com> wrote:
> Hi all,
> I need to be able to tell if a variable is a parameter (passed to a method)
> as opposed to a regular local variable.
> Initially, I tried to identify a parameter by using instanceof ParameterRef,
> but that doesn't work. Testing tells me that parameter variables are
> instances of JimpleLocal and not ParameterRef.
>
> I've now discovered that I can use Body.getParameterLocal(0) to retrieve the
> first parameter. But if I want to compare my variable to all the retrieved
> getParameterLocal variables, I would have to have to be able to retrieve
> all the parameters, and I don't know how to do that. If I knew the number of
> parameters, I could loop through all the parameters, but I don't know how to
> retrieve the number of parameters.
>
> Suggestions?
>
> Thanks,
> John
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
More information about the Soot-list
mailing list