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

Tillmann tirunkel at informatik.uni-bremen.de
Tue Dec 13 05:11:57 EST 2011


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  }



More information about the Soot-list mailing list