[Soot-list] Getting line-number/type-informations at initialization via Jimple from bytecode

Eric Bodden eric.bodden at ec-spride.de
Tue Dec 13 06:35:03 EST 2011


Hi Tillmann.

One thing you could try is to use "-p jb keep-original-names:on". This
will cause Soot to try to pack together locals that have the same
name.

In general, the problem you are seeing is caused by the fact that
bytecode has no local variables, just stack locations.

Eric

On 13 December 2011 11:11, Tillmann <tirunkel at informatik.uni-bremen.de> wrote:
> Hi,
>
> today i have a problem to get informations about the initialisation of a
> variable. I need to find the src-line where the variable of a special
> type is initialized. In my example below i need the line- and
> type-information of the Java-source (3: String str = null;). In the
> corresponding Jimple (generated from class!) the equivalent line is  (9:
> n1 = null;) where "n1" is "null_type" in the corresponding unit
> @internalTransform the line-number is available, but not the type (in my
> example java.lang.String) and as proved this information isn't provided
> by the JimpleLocals @body.getLocals(). The long and the short of it: I
> need the information that "r1 is initalized by n1 in src-line 3" (lines
> 10 and 8 in Jimple). I think these informations must be available from
> bytecode compiled with "-g".
>
> Is there a known way to get these informations about line 3 in my
> Java-Example?
>
> Thanks.
>
> Tillmann
>
> ------ Java:
>
> 1    public String doSomething(){
> 2       Item x = null;
> 3       String str = null;
> 4       if (true){
> 5           str = x.toString();
> 6           str.concat("");
> 7       }
> 8    return str;
> 9    }
>
> ------ Jimple:
>
>  1   public java.lang.String doSomething()
>  2   {
>  3      de.tirunkel.da.examples.Test r0;
>  4       null_type n0, n1;
>  5       java.lang.String r1;
>  6
>  7       r0 := @this: de.tirunkel.da.examples.Test;
>  8       n0 = null;
>  9       n1 = null;
>  10     r1 = virtualinvoke n0.<java.lang.Object: java.lang.String
> toString()>();
>  11     virtualinvoke r1.<java.lang.String: java.lang.String
> concat(java.lang.String)>("");
>  12     return r1;
>  13  }
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
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