[Soot-list] Getting method call result.

Roman Petriev vvpiroman at gmail.com
Tue Feb 24 15:58:05 EST 2015


It was simple:

VirtualInvokeExpr vieStringBuilderLenght = Jimple.v().newVirtualInvokeExpr(
                        localStringBuilder,
                        Scene.v().getMethod("<java.lang.StringBuilder: int
length()>").makeRef());
Local localStringBuilderLenght = Jimple.v().newLocal(
"sb_lenght",
IntType.v());
body.getLocals().add(localStringBuilderLenght);
AssignStmt asSBLenghtToLocal =
Jimple.v().newAssignStmt(localStringBuilderLenght, vieStringBuilderLenght);
body.getUnits().insertAfter(asSBLenghtToLocal, someStmt);

I hope, that it will help to somebody.


2015-02-23 17:01 GMT+03:00 Roman Petriev <vvpiroman at gmail.com>:

> Hi!
> I want to get result of method call. E.g.:
>
> VirtualInvokeExpr vieSBLenght = Jimple.v().newVirtualInvokeExpr(
>                         localStrBuilder,
>                         Scene.v().getMethod("<java.lang.StringBuilder: int
> length()>").makeRef());
> InvokeStmt isSBLenght = Jimple.v().newInvokeStmt(vieSBLenght);
>
> I want to get string builder length and use result in "if" expression.
> How can i do it?
>
> Thanks for any help.
>
> Best regards,
> Roman.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150224/9de0838d/attachment.html 


More information about the Soot-list mailing list