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

Jiaqi Tan jiaqit at andrew.cmu.edu
Thu Oct 18 13:13:10 EDT 2012


Hi Eric,

Thanks for the answer.

I guess what I'm confused about is, for a given JimpleBody in a
BodyTransformer, what's the difference between getAllUnitBoxes() and
getUseBoxes()?

If I'm getting UseBoxes that do not show up in any of the UnitBoxes
from getAllUnitBoxes(), does that mean that there are values that are
created but not used? Then what is the relationship between Stmt's and
the Boxes? Are all UseBoxes and DefBoxes contained within all Stmts
returned from getAllUnitBoxes()?

I'm guessing "use" here means use in a Use-Def sense.

Thanks,
Jiaqi

On Thu, Oct 18, 2012 at 12:06 PM, Eric Bodden <eric.bodden at ec-spride.de> wrote:
> Hi.
>
> A use box is a value around a right-hand-side value, i.e., a value
> that is *used*. A unit box is just a box around any kind of statement.
>
> Eric
>
> On 18 October 2012 17:58, Jiaqi Tan <jiaqit at andrew.cmu.edu> wrote:
>> 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
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
>
> --
> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
> Head of Secure Software Engineering Group at EC SPRIDE
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list