[Soot-list] How to insert IfStmt before an existing stmt and How to modify a method definition?

Jin Li lijin1988 at gmail.com
Wed Aug 6 10:31:22 EDT 2014


Hi Steven,

Thanks for your tutorials. But my second question remains.
If I want to modify the definition of an existing method, e.g.

  before:   public void A(int, init)
  after:     public int  A(int,init,boolean,boolean)

I want to change the parameters and return values of a method. (add another
parameter or change the type of the return value)

Now I create a new method public int  B(int,init,boolean,boolean) , and
replace all the original call to B.
How to change the original definition directly?

Best Regards,
Jin





2014-08-04 17:00 GMT+08:00 Steven Arzt <Steven.Arzt at cased.de>:

> Hi Jin,
>
>
>
> Have you looked into our Android instrumentation tutorial we gave at
> RV’2013 and CCS’2013? Most of the stuff we explain there also applies to
> normal Java programs. You can find the tutorial here:
> http://sseblog.ec-spride.de/tutorials/
>
>
>
> Best regards,
>
>   Steven
>
>
>
> *Von:* soot-list-bounces at CS.McGill.CA [mailto:
> soot-list-bounces at CS.McGill.CA] *Im Auftrag von *Jin Li
> *Gesendet:* Montag, 4. August 2014 04:40
> *An:* soot-list at CS.McGill.CA
> *Betreff:* [Soot-list] How to insert IfStmt before an existing stmt and
> How to modify a method definition?
>
>
>
> Hi All,
>
> I searched the soot tutorials, but I didn't find answers to my questions.
>
> 1, I want to insert IfStmt before an existing Stmt. e.g.:
>
>
>   before:
>
>
>     virtualinvoke r6.<java.io.OutputStream: void
> write(byte[]),int,int>(r2,0,$i0);
>
> after:
>
>     if  local ==1 goto label 0;
>
>     goto label1;
>
>   label0:
>
>     staticinvoke ...
>
>  label1:
>     virtualinvoke r6.<java.io.OutputStream: void
> write(byte[]),int,int>(r2,0,$i0);
>
> 2, I want to modify a method definition. e.g.
>
>
>   before:   public void A(int, init)
>
>   after:     public int  A(int,init,boolean,boolean)
>
> Any suggestions and code snippets are welcome!
>
> Thank you.  Looking forward your suggestions!
>
> Best regards,
>
> Jin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140806/e4303e0d/attachment.html 


More information about the Soot-list mailing list