[prev in list] [next in list] [prev in thread] [next in thread]
List: soot-list
Subject: Re: [Soot-list] Exception no defs for value
From: Zeinab Lashkaripour <lashkaripour () yahoo ! com>
Date: 2013-06-27 7:40:00
Message-ID: 1372318800.19591.YahooMailNeo () web163106 ! mail ! bf1 ! yahoo ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Thanks a lot Quentin.
Yes, you were right, now I don't get the exception.
Thanks again.
________________________________
From: Quentin Sabah <quentin.sabah@inria.fr>
To: soot-list@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@inria.fr | mailto:quentin.sabah@st.com
phone: +33 476 61 54 57 | phone: +33 476 58 44 14
_______________________________________________
Soot-list mailing list
Soot-list@sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
[Attachment #5 (text/html)]
<html><body><div style="color:#000; background-color:#fff; font-family:times new \
roman, new york, times, \
serif;font-size:10pt"><div><span><br></span></div><br><br><br><br><br><br><br><br><br><br><br><br><br><div \
style="font-family: times new roman, new york, times, serif; font-size: 10pt;"><div \
style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div \
class="y_msg_container"><div id="yiv3178254089"><div><div \
style="color:#000;background-color:#fff;font-family:times new roman, new york, times, \
serif;font-size:10pt;"><br>Thanks a lot Quentin.<br>Yes, you were right, now I don't \
get the exception.<br><br>Thanks \
again.<br><div><span><br></span></div><div><br></div> <div style="font-family:times \
new roman, new york, times, serif;font-size:10pt;"> <div style="font-family:times new \
roman, new york, times, serif;font-size:12pt;"> <div dir="ltr"> <hr size="1"> <font \
face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Quentin \
Sabah <quentin.sabah@inria.fr><br> <b><span \
style="font-weight:bold;">To:</span></b> soot-list@sable.mcgill.ca <br> <b><span \
style="font-weight:bold;">Sent:</span></b> Thursday, June 27, 2013 11:50 AM<br> \
<b><span style="font-weight:bold;">Subject:</span></b> Re: [Soot-list] Exception no \
defs for value<br> </font> </div> <div \
class="yiv3178254089y_msg_container"><br>Hi,<br><br>>> Value v = \
((ValueBox) s.getInvokeExpr().getUseBoxes().get(0)).getValue();<br>> > \
local = Jimple.v().newLocal(v.toString(),<br>> \
RefType.v("java.lang.StringBuffer"));<br>> > \
body.getLocals().add(local);<br><br>You don't have to create a new Local, what you \
want is to reuse the <br>existing Local. That is why you get an error currently. \
Simply do:<br><br>Local local = (Local) ((ValueBox) \
<br>s.getInvokeExpr().getUseBoxes().get(0)).getValue();<br><br>> > \
appendRef =<br>> Scene.v().getSootClass("java.lang.StringBuffer").getMethod("java.lang.StringBuffer<br>><br>> \
> append(java.lang.Object)").makeRef();<br>> > assign = \
Jimple.v().newAssignStmt(v,<br>> Jimple.v().newVirtualInvokeExpr(local, \
appendRef,<br>> > s.getInvokeExpr().getArg(0)));<br><br>Here you don't \
need to create a new invoke expr, simply reuse the one <br>you just \
found:<br><br>assign = Jimple.v().newAssignStmt(local, \
s.getInvokeExpr());<br><br>> > //// Replaces s in the Chain by \
assign<br>> > patchingUnits.swapWith(s, assign);<br>> \
>}<br><br>This should be okay.<br><br><br>-- <br>Quentin Sabah, CIFRE Ph.D. \
student<br>Grenoble University<br>INRIA-SPADES \
| STMicroelectronics/AST<br>Montbonnot, France \
| Grenoble, France<br>mailto:<a rel="nofollow" \
ymailto="mailto:quentin.sabah@inria.fr" target="_blank" \
href="mailto:quentin.sabah@inria.fr">quentin.sabah@inria.fr</a> | mailto:<a \
rel="nofollow" ymailto="mailto:quentin.sabah@st.com" target="_blank" \
href="mailto:quentin.sabah@st.com">quentin.sabah@st.com</a><br>phone: +33 476 61 54 \
57 | phone: +33 476 58 44 \
14<br>_______________________________________________<br>Soot-list mailing list<br><a \
rel="nofollow" ymailto="mailto:Soot-list@sable.mcgill.ca" target="_blank" \
href="mailto:Soot-list@sable.mcgill.ca">Soot-list@sable.mcgill.ca</a><br><a \
rel="nofollow" target="_blank" \
href="http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list">http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list</a><br><br><br></div> \
</div> </div> </div></div></div><br><br></div> </div> </div> </div></body></html>
_______________________________________________
Soot-list mailing list
Soot-list@sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic