[Soot-list] how to add primitive java types to Local?

Gerald Sit Gerald.Sit at student.cityu.edu.hk
Fri Aug 15 05:42:18 EDT 2008


Hi all,

I'm looking into adding statements to specific java programs. It seems it's relatively easy to add statements before or after specific statement using Chain.insertBefore and Chain.insertAfter, but I didn't figure out how to instantiate objects of Value type. Some of the Value subclass objects could be created with Jimple.v().newXXX(...) like the following code snippets:

Local tmpLocal = Jimple.v().newLocal("tmp", LongType.v());
body.getLocals().add(tmpLocal);

AssignStmt toAdd1 = Jimple.v().newAssignStmt(tmpLocal,
                                Jimple.v().newStaticFieldRef(gotoCounter.makeRef()));
units.insertBefore(toAdd1, stmt);



but what if I want to create a statement like "a = 1;" only? No idea on how to create the object with constant value. Thanks.

Gerald


More information about the Soot-list mailing list