[Soot-list] Body Transformer : Problem Add New Method in Chain

Amir Mehrabi mehrabi at comp.iust.ac.ir
Sat Jan 24 06:25:18 EST 2009


Hi

For construct an invovcation to CHECK method I write these statements:

Signletons s=new Singletons();
NewArrayExpr myExpr=enw 
JNewArrayExpr(s.soot.RefType().v("Java.lang.Object"),IntConstant.v(5));
List params=new ArrayList();
params.add(StringConstant.v("aaaaa"));
params.add(StringConstant.v("bbbbb"));
params.add(myExpr);

InvokeExpr incExpr=Jimple.v().newStaticInvokeExpr(check.makeRef(),params);
Stmt incStmt=Jimple.v().newInvokeStmt(incExpr);
units.insertBefor(incStmt,oldStmt);


this is part of my Transform Body but I got a ERROR:

Box VB(null) cannot contain value : newarray(java.lang.Object)[5](class 
soot.jimple.internal.JNewArrayExpr)
at soot.AbstractValueBox.setValue(AbastractValueBox.java:42)


I don't know why this error occure.
please help me....

thank you.


-----Original Message-----
From: "Amir Mehrabi" <mehrabi at comp.iust.ac.ir>
To: "Eric Bodden" <eric.bodden at mail.mcgill.ca>
Cc: soot-list at sable.mcgill.ca
Date: Sat, 24 Jan 2009 12:43:05 +0330
Subject: Re: [Soot-list] Body Transformer : Problem Add New Method in Chain


Hi could you please show me by example how can I invoke a method in Jimple 
Format such as:
         void check(String a,String b,Object[] c);
 
thankl you
 


-----Original Message-----
From: Eric Bodden <eric.bodden at mail.mcgill.ca>
To: Amir Mehrabi <mehrabi at comp.iust.ac.ir>
Cc: soot-list at sable.mcgill.ca
Date: Wed, 21 Jan 2009 09:30:10 -0500
Subject: Re: [Soot-list] Body Transformer : Problem Add New Method in Chain


You have to construct a new array using
soot.jimple.Jimple.newNewArrayExpr(Type, Value).

Eric

2009/1/21 Amir Mehrabi <mehrabi at comp.iust.ac.ir>:
> Hi
> I want to by BodyTransformer add one method to the existing method's body
> my method is:
>
> void check(String name,String arg1,Object[] objs);
>
> in jimple there is statement for adding some statement in unit like :
>
>   newStaticInvokeExpr ( SootMethodRef  method, List args)
>   newStaticInvokeExpr( SootMethodRef method, Value arg)
>   newStaticInvokeExpr ( SootMethodRef  method, Value  arg1, Value  arg2)
> for sending String Value I use
>
>               StringConstant.v("some text");
>
> but I don't know how to send array of Object for passing Object[]
> Can any one help me please?
>
> Thank you
> Amir Mehrabi
> MSc Student of Iran University Of Science and Technology
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090124/16373e93/attachment.html 


More information about the Soot-list mailing list