[Soot-list] unknown SpecialInvokeExpr (no call to constructor, super or private method) while initializing a custom class

Khanh Nguyen khanhtn1 at uci.edu
Tue Dec 3 02:53:27 EST 2013


Hi,

You got to insert a specialinvoke stmt to call the <init> in order to
initialize your r12. Java statement a = new A() is equivalent to 2 jimple
statements: 1) a = new A; 2) specialinvoke a.<java.lang.Object void
<init>()>();
The exception you got is because SpecialInvokeExpr is only used (like what
it printed on the screen) for call to constructor, super or private method.
I assum your setGenericParams() is a public method. To call publlic method,
you use VirtualInvokeExpr

Hope that helps,

Khanh Nguyen
UCI Irvine

On Mon, Dec 2, 2013 at 11:05 PM, Satyaditya Munipalle
<satyadit at buffalo.edu>wrote:

> Hi Mr.Eric,
>                      I am trying to instrument my android app using soot
> .I am trying to assign a local variable to a class object so that i can
> call the methods of the class using it. I had noticed that my jimple output
> the <init>  is not being called
>  JAVA CODE:
>
> Scene.v().loadClassAndSupport("record.Structure");
>  SootClass structClass=Scene.v().getSootClass("record.Structure");
> SootMethod setGenericParams   = structClass.getMethod("boolean
> setGenericParams()");
>                                In the chain iterator I am trying to create
> an instance of the class. I had created the local as shown below
>
>                               Local structLocal = Jimple.v().newLocal("$r"
> + locals.size(),structClass.getType());
>  locals.add(structLocal);
>
> //initializing struct class
> Value rValue=Jimple.v().newNewExpr(RefType.v(structClass));
>  Stmt newAssignStmt = Jimple.v().newAssignStmt(structLocal, rValue);
> logBlock.add(newAssignStmt);
>  units.insertAfter(logBlock, stmt);
>
>
>
> JIMPLE REPRESENTATION
>                      $r13 = new record.Logger;
>                     $r12 = new record.Structure;
>                    specialinvoke $r12.<record.Structure: boolean
> setGenericParams()>();  //NO INIT BEING CALLED
>                    specialinvoke $r13.<record.Logger: void
> log(record.Structure)>($r12);
>
>
> and  I am running into this particular error after writing this piece of
> code.
> Exception
>
> Exception in thread "main" java.lang.Error: unknown SpecialInvokeExpr (no
> call to constructor, super or private method): specialinvoke $r12.
> <record.Structure: boolean setGenericParams()>()
>  at soot.toDex.ExprVisitor.caseSpecialInvokeExpr(ExprVisitor.java:129)
> at
> soot.jimple.internal.AbstractSpecialInvokeExpr.apply(AbstractSpecialInvokeExpr.java:117)
>  at soot.toDex.StmtVisitor.caseInvokeStmt(StmtVisitor.java:566)
> at soot.jimple.internal.JInvokeStmt.apply(JInvokeStmt.java:101)
>  at soot.toDex.DexPrinter.toInstructions(DexPrinter.java:348)
> at soot.toDex.DexPrinter.toCodeItem(DexPrinter.java:324)
>  at soot.toDex.DexPrinter.toMethods(DexPrinter.java:248)
> at soot.toDex.DexPrinter.toClassDataItem(DexPrinter.java:211)
>  at soot.toDex.DexPrinter.addAsClassDefItem(DexPrinter.java:202)
> at soot.toDex.DexPrinter.add(DexPrinter.java:510)
>  at soot.PackManager.writeClass(PackManager.java:971)
> at soot.PackManager.writeOutput(PackManager.java:595)
>
> Is this the right way of creating an object for a class?? Please help me
>
> Regards,
> adit.
>
> _______________________________________________
> 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/20131202/6f94475e/attachment.html 


More information about the Soot-list mailing list