src/debugAdapter: send stopped events from continue on breakpoint only
The callback function for continue assumed that the reason the callback
was called was a breakpoint. However, a pause or disconnection also result
in the continue callback being called.
This change checks to see if the current thread is stopped on a
breakpoint, and will only stop the threads and notify the client if
this is true.
Fixes golang/vscode-go#149 and golang/vscode-go#172
Change-Id: Ic9c747db4cac136828d3879bbd95c2e00fe84659
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/253578
Trust: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Polina Sokolova <polina@google.com>
diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts
index 35dbe09..b6cc94a 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -85,11 +85,10 @@
interface DebuggerState {
exited: boolean;
exitStatus: number;
- breakPoint: DebugBreakpoint;
- breakPointInfo: {};
currentThread: DebugThread;
currentGoroutine: DebugGoroutine;
Running: boolean;
+ Threads: DebugThread[];
}
export interface PackageBuildInfo {
@@ -150,6 +149,8 @@
line: number;
pc: number;
goroutineID: number;
+ breakPoint: DebugBreakpoint;
+ breakPointInfo: {};
function?: DebugFunction;
ReturnValues: DebugVariable[];
}
@@ -2195,7 +2196,13 @@
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
log('continue state', state);
this.debugState = state;
- this.handleReenterDebug('breakpoint');
+
+ // Check if the current thread was stopped on a breakpoint.
+ // Other stopping events (eg pause) create their own StoppedEvents,
+ // if necessary.
+ if (!!state.currentThread.breakPoint) {
+ this.handleReenterDebug('breakpoint');
+ }
};
// If called when setting breakpoint internally, we want the error to bubble up.