Wasm: fix bugs in debugger

This commit is contained in:
Alexey Andreev 2022-12-15 17:27:14 +01:00
parent fb39de72cc
commit 506a9bd8c5
3 changed files with 7 additions and 3 deletions

View File

@ -26,7 +26,7 @@ public class FunctionControlFlowIterator {
FunctionControlFlowIterator(FunctionControlFlow controlFlow, int index) { FunctionControlFlowIterator(FunctionControlFlow controlFlow, int index) {
this.controlFlow = controlFlow; this.controlFlow = controlFlow;
this.index = 0; this.index = index;
} }
public boolean hasNext() { public boolean hasNext() {
@ -39,7 +39,10 @@ public class FunctionControlFlowIterator {
} }
public void rewind(int index) { public void rewind(int index) {
this.index = index; if (this.index != index) {
this.index = index;
fill();
}
} }
private void fill() { private void fill() {

View File

@ -176,7 +176,7 @@ public class StepLocationsFinder {
breakpointAddresses.add(point.address + debugInfo.offset()); breakpointAddresses.add(point.address + debugInfo.offset());
return; return;
} }
if (enterMethod) { if (enterMethod && point.isCall) {
breakpointAddresses.add(point.address + debugInfo.offset()); breakpointAddresses.add(point.address + debugInfo.offset());
callAddresses.add(point.address + debugInfo.offset()); callAddresses.add(point.address + debugInfo.offset());
} }

View File

@ -967,6 +967,7 @@ class WasmBinaryRenderingVisitor implements WasmExpressionVisitor {
emitLocation(null); emitLocation(null);
flushLocation(); flushLocation();
if (debugLines != null) { if (debugLines != null) {
debugLines.advance(writer.getPosition() + addressOffset);
debugLines.end(); debugLines.end();
} }
} }