Eric,

To add to Arrin's reply, when I do this I start from an
InstructionHandle. It has been a while since I have looked at my code
for this, but if I remember correctly from an InstructionHandle you can
retrieve both the instruction its self and the instructions pc (which I
believe is the method getPosition()). E.g. (roughly)

InstructionHandle ih = <however you get the handle, make it, etc>;
LocalVariable v =
<LocalVariableTable>.getLocalVariable(ih.getInstruction().getIndex(),
ih.getPosition());
<do whatever with v>

This may not be the "best" way, but it works how I have used it so far.
Note that if the pc is 0 (and I remember correctly) it is one of the
arguments of the method, which may or may not be useful information
depending on what you are doing with the variable.

Hope that helps
Mac

-----Original Message-----
From: Eric Sheridan [mailto:[EMAIL PROTECTED] 
Sent: 26 July 2007 01:32
To: [email protected]
Subject: getLocalVariable help

Group,

I am a relatively new BCEL user and I am trying to invoke the
getLocalVariable(int index, int pc) method on the LocalVariableTable
object. I am unable to determine how to access the current pc, the
second parameter required for the method. What is the best way to obtain
this value?

Thanks in advance for everyone's help!

-Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to