[Soot-list] Exception no defs for value

Zeinab Lashkaripour lashkaripour at yahoo.com
Thu Jun 27 03:40:00 EDT 2013

















Thanks a lot Quentin.
Yes, you were right, now I don't get the exception.

Thanks again.




________________________________
 From: Quentin Sabah <quentin.sabah at inria.fr>
To: soot-list at sable.mcgill.ca 
Sent: Thursday, June 27, 2013 11:50 AM
Subject: Re: [Soot-list] Exception no defs for value
 

Hi,

>>  Value v =
 ((ValueBox) s.getInvokeExpr().getUseBoxes().get(0)).getValue();
>  > local = Jimple.v().newLocal(v.toString(),
> RefType.v("java.lang.StringBuffer"));
>  > body.getLocals().add(local);

You don't have to create a new Local, what you want is to reuse the 
existing Local. That is why you get an error currently. Simply do:

Local local = (Local) ((ValueBox) 
s.getInvokeExpr().getUseBoxes().get(0)).getValue();

>  > appendRef =
> Scene.v().getSootClass("java.lang.StringBuffer").getMethod("java.lang.StringBuffer
>
>  > append(java.lang.Object)").makeRef();
>  > assign = Jimple.v().newAssignStmt(v,
> Jimple.v().newVirtualInvokeExpr(local, appendRef,
>  > s.getInvokeExpr().getArg(0)));

Here you don't need to create a new invoke expr, simply reuse the one 
you just found:

assign = Jimple.v().newAssignStmt(local,
 s.getInvokeExpr());

>  > //// Replaces s in the Chain by assign
>  > patchingUnits.swapWith(s, assign);
>  >}

This should be okay.


-- 
Quentin Sabah, CIFRE Ph.D. student
Grenoble University
INRIA-SPADES                   | STMicroelectronics/AST
Montbonnot, France             | Grenoble, France
mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
phone: +33 476 61 54 57        | phone: +33 476 58 44 14
_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130627/edffa575/attachment.html 


More information about the Soot-list mailing list