[Soot-list] Exception no defs for value

Zeinab Lashkaripour lashkaripour at yahoo.com
Thu Jun 27 02:38:35 EDT 2013


Hi everyone,

I'm trying to add assignments to the InvokeExprs like below (I'm looking for append methods):
    Before trans:

temp$0 = new java.lang.StringBuffer
specialinvoke temp$0.<java.lang.StringBuffer: void <init>()>()
virtualinvoke temp$0.<java.lang.StringBuffer: java.lang.StringBuffer append(java.lang.Object)>("value")
.....
    After trans:
temp$0 = new java.lang.StringBuffer
specialinvoke temp$0.<java.lang.StringBuffer: void <init>()>()
temp$0 = virtualinvoke temp$0.<java.lang.StringBuffer: java.lang.StringBuffer append(java.lang.Object)>("value")
...

I have done nothing else but, I get the exception below:
    no defs for value: temp$0 in ...
    at soot.Body.validateUses(Body.java:336)
    at soot.Body.validate(Body.java:233)
    at soot.jimple.JimpleBody.validate(JimpleBody.java:66)
    at MyTransfromation.insertAssignmentForVirtualInvoke(MyTransfromation.java:329)
    at MyTransfromation.internalTransform(MyTransfromation.java:173)
    at soot.BodyTransformer.transform(BodyTransformer.java:51)
    at soot.Transform.apply(Transform.java:104)
    at soot.BodyPack.internalApply(BodyPack.java:49)
    at soot.Pack.apply(Pack.java:124)
    at soot.PackManager.runBodyPacks(PackManager.java:826)
   
 at soot.PackManager.runBodyPacks(PackManager.java:510)
    at soot.PackManager.runBodyPacks(PackManager.java:417)
    at soot.PackManager.runPacksNormally(PackManager.java:394)
    at soot.PackManager.runPacks(PackManager.java:335)
    at soot.Main.run(Main.java:198)
    at soot.Main.main(Main.java:141)
    at MyMain.main(MyMain.java:66)

I have searched and found [1] that Eric says "The appropriate code should be in soot.Body.validateUses(). I recommend just setting a breakpoint there and looking at the context." 

I have set a breakpoint at my code where I call  body.validateUses() 
after my transformations but when I step inside I get nothing that will 
give me a clue where the exception is occurring. I think that there 
should be a problem with my code because I have not added anything 
special (just simple assignments and locals) to the jimple code that might be the 
source of the exception.

The code I've used is in [2].

Could you please guide me? 

Regards,
Zeinab


[1] http://www.sable.mcgill.ca/pipermail/soot-list/2010-June/003031.html
 
 
 
[2]

> Value v = ((ValueBox) s.getInvokeExpr().getUseBoxes().get(0)).getValue();

> local = Jimple.v().newLocal(v.toString(), RefType.v("java.lang.StringBuffer"));
> body.getLocals().add(local);
> if (s.getInvokeExpr().getMethod().getName().compareToIgnoreCase("append") == 0 && !(s instanceof AssignStmt))
> {
>      
 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)));
>       //// Replaces s in the Chain by assign
>       patchingUnits.swapWith(s, assign);
>}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130626/bcf5734b/attachment.html 


More information about the Soot-list mailing list