mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 08:34:11 -08:00
Fixes bugs in stepping over
This commit is contained in:
parent
4115785823
commit
c0dc459f22
|
@ -325,10 +325,9 @@ public class DebugInformation {
|
||||||
FileDescription build() {
|
FileDescription build() {
|
||||||
FileDescription description = new FileDescription();
|
FileDescription description = new FileDescription();
|
||||||
description.generatedLocationData = new int[generatedLocationData.size()];
|
description.generatedLocationData = new int[generatedLocationData.size()];
|
||||||
description.generatedLocationStart = new int[generatedLocationStart.size()];
|
description.generatedLocationStart = new int[generatedLocationStart.size() + 1];
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i = 0; i < generatedLocationStart.size(); ++i) {
|
for (int i = 0; i < generatedLocationStart.size(); ++i) {
|
||||||
description.generatedLocationStart[i] = current;
|
|
||||||
current += generatedLocationSize.get(i) * 2;
|
current += generatedLocationSize.get(i) * 2;
|
||||||
int j = current;
|
int j = current;
|
||||||
int ptr = generatedLocationStart.get(i);
|
int ptr = generatedLocationStart.get(i);
|
||||||
|
@ -336,6 +335,7 @@ public class DebugInformation {
|
||||||
description.generatedLocationData[--j] = generatedLocationData.get(ptr);
|
description.generatedLocationData[--j] = generatedLocationData.get(ptr);
|
||||||
ptr = generatedLocationPointers.get(ptr);
|
ptr = generatedLocationPointers.get(ptr);
|
||||||
}
|
}
|
||||||
|
description.generatedLocationStart[i + 1] = current;
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
|
||||||
IntegerArray linesChunk = new IntegerArray(1);
|
IntegerArray linesChunk = new IntegerArray(1);
|
||||||
IntegerArray filesChunk = new IntegerArray(1);
|
IntegerArray filesChunk = new IntegerArray(1);
|
||||||
int ptr = start.get(i);
|
int ptr = start.get(i);
|
||||||
while (ptr > 0) {
|
while (ptr >= 0) {
|
||||||
linesChunk.add(lines.get(ptr));
|
linesChunk.add(lines.get(ptr));
|
||||||
filesChunk.add(files.get(ptr));
|
filesChunk.add(files.get(ptr));
|
||||||
ptr = next.get(ptr);
|
ptr = next.get(ptr);
|
||||||
|
@ -361,7 +361,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
|
||||||
int distinctSize = 0;
|
int distinctSize = 0;
|
||||||
for (int j = 0; j < pairs.length; ++j) {
|
for (int j = 0; j < pairs.length; ++j) {
|
||||||
long pair = pairs[j];
|
long pair = pairs[j];
|
||||||
if (distinctSize == 0 || pair != pairs[distinctSize]) {
|
if (distinctSize == 0 || pair != pairs[distinctSize - 1]) {
|
||||||
pairs[distinctSize++] = pair;
|
pairs[distinctSize++] = pair;
|
||||||
filesData.add((int)(pair >>> 32));
|
filesData.add((int)(pair >>> 32));
|
||||||
linesData.add((int)pair);
|
linesData.add((int)pair);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package org.teavm.model.util;
|
package org.teavm.model.util;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import org.teavm.model.*;
|
import org.teavm.model.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +26,8 @@ import org.teavm.model.*;
|
||||||
public class ListingBuilder {
|
public class ListingBuilder {
|
||||||
public String buildListing(ProgramReader program, String prefix) {
|
public String buildListing(ProgramReader program, String prefix) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
InstructionStringifier stringifier = new InstructionStringifier(sb);
|
StringBuilder insnSb = new StringBuilder();
|
||||||
|
InstructionStringifier stringifier = new InstructionStringifier(insnSb);
|
||||||
for (int i = 0; i < program.variableCount(); ++i) {
|
for (int i = 0; i < program.variableCount(); ++i) {
|
||||||
sb.append(prefix).append("var @").append(i);
|
sb.append(prefix).append("var @").append(i);
|
||||||
VariableReader var = program.variableAt(i);
|
VariableReader var = program.variableAt(i);
|
||||||
|
@ -59,10 +61,16 @@ public class ListingBuilder {
|
||||||
}
|
}
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
|
InstructionLocation location = null;
|
||||||
for (int j = 0; j < block.instructionCount(); ++j) {
|
for (int j = 0; j < block.instructionCount(); ++j) {
|
||||||
sb.append(prefix).append(" ");
|
insnSb.setLength(0);
|
||||||
block.readInstruction(j, stringifier);
|
block.readInstruction(j, stringifier);
|
||||||
sb.append("\n");
|
if (!Objects.equals(location, stringifier.getLocation())) {
|
||||||
|
location = stringifier.getLocation();
|
||||||
|
sb.append(prefix).append(" at ").append(location != null ? location.toString() :
|
||||||
|
"unknown location").append('\n');
|
||||||
|
}
|
||||||
|
sb.append(prefix).append(" ").append(insnSb).append("\n");
|
||||||
}
|
}
|
||||||
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) {
|
for (TryCatchBlockReader tryCatch : block.readTryCatchBlocks()) {
|
||||||
sb.append(prefix).append(" catch ").append(tryCatch.getExceptionType()).append(" @")
|
sb.append(prefix).append(" catch ").append(tryCatch.getExceptionType()).append(" @")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user