[Soot-list] How retrieve a method's list of parameters?

John Dean jdean4 at kc.rr.com
Sat Aug 4 16:58:26 EDT 2012


Zell,

Thanks for the suggestion!

I think what you're saying is to loop through all the statements in the loop
(or at least the top ones) and check for instanceof IdentityStatement.
Except for the identify statement with "this" at the right, the other ones'
left sides should form a list of the method's parameters. Then for each
variable I encounter later on, I'll see if it is contained in the list of
parameters.

 

All,

I'll probably go ahead and do what's described above, but if anyone knows of
a better way or would like to confirm that the above strategy is the way to
go, let me know. It strikes me as odd that soot has a
Body.getParameterLocal(<int>) method, but there's no accompanying method
that can be used to find valid int argument values for it. Is that really
the case?

 

Thanks,

John

 

From: soot-list-bounces at sable.mcgill.ca
[mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of Zell
Sent: Saturday, August 04, 2012 3:16 PM
To: Soot List
Subject: Re: [Soot-list] How retrieve a method's list of parameters?

 

Hi, 

a workaround might be to track locals that are on the left hand side of
IdentityStmt. Of course, cases like x:=@this should be excluded.  

I have not tried this.  

Cheers,
Zell.

On Sat, Aug 4, 2012 at 9: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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120804/8ff80e09/attachment.html 


More information about the Soot-list mailing list