[Soot-list] Question about Value vs Stmt in Jimple

Jiaqi Tan jiaqit at andrew.cmu.edu
Thu Oct 18 11:58:39 EDT 2012


Hi,

I have a beginner question about using Soot. I am trying to
process/analyze bytecode in Jimple using a BodyTransformer, and I seem
to be getting very different output from JimpleBody.getAllUnitBoxes(),
as compared to from JimpleBody.getUseBoxes().

Are the Stmt's from JimpleBody.getAllUnitBoxes supposed to correspond
to the Expr's from the Value's in JimpleBody.getUseBoxes()? Are the
Value's/Expr's from the getUseBoxes() supposed to correspond to the
Stmt's from getAllUnitBoxes?

My current understanding of the Jimple representation is that the
Stmt's store Expr's, and I should be able to recover the same
representation (without control-flow information) of the code of a
given method from either the Stmt's or the Expr's. Am I missing
something?

For instance, when I process the Value's from getUseBoxes() in a
method, I get this:

        ( LOCAL:r0 ( T:DataHelper ) )
        ( INSTINVOKE:java.lang.Object:<init> )
        ( LOCAL:r0 ( T:DataHelper ) )
        ( LOCAL:r1 ( T:android.content.Context ) )
        ( EXPR:NEW ( T:DataHelper$OpenHelper ) )
        ( LOCAL:r0 ( T:DataHelper ) )
        ( LOCAL:r2 ( T:DataHelper$OpenHelper ) )
        ( LOCAL:r3 ( T:android.content.Context ) )
        ( INSTINVOKE:DataHelper$OpenHelper:<init> ( LOCAL:r3 (
T:android.content.Context ) ) )
        ( LOCAL:r2 ( T:DataHelper$OpenHelper ) )
        ( INSTINVOKE:SQLiteOpenHelper:getWritableDatabase )
        ( LOCAL:r0 ( T:DataHelper ) )
        ( LOCAL:r5 ( T:SQLiteDatabase ) )
        ( LOCAL:r0 ( T:DataHelper ) )
        ( CONSTANT: ( STR:"insert into table1(was) values ('was')" ) )
        ( LOCAL:r6 ( T:SQLiteDatabase ) )
        ( LOCAL:r4 ( T:java.lang.String ) )
        ( INSTINVOKE:SQLiteDatabase:compileStatement ( LOCAL:r4 (
T:java.lang.String ) ) )
        ( LOCAL:r0 ( T:DataHelper ) )
        ( LOCAL:r7 ( T:SQLiteStatement ) )

But I am getting no unit boxes when I do JimpleBody.getAllUnitBoxes()
on the same JimpleBody object in the same analysis (on a different
run).

Thanks!
Jiaqi


More information about the Soot-list mailing list