[Soot-list] Clinits encountered in an inter-procedural analysis
Ondrej Lhotak
olhotak at uwaterloo.ca
Mon Jul 17 16:01:27 EDT 2006
On Mon, Jul 17, 2006 at 03:47:57PM -0400, Ahmer Ahmedani wrote:
> Hi,
>
> I am writing a context-sensitive inter-procedural analysis which begins at
> the main method and then follows the called method edges.
>
> In the example below, the field j of class Two is accessed for the first
> time at the statement myInt2 = Two.j
>
> The analysis, even though it follows the edges in the call graph, does not
> go into the clinit method for class Two. I am not sure why since class Two
> is touched for the first time at the mentioned statement.
>
> Can you think of a plausible reason.
The jap.cgtagger phase may be helpful: it adds annotations indicating
call graph edges. If you're outputting Jimple, use the -print-tags
option to cause Soot to print annotations as comments in the generated
Jimple.
Running Soot on your example, I do see a call edge to the CLINIT method
being generated:
public static void main(java.lang.String[])
{
java.lang.String[] args;
int myInt, myInt2, $i0;
Two obj1, obj2, $r0, $r1;
args := @parameter0: java.lang.String[];
myInt2 = <Two: int j>;
/*CallGraph: Type: CLINIT Target Method/Context: <Two: void <clinit>()>*/
...
Ondrej
>
> Regards,
> Ahmer
>
> public class FirstTest{
> @High public static int x = 100;
>
>
> public static void main (String[] args){
> int myInt, myInt2;
> myInt2 = Two.j;
> Two obj1, obj2;
> obj1 = new Two();
> obj2 = new Two();
> obj1.i = x;
> obj2.i = 4;
> myInt = obj2.i;
> }
> }
>
> class Two{
> public int i;
> public static int j = 50;
> public Two(){
> }
> }
>
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
More information about the Soot-list
mailing list