fix: detach debugger after close
This commit is contained in:
parent
7cb267b0d9
commit
c291328cc3
@ -36,6 +36,10 @@ public class DebugContext {
|
|||||||
this.debugger = debugger;
|
this.debugger = debugger;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
public boolean detachDebugger(DebugHandler debugger) {
|
||||||
|
if (this.debugger != debugger) return false;
|
||||||
|
return detachDebugger();
|
||||||
|
}
|
||||||
public boolean detachDebugger() {
|
public boolean detachDebugger() {
|
||||||
this.debugger = null;
|
this.debugger = null;
|
||||||
return true;
|
return true;
|
||||||
|
@ -205,6 +205,7 @@ public class SimpleDebugger implements Debugger {
|
|||||||
|
|
||||||
private ObjectValue emptyObject = new ObjectValue();
|
private ObjectValue emptyObject = new ObjectValue();
|
||||||
|
|
||||||
|
private WeakHashMap<DebugContext, DebugContext> contexts = new WeakHashMap<>();
|
||||||
private WeakHashMap<FunctionBody, FunctionMap> mappings = new WeakHashMap<>();
|
private WeakHashMap<FunctionBody, FunctionMap> mappings = new WeakHashMap<>();
|
||||||
private WeakHashMap<FunctionBody, HashMap<Location, Breakpoint>> bpLocs = new WeakHashMap<>();
|
private WeakHashMap<FunctionBody, HashMap<Location, Breakpoint>> bpLocs = new WeakHashMap<>();
|
||||||
|
|
||||||
@ -642,11 +643,10 @@ public class SimpleDebugger implements Debugger {
|
|||||||
execptionType = CatchType.NONE;
|
execptionType = CatchType.NONE;
|
||||||
state = State.RESUMED;
|
state = State.RESUMED;
|
||||||
|
|
||||||
// idToBptCand.clear();
|
mappings.clear();
|
||||||
|
bpLocs.clear();
|
||||||
|
|
||||||
idToBreakpoint.clear();
|
idToBreakpoint.clear();
|
||||||
// locToBreakpoint.clear();
|
|
||||||
// tmpBreakpts.clear();
|
|
||||||
|
|
||||||
filenameToId.clear();
|
filenameToId.clear();
|
||||||
idToSource.clear();
|
idToSource.clear();
|
||||||
@ -664,6 +664,9 @@ public class SimpleDebugger implements Debugger {
|
|||||||
stepOutFrame = currFrame = null;
|
stepOutFrame = currFrame = null;
|
||||||
stepOutPtr = 0;
|
stepOutPtr = 0;
|
||||||
|
|
||||||
|
for (var ctx : contexts.keySet()) ctx.detachDebugger(this);
|
||||||
|
contexts.clear();
|
||||||
|
|
||||||
updateNotifier.next();
|
updateNotifier.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1041,6 +1044,7 @@ public class SimpleDebugger implements Debugger {
|
|||||||
|
|
||||||
public SimpleDebugger attach(DebugContext ctx) {
|
public SimpleDebugger attach(DebugContext ctx) {
|
||||||
ctx.attachDebugger(this);
|
ctx.attachDebugger(this);
|
||||||
|
contexts.put(ctx, ctx);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user