BytecodeParser icon indicating copy to clipboard operation
BytecodeParser copied to clipboard

Problem about DecodedLocalVariableOp.localVariable

Open comaniac opened this issue 9 years ago • 0 comments

Hi,

I'm a new user of this package. I'm now trying to retrieve the information of local variables as the sample you show on the website http://stephane.godbillon.com/BytecodeParser/.

The problem I encountered when doing this is that I cannot get the local variable for LOAD instructions. Specifically, I use the following code to retrieve the information I want:

@Override
public void handle(Op op, int idx) {
  if ((op instanceof LocalVariableOpcode) == false)
    return ;

  LocalVariableOpcode lv = op.as(LocalVariableOpcode.class);
  LocalVariable lvInfo = lv.decode(context, idx).localVariable;
  System.out.println(idx + " " + lvInfo.toString() + ": " + lvInfo.name);
}

However, I got NullPointerException of lvInfo when parsing the instruction ILOAD 5 in my program. Is it due to some wrong manipulations or restrictions?

Thanks.

comaniac avatar Dec 08 '15 00:12 comaniac