[Soot-list] Re: Global variables in soot

John Chaitanya Kati johnkati at cse.iitb.ac.in
Fri May 4 14:38:31 EDT 2007


for my below program, jimple is giving the following output
 	int i0, i1, $i2, $i3;
         $i2 = <Test: int a>;
         i1 = $i2 * i0;

so its treating $i2 as local since its getting declared. But actually it 
represents variable 'a' which is global. I need this information for 
interprocedural available expression analysis. So how do i resolve it ?




On Fri, 4 May 2007, Eric Bodden wrote:

> Ok, so what you mean by global variables are actually fields. it's as
> I said: local variables are represented by soot.Local's and
> fields/global variables by soot.jimple.FieldRef's.
>
> Eric
>
> On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
>> By global variables i meant, which are available to all the methods of the
>> class.
>> class Test
>> {       static public int a=5;
>>         static public void main(String args[])
>>         {
>>                 int b=10,c;
>>                 c = a*b;
>>                 add(a,b);
>>         }
>>         static void add(int i, int j)
>>         {
>>                 i=i+j;
>>                 a=15;
>>         }
>> }
>> a is global, b,c are local to main. I want to find out such variables.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Fri, 4 May 2007, Eric Bodden wrote:
>> 
>> > What's a global variable?
>> >
>> > Soot knows variables of type soot.Local. Those are obviously local.
>> > Then there also are field references, which are obviously field
>> > references. Are those what you mean by global? (Of course, a local can
>> > well be assigned a field reference, the same way as it can happen in
>> > Java code.)
>> >
>> > Eric
>> >
>> > On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
>> >> Hi,
>> >>    Is there a way to find out if a variable is global or not in soot ?
>> >>
>> >> --
>> >> Thanks for any help in advance
>> >> John Chaitanya
>> >>
>> >
>> >
>> >
>> 
>> --
>> 
>> Thanks
>> John Chaitanya
>> Like a rose trampled on the ground, you took the fall and thought of me...
>> 
>
>
>

-- 

Thanks
John Chaitanya
Like a rose trampled on the ground, you took the fall and thought of me...


More information about the Soot-list mailing list