Re: Is there a way to uniquely identify a local variable in BCEL?

"Dave Brosius" <[email protected]> Tue, 30 May 2006 01:08:47 -0400
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <003e01c683a7$2223b3a0$6501a8c0@MeBigFatGuy>
In class LocalVariableTable
public final LocalVariable getLocalVariable( int index, int pc )

will return the localvariable at the pc specified. This is new to 5.2

And yes -g is required.


----- Original Message ----- 
From: "Wassim Masri" <[email protected]>
To: <[email protected]>
Sent: Monday, May 29, 2006 3:33 PM
Subject: Is there a way to uniquely identify a local variable in BCEL?


> Dear All,
>
> Is there a way to uniquely identify a local variable in BCEL?
>
> For instance, in the example below both of the variables x2 and x3 have an 
> index
> equal to 2. So, we cannot rely on the index alone.
>
> static void foo( )
> {
> int x1= 0;
> if (x1 >= 0)
> {
> int x2 = 0;
> }
>
> int x3 = 0;
> }
>
> I looked into using the scope (LocalVariableGen.getStart() and
> LocalVariableGen.getEnd()) in addition to the index, but there does not 
> seem to
> be a way to get this information from LocalVariableInstruction.
>
> In a related (but less critical) matter, it seems that the scope 
> information is
> only accessible when I compile the target code with the '-g' switch on.
>
> Your help is really appreciated.
>
> Wes
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>