Skip to content

Commit 939bcef

Browse files
committed
support new writeMemory request
1 parent eb1e5d9 commit 939bcef

File tree

9 files changed

+125
-16
lines changed

9 files changed

+125
-16
lines changed

adapter/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adapter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-debugadapter",
33
"description": "Debug adapter implementation for node",
4-
"version": "1.47.0",
4+
"version": "1.48.0-pre.0",
55
"author": "Microsoft Corporation",
66
"license": "MIT",
77
"repository": {
@@ -19,7 +19,7 @@
1919
"typings": "./lib/main",
2020
"dependencies": {
2121
"mkdirp": "^0.5.5",
22-
"vscode-debugprotocol": "1.47.0"
22+
"vscode-debugprotocol": "1.48.0-pre.0"
2323
},
2424
"devDependencies": {
2525
"@types/mkdirp": "^0.5.2",

adapter/src/debugSession.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ export class DebugSession extends ProtocolServer {
583583
} else if (request.command === 'readMemory') {
584584
this.readMemoryRequest(<DebugProtocol.ReadMemoryResponse> response, request.arguments, request);
585585

586+
} else if (request.command === 'writeMemory') {
587+
this.writeMemoryRequest(<DebugProtocol.WriteMemoryResponse> response, request.arguments, request);
588+
586589
} else if (request.command === 'disassemble') {
587590
this.disassembleRequest(<DebugProtocol.DisassembleResponse> response, request.arguments, request);
588591

@@ -842,6 +845,10 @@ export class DebugSession extends ProtocolServer {
842845
this.sendResponse(response);
843846
}
844847

848+
protected writeMemoryRequest(response: DebugProtocol.WriteMemoryResponse, args: DebugProtocol.WriteMemoryArguments, request?: DebugProtocol.Request): void {
849+
this.sendResponse(response);
850+
}
851+
845852
protected disassembleRequest(response: DebugProtocol.DisassembleResponse, args: DebugProtocol.DisassembleArguments, request?: DebugProtocol.Request): void {
846853
this.sendResponse(response);
847854
}

debugProtocol.json

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@
20202020
"SetVariableRequest": {
20212021
"allOf": [ { "$ref": "#/definitions/Request" }, {
20222022
"type": "object",
2023-
"description": "Set the variable with the given name in the variable container to a new value. Clients should only call this request if the capability 'supportsSetVariable' is true.",
2023+
"description": "Set the variable with the given name in the variable container to a new value. Clients should only call this request if the capability 'supportsSetVariable' is true.\nIf a debug adapter implements both setVariable and setExpression, a client will only use setExpression if the variable has an evaluateName property.",
20242024
"properties": {
20252025
"command": {
20262026
"type": "string",
@@ -2412,7 +2412,7 @@
24122412
"SetExpressionRequest": {
24132413
"allOf": [ { "$ref": "#/definitions/Request" }, {
24142414
"type": "object",
2415-
"description": "Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value.\nThe expressions have access to any variables and arguments that are in scope of the specified frame.\nClients should only call this request if the capability 'supportsSetExpression' is true.",
2415+
"description": "Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value.\nThe expressions have access to any variables and arguments that are in scope of the specified frame.\nClients should only call this request if the capability 'supportsSetExpression' is true.\nIf a debug adapter implements both setExpression and setVariable, a client will only use setExpression if the variable has an evaluateName property.",
24162416
"properties": {
24172417
"command": {
24182418
"type": "string",
@@ -2779,6 +2779,67 @@
27792779
}]
27802780
},
27812781

2782+
"WriteMemoryRequest": {
2783+
"allOf": [ { "$ref": "#/definitions/Request" }, {
2784+
"type": "object",
2785+
"description": "Writes bytes to memory at the provided location.\nClients should only call this request if the capability 'supportsWriteMemoryRequest' is true.",
2786+
"properties": {
2787+
"command": {
2788+
"type": "string",
2789+
"enum": [ "writeMemory" ]
2790+
},
2791+
"arguments": {
2792+
"$ref": "#/definitions/WriteMemoryArguments"
2793+
}
2794+
},
2795+
"required": [ "command", "arguments" ]
2796+
}]
2797+
},
2798+
"WriteMemoryArguments": {
2799+
"type": "object",
2800+
"description": "Arguments for 'writeMemory' request.",
2801+
"properties": {
2802+
"memoryReference": {
2803+
"type": "string",
2804+
"description": "Memory reference to the base location to which data should be written."
2805+
},
2806+
"offset": {
2807+
"type": "integer",
2808+
"description": "Optional offset (in bytes) to be applied to the reference location before writing data. Can be negative."
2809+
},
2810+
"allowPartial": {
2811+
"type": "boolean",
2812+
"description": "Optional property to control partial writes. If true, the debug adapter should attempt to write memory even if the entire memory region is not writable. In such a case the debug adapter should stop after hitting the first byte of memory that cannot be written and return the number of bytes written in the response via the 'offset' and 'bytesWritten' properties.\nIf false or missing, a debug adapter should attempt to verify the region is writable before writing, and fail the response if it is not."
2813+
},
2814+
"data": {
2815+
"type": "string",
2816+
"description": "Bytes to write, encoded using base64."
2817+
}
2818+
},
2819+
"required": [ "memoryReference", "data" ]
2820+
},
2821+
"WriteMemoryResponse": {
2822+
"allOf": [ { "$ref": "#/definitions/Response" }, {
2823+
"type": "object",
2824+
"description": "Response to 'writeMemory' request.",
2825+
"properties": {
2826+
"body": {
2827+
"type": "object",
2828+
"properties": {
2829+
"offset": {
2830+
"type": "integer",
2831+
"description": "Optional property that should be returned when 'allowPartial' is true to indicate the offset of the first byte of data successfully written. Can be negative."
2832+
},
2833+
"bytesWritten": {
2834+
"type": "integer",
2835+
"description": "Optional property that should be returned when 'allowPartial' is true to indicate the number of bytes starting from address that were successfully written."
2836+
}
2837+
}
2838+
}
2839+
}
2840+
}]
2841+
},
2842+
27822843
"DisassembleRequest": {
27832844
"allOf": [ { "$ref": "#/definitions/Request" }, {
27842845
"type": "object",
@@ -2981,6 +3042,10 @@
29813042
"type": "boolean",
29823043
"description": "The debug adapter supports the 'readMemory' request."
29833044
},
3045+
"supportsWriteMemoryRequest": {
3046+
"type": "boolean",
3047+
"description": "The debug adapter supports the 'writeMemory' request."
3048+
},
29843049
"supportsDisassembleRequest": {
29853050
"type": "boolean",
29863051
"description": "The debug adapter supports the 'disassemble' request."

protocol/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protocol/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-debugprotocol",
33
"description": "Npm module with declarations for the Visual Studio Code debug protocol",
4-
"version": "1.47.0",
4+
"version": "1.48.0-pre.0",
55
"author": "Microsoft Corporation",
66
"license": "MIT",
77
"repository": {

protocol/src/debugProtocol.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,7 @@ export module DebugProtocol {
11261126

11271127
/** SetVariable request; value of command field is 'setVariable'.
11281128
Set the variable with the given name in the variable container to a new value. Clients should only call this request if the capability 'supportsSetVariable' is true.
1129+
If a debug adapter implements both setVariable and setExpression, a client will only use setExpression if the variable has an evaluateName property.
11291130
*/
11301131
export interface SetVariableRequest extends Request {
11311132
// command: 'setVariable';
@@ -1346,6 +1347,7 @@ export module DebugProtocol {
13461347
Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value.
13471348
The expressions have access to any variables and arguments that are in scope of the specified frame.
13481349
Clients should only call this request if the capability 'supportsSetExpression' is true.
1350+
If a debug adapter implements both setExpression and setVariable, a client will only use setExpression if the variable has an evaluateName property.
13491351
*/
13501352
export interface SetExpressionRequest extends Request {
13511353
// command: 'setExpression';
@@ -1538,6 +1540,39 @@ export module DebugProtocol {
15381540
};
15391541
}
15401542

1543+
/** WriteMemory request; value of command field is 'writeMemory'.
1544+
Writes bytes to memory at the provided location.
1545+
Clients should only call this request if the capability 'supportsWriteMemoryRequest' is true.
1546+
*/
1547+
export interface WriteMemoryRequest extends Request {
1548+
// command: 'writeMemory';
1549+
arguments: WriteMemoryArguments;
1550+
}
1551+
1552+
/** Arguments for 'writeMemory' request. */
1553+
export interface WriteMemoryArguments {
1554+
/** Memory reference to the base location to which data should be written. */
1555+
memoryReference: string;
1556+
/** Optional offset (in bytes) to be applied to the reference location before writing data. Can be negative. */
1557+
offset?: number;
1558+
/** Optional property to control partial writes. If true, the debug adapter should attempt to write memory even if the entire memory region is not writable. In such a case the debug adapter should stop after hitting the first byte of memory that cannot be written and return the number of bytes written in the response via the 'offset' and 'bytesWritten' properties.
1559+
If false or missing, a debug adapter should attempt to verify the region is writable before writing, and fail the response if it is not.
1560+
*/
1561+
allowPartial?: boolean;
1562+
/** Bytes to write, encoded using base64. */
1563+
data: string;
1564+
}
1565+
1566+
/** Response to 'writeMemory' request. */
1567+
export interface WriteMemoryResponse extends Response {
1568+
body?: {
1569+
/** Optional property that should be returned when 'allowPartial' is true to indicate the offset of the first byte of data successfully written. Can be negative. */
1570+
offset?: number;
1571+
/** Optional property that should be returned when 'allowPartial' is true to indicate the number of bytes starting from address that were successfully written. */
1572+
bytesWritten?: number;
1573+
};
1574+
}
1575+
15411576
/** Disassemble request; value of command field is 'disassemble'.
15421577
Disassembles code stored at the provided location.
15431578
Clients should only call this request if the capability 'supportsDisassembleRequest' is true.
@@ -1633,6 +1668,8 @@ export module DebugProtocol {
16331668
supportsDataBreakpoints?: boolean;
16341669
/** The debug adapter supports the 'readMemory' request. */
16351670
supportsReadMemoryRequest?: boolean;
1671+
/** The debug adapter supports the 'writeMemory' request. */
1672+
supportsWriteMemoryRequest?: boolean;
16361673
/** The debug adapter supports the 'disassemble' request. */
16371674
supportsDisassembleRequest?: boolean;
16381675
/** The debug adapter supports the 'cancel' request. */

testSupport/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testSupport/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-debugadapter-testsupport",
33
"description": "Npm module with mocha test support for Visual Studio Code debug adapters",
4-
"version": "1.47.0",
4+
"version": "1.48.0-pre.0",
55
"author": "Microsoft Corporation",
66
"license": "MIT",
77
"repository": {
@@ -14,7 +14,7 @@
1414
"main": "./lib/main.js",
1515
"typings": "./lib/main",
1616
"dependencies": {
17-
"vscode-debugprotocol": "^1.47.0"
17+
"vscode-debugprotocol": "^1.48.0-pre.0"
1818
},
1919
"devDependencies": {
2020
"@types/node": "8.9.3",

0 commit comments

Comments
 (0)