[Soot-list] Exception in JasminClass after adding static method invocation

Patrick Lam plam at cs.mcgill.ca
Mon Apr 6 20:37:11 EDT 2009


Jae-Woo Lee wrote:
> Hi.
> 
> I am working on adding a profiling code after analysis.
> When I add a static method invocation and when it is written with JasminClass,
> it generates ClassCastException.
> I just added a static method invocation in the source code of "Creating a Class
> File from Scratch" document.
> 
> Do you have any idea what is wrong in my code ?
> 
> ========= code snippet for adding static method invocation ==========
> 
> // insert DynamicRefCounter.incrementEscapingObjectCnt()
> {
>     Scene.v().loadClassAndSupport("myanalysis.DynamicRefCounter");
>     SootMethod myCall = Scene.v().getMethod("<myanalysis.DynamicRefCounter: void
> incrementEscapingObjectCnt()>");
>     System.out.println(Jimple.v().newStaticInvokeExpr(myCall.makeRef()).toString());
>                 units.add(Jimple.v().newStaticInvokeExpr(myCall.makeRef()));

Hi Jae-Woo,

You need to create an InvokeStmt and put the StaticInvokeExpr inside the
InvokeStmt. An Expr is not a Stmt or a Unit, and the units list should
only contain Units.

pat



More information about the Soot-list mailing list