[Soot-list] How to use newStaticInvokeExpr() method for inserting methods with more than one argument

Marjan Radi marjan.radi at yahoo.com
Mon Jun 22 13:39:06 EDT 2015


Hi, 
I wanted to insert "Log.d(string s, string g)" statement in side my .dex file , using following code:
1- SootMethod toCall3 = Scene.v().getSootClass("android.util.Log").getMethod("int d(java.lang.String,java.lang.String)");    2- b.getUnits().insertBefore(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr((SootMethodRef) toCall3.makeRef(), tmpLog)) ,srcUnit);
But I got the following error:Exception in thread "main" Invalid number of arguments at soot.jimple.validation.InvokeArgumentValidator.validate(InvokeArgumentValidator.java:35) at soot.jimple.JimpleBody.validate(JimpleBody.java:117) at soot.jimple.JimpleBody.validate(JimpleBody.java:102)
I know this error is because Log statement have two input parameters but in the second line of code there is only one parameter is mentioned ("tmpLog"). I do not know how to use "newStaticInvokeExpr" method for inserting methods with more than one argument. I would be appreciated if you could give me an example.
Best Regards,Marjan  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150622/5b1edee1/attachment.html 


More information about the Soot-list mailing list