Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Check remote debug server API version
Browse files Browse the repository at this point in the history
  • Loading branch information
lggomez committed May 15, 2018
1 parent fc88177 commit bcb89e4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ interface CreateBreakpointOut {
breakpoint: DebugBreakpoint;
}

interface GetVersionOut {
DelveVersion: string;
APIVersion: number;
}

interface DebugBreakpoint {
addr: number;
continue: boolean;
Expand Down Expand Up @@ -552,6 +557,20 @@ class GoDebugSession extends DebugSession {
};

this.delve.connection.then(() => {
this.delve.call<GetVersionOut>('GetVersion', [], (err, out) => {
if (err) {
logError(err);
return this.sendErrorResponse(response, 2001, 'Failed to get remote server version: "{e}"', { e: err.toString() });
}
let clientVersion = this.delve.isApiV1 ? 1 : 2;
if (out.APIVersion !== clientVersion) {
logError(`Failed to get version: The remote server is running on delve v${out.APIVersion} API and the client is running v${clientVersion} API`);
return this.sendErrorResponse(response,
3000,
'Failed to get version: The remote server is running on delve v{cli} API and the client is running v{ser} API',
{ ser: out.APIVersion.toString(), cli: clientVersion });
}
});
if (!this.delve.noDebug) {
this.sendEvent(new InitializedEvent());
verbose('InitializeEvent');
Expand Down

0 comments on commit bcb89e4

Please sign in to comment.