[Soot-list] Exception no defs for value
Quentin Sabah
quentin.sabah at inria.fr
Thu Jun 27 03:20:46 EDT 2013
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
More information about the Soot-list
mailing list