[Soot-list] Soot class instance

Satyaditya Munipalle satyadit at buffalo.edu
Tue Dec 3 00:11:31 EST 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20131203/0a0dbc12/attachment.html 


More information about the Soot-list mailing list