[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

soot createclass tutorial



Hi,

I'm trying to do the first lesson in the second half of the soot tutorial. I can get CreateClassExample.java to compile with Sun's SDK 1.4.1, but I can't get CreateClassExample.class to execute without throwing the following exception:

Exception in thread "main" java.lang.RuntimeException: tried to get nonexistent field!
at soot.Scene.getField(Scene.java:329)
at CreateClassExample.main(CreateClassExample.java:98)

In CreateClassExample:

// add "tmpRef = java.lang.System.out"
units.add(
Jimple.v().newAssignStmt(
tmpRef, Jimple.v().newStaticFieldRef(
Scene.v().getField(
"<java.lang.System: java.io.PrintStream out>"))));

In Scene.java:

public SootField getField(String fieldSignature)
{
SootField f = (SootField) fieldSignatureToField.get(fieldSignature);
if (f != null)
return f;

throw new RuntimeException("tried to get nonexistent field!");
}

Also, in the tutorial, r0 and r1 in the sample Jimple output need to be updated to l0 and tmpRef respectively.

Cheers,
Chris