mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
debugger: instruction parser should stop on code offset, not instruction index
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,21 +22,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class InstructionParser {
|
||||
private final byte[] myCode;
|
||||
private final long myCurrentInstructionIndex;
|
||||
private final long myStopOffset;
|
||||
|
||||
public InstructionParser(byte[] code, long instructionIndex) {
|
||||
public InstructionParser(byte[] code, long stopOffset) {
|
||||
myCode = code;
|
||||
myCurrentInstructionIndex = instructionIndex;
|
||||
myStopOffset = stopOffset;
|
||||
}
|
||||
|
||||
public void parse() {
|
||||
final int codeEnd = myCode.length;
|
||||
int v = 0;
|
||||
int instructionIndex = 0;
|
||||
while (v < codeEnd) {
|
||||
if (instructionIndex++ >= myCurrentInstructionIndex) {
|
||||
break;
|
||||
}
|
||||
while (v < myStopOffset) {
|
||||
int opcode = myCode[v] & 0xFF;
|
||||
final byte opcodeType = opcode == Bytecodes.IMPDEP1 || opcode == Bytecodes.IMPDEP2? Bytecodes.NOARG_INSN : Bytecodes.TYPE[opcode];
|
||||
switch (opcodeType) {
|
||||
|
||||
@@ -242,9 +242,8 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
final byte[] bytecodes = method.bytecodes();
|
||||
if (bytecodes != null && bytecodes.length > 0) {
|
||||
final int firstLocalVariableSlot = ArgumentValueDescriptorImpl.getFirstLocalsSlot(method);
|
||||
final long instructionIndex = location.codeIndex();
|
||||
final TIntObjectHashMap<DecompiledLocalVariable> usedVars = new TIntObjectHashMap<DecompiledLocalVariable>();
|
||||
new InstructionParser(bytecodes, instructionIndex) {
|
||||
new InstructionParser(bytecodes, location.codeIndex()) {
|
||||
@Override
|
||||
protected void localVariableInstructionFound(int opcode, int slot, String typeSignature) {
|
||||
if (slot >= firstLocalVariableSlot) {
|
||||
|
||||
Reference in New Issue
Block a user