mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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 description = new FileDescription();
|
||||
description.generatedLocationData = new int[generatedLocationData.size()];
|
||||
description.generatedLocationStart = new int[generatedLocationStart.size()];
|
||||
description.generatedLocationStart = new int[generatedLocationStart.size() + 1];
|
||||
int current = 0;
|
||||
for (int i = 0; i < generatedLocationStart.size(); ++i) {
|
||||
description.generatedLocationStart[i] = current;
|
||||
current += generatedLocationSize.get(i) * 2;
|
||||
int j = current;
|
||||
int ptr = generatedLocationStart.get(i);
|
||||
|
@ -336,6 +335,7 @@ public class DebugInformation {
|
|||
description.generatedLocationData[--j] = generatedLocationData.get(ptr);
|
||||
ptr = generatedLocationPointers.get(ptr);
|
||||
}
|
||||
description.generatedLocationStart[i + 1] = current;
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
|
|||
IntegerArray linesChunk = new IntegerArray(1);
|
||||
IntegerArray filesChunk = new IntegerArray(1);
|
||||
int ptr = start.get(i);
|
||||
while (ptr > 0) {
|
||||
while (ptr >= 0) {
|
||||
linesChunk.add(lines.get(ptr));
|
||||
filesChunk.add(files.get(ptr));
|
||||
ptr = next.get(ptr);
|
||||
|
@ -361,7 +361,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
|
|||
int distinctSize = 0;
|
||||
for (int j = 0; j < pairs.length; ++j) {
|
||||
long pair = pairs[j];
|
||||
if (distinctSize == 0 || pair != pairs[distinctSize]) {
|
||||
if (distinctSize == 0 || pair != pairs[distinctSize - 1]) {
|
||||
pairs[distinctSize++] = pair;
|
||||
filesData.add((int)(pair >>> 32));
|
||||
linesData.add((int)pair);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.teavm.model.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.teavm.model.*;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +26,8 @@ import org.teavm.model.*;
|
|||
public class ListingBuilder {
|
||||
public String buildListing(ProgramReader program, String prefix) {
|
||||
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) {
|
||||
sb.append(prefix).append("var @").append(i);
|
||||
VariableReader var = program.variableAt(i);
|
||||
|
@ -59,10 +61,16 @@ public class ListingBuilder {
|
|||
}
|
||||
sb.append("\n");
|
||||
}
|
||||
InstructionLocation location = null;
|
||||
for (int j = 0; j < block.instructionCount(); ++j) {
|
||||
sb.append(prefix).append(" ");
|
||||
insnSb.setLength(0);
|
||||
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()) {
|
||||
sb.append(prefix).append(" catch ").append(tryCatch.getExceptionType()).append(" @")
|
||||
|
|
Loading…
Reference in New Issue
Block a user