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

Steven Arzt Steven.Arzt at cased.de
Tue Jun 23 04:47:46 EDT 2015


Hi Marjan,

 

There is an overload of the newStaticInvokeExpr() method that takes a list of values as a parameter. Use this overload to create a static invocation expression with more than one argument.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Marjan Radi
Gesendet: Montag, 22. Juni 2015 19:39
An: soot-list at cs.mcgill.ca
Betreff: [Soot-list] How to use newStaticInvokeExpr() method for inserting methods with more than one argument

 

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/20150623/5e5a6210/attachment.html 


More information about the Soot-list mailing list