[Soot-list] How to get "This" parameter within a java method? (instrument the android apk)

Steven Arzt Steven.Arzt at cased.de
Fri Jun 6 04:30:41 EDT 2014


Hi Jin,

 

The JimpleBody class supports a getThisLocal() method.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Jin Li
Gesendet: Freitag, 6. Juni 2014 10:26
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] How to get "This" parameter within a java method? (instrument the android apk)

 

Hi All,
   

     I want to insert an invocation in onCreate() method of a android class

        protected void onCreate(Bundle savedInstanceState){

         Context con = getApplicationContext(); // this is the invocation I want to insert


        }

 I do like this:

       Local tmpRef = Jimple.v().newLocal("context", RefType.v("android.content.Context"));
       body.getLocals().add(tmpRef);

       SootMethod invokeContextMethod = Scene.v().getSootClass("android.content.ContextWrapper").getMethod("android.content.Context getApplicationContext()");
       InvokeExpr invokeContext = Jimple.v().newVirtualInvokeExpr(base, invokeContextMethod);
 

 There, "base" should be a Local value which used to invoke the "invokeContextMehtod".  I think it is the "this" paramether within the onCreate method.
 

 But I don't know how to get the "this" parameter and convert it to a Local value in Soot.

Can anybody help me?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140606/1485f690/attachment.html 


More information about the Soot-list mailing list