mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Wasm: fix issues in debugger
This commit is contained in:
parent
6808d9e517
commit
6c91192794
|
@ -162,6 +162,17 @@ public class Debugger {
|
||||||
return Promise.allVoid(jsBreakpointPromises);
|
return Promise.allVoid(jsBreakpointPromises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Promise<Void> destroyTemporaryBreakpoints() {
|
||||||
|
var temporaryBreakpoints = new ArrayList<>(this.temporaryBreakpoints);
|
||||||
|
this.temporaryBreakpoints.clear();
|
||||||
|
var promises = new ArrayList<Promise<Void>>();
|
||||||
|
for (var jsBreakpoint : temporaryBreakpoints) {
|
||||||
|
promises.add(jsBreakpoint.destroy());
|
||||||
|
}
|
||||||
|
callStack = null;
|
||||||
|
return Promise.allVoid(promises);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean addJsBreakpoints(CallFrame frame, JavaScriptScript script, boolean enterMethod,
|
private boolean addJsBreakpoints(CallFrame frame, JavaScriptScript script, boolean enterMethod,
|
||||||
Set<JavaScriptLocation> successors) {
|
Set<JavaScriptLocation> successors) {
|
||||||
var debugInfo = debugInformationMap.get(script);
|
var debugInfo = debugInformationMap.get(script);
|
||||||
|
@ -197,10 +208,10 @@ public class Debugger {
|
||||||
var callAddresses = IntHashSet.from(wasmStepLocationsFinder.getCallAddresses());
|
var callAddresses = IntHashSet.from(wasmStepLocationsFinder.getCallAddresses());
|
||||||
var result = createTemporaryBreakpoints(locations, br -> {
|
var result = createTemporaryBreakpoints(locations, br -> {
|
||||||
if (br != null && br.isValid() && callAddresses.contains(br.getLocation().getColumn())) {
|
if (br != null && br.isValid() && callAddresses.contains(br.getLocation().getColumn())) {
|
||||||
javaScriptDebugger.stepInto();
|
destroyTemporaryBreakpoints().thenVoid(x -> javaScriptDebugger.stepInto());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
return result.thenVoid(x -> javaScriptDebugger.stepOut());
|
return result.thenVoid(x -> javaScriptDebugger.stepOut());
|
||||||
}
|
}
|
||||||
|
@ -659,16 +670,9 @@ public class Debugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void firePaused(JavaScriptBreakpoint breakpoint) {
|
private void firePaused(JavaScriptBreakpoint breakpoint) {
|
||||||
var temporaryBreakpoints = new ArrayList<>(this.temporaryBreakpoints);
|
|
||||||
var handler = temporaryBreakpointHandler;
|
var handler = temporaryBreakpointHandler;
|
||||||
this.temporaryBreakpoints.clear();
|
|
||||||
temporaryBreakpointHandler = null;
|
temporaryBreakpointHandler = null;
|
||||||
var promises = new ArrayList<Promise<Void>>();
|
|
||||||
for (var jsBreakpoint : temporaryBreakpoints) {
|
|
||||||
promises.add(jsBreakpoint.destroy());
|
|
||||||
}
|
|
||||||
callStack = null;
|
callStack = null;
|
||||||
Promise.allVoid(promises).thenVoid(v -> {
|
|
||||||
Breakpoint javaBreakpoint = null;
|
Breakpoint javaBreakpoint = null;
|
||||||
JavaScriptBreakpoint tmpBreakpoint = null;
|
JavaScriptBreakpoint tmpBreakpoint = null;
|
||||||
if (breakpoint != null) {
|
if (breakpoint != null) {
|
||||||
|
@ -679,12 +683,14 @@ public class Debugger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (handler == null || !handler.test(tmpBreakpoint)) {
|
if (handler == null || !handler.test(tmpBreakpoint)) {
|
||||||
|
var pausedAtBreakpoint = javaBreakpoint;
|
||||||
|
destroyTemporaryBreakpoints().thenVoid(v -> {
|
||||||
for (var listener : getListeners()) {
|
for (var listener : getListeners()) {
|
||||||
listener.paused(javaBreakpoint);
|
listener.paused(pausedAtBreakpoint);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void fireAttached() {
|
private void fireAttached() {
|
||||||
for (Breakpoint breakpoint : breakpoints) {
|
for (Breakpoint breakpoint : breakpoints) {
|
||||||
|
|
|
@ -484,9 +484,10 @@ public class ChromeRDPDebugger extends BaseChromeRDPDebugger implements JavaScri
|
||||||
return new RDPValue(this, null, remoteValue.getType(), remoteValue.getObjectId(),
|
return new RDPValue(this, null, remoteValue.getType(), remoteValue.getObjectId(),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
return new RDPValue(this, remoteValue.getValue().asText(), remoteValue.getType(),
|
var valueAsText = remoteValue.getValue() != null ? remoteValue.getValue().asText() : "null";
|
||||||
remoteValue.getObjectId(), false);
|
return new RDPValue(this, valueAsText, remoteValue.getType(), remoteValue.getObjectId(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user