[Soot-list] Jimple InvokeExpr with return

Patrick Lam plam at cs.mcgill.ca
Thu Mar 24 09:35:38 EDT 2011


On 03/24/11 08:07, Pedro Louro wrote:
> Hello,
>
> I´m instrumenting a class file, adding some method calls to a observer
> class with this code:
>
> SootMethodRef mr = Scene.v().getMethod("<" + observerClass + ": void"
> + "recordInput" + "(java.lang.String,java.lang.String)>").makeRef();
> args.addLast(l);
> units.insertAfter(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr(mr,
> args)), assignStmt);
>
> How can I do a similar call but with a method that returns, for
> example, an int? I´m not understanding how can I assign the return of
> the method to a local.

Use an AssignStmt instead of an InvokeStmt. The two arguments should be 
the LHS and the RHS. The RHS is the StaticInvokeExpr.

pat


More information about the Soot-list mailing list