[Soot-list] Is there a way to get the object whose method is being called?

Eric Bodden eric.bodden at ec-spride.de
Sun Mar 18 11:02:33 EDT 2012


Hi Clarissa.

As Zheng wrote, you cannot determine the object. But possible what you
actually mean is the variable holding that object at runtime. In this
case you can get a handle to this variable as follows:

1.) extract the call statement from the call edge
2.) on this stmt perform stmt.getInvokeExpr() to extract the invoke expression
3.) cast this invoke expression to an InstanceInvokeExpr on which you
can then call getBase()
4.) getBase() returns a value, which you should be able to cast to a
local variable

Cheers,
Eric

On 18 March 2012 15:09, Clarissa Grixti <clarissa_14_4 at hotmail.com> wrote:
> Hey all,
>
>  I am creating a call graph for my system in order to be able to get the
> target nodes for a particular method. Is there a way to be able to identify
> the object whose method is being called? I did manage to get the declaring
> class for the method, but what I need is the actual object calling a
> specific method.
>
> Thanks and regards
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list