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

Jin Li lijin1988 at gmail.com
Fri Jun 6 04:25:53 EDT 2014


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/b5109a3c/attachment.html 


More information about the Soot-list mailing list