Skip to content

Commit 9e7ecde

Browse files
committed
add DAP's memory event
1 parent cfefe5f commit 9e7ecde

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

debugProtocol.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,38 @@
691691
}]
692692
},
693693

694+
"MemoryEvent": {
695+
"allOf": [ { "$ref": "#/definitions/Event" }, {
696+
"type": "object",
697+
"description": "This event indicates that some memory range has been updated. It should only be sent if the debug adapter has received a value true for the `supportsMemoryEvent` capability of the `initialize` request.\nClients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap.\nDebug adapters can use this event to indicate that the contents of a memory range has changed due to some other DAP request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events.",
698+
"properties": {
699+
"event": {
700+
"type": "string",
701+
"enum": [ "memory" ]
702+
},
703+
"body": {
704+
"type": "object",
705+
"properties": {
706+
"memoryReference": {
707+
"type": "string",
708+
"description": "Memory reference of a memory range that has been updated."
709+
},
710+
"offset": {
711+
"type": "integer",
712+
"description": "Starting offset in bytes where memory has been updated. Can be negative."
713+
},
714+
"count": {
715+
"type": "integer",
716+
"description": "Number of bytes updated."
717+
}
718+
},
719+
"required": [ "memoryReference", "offset", "count" ]
720+
}
721+
},
722+
"required": [ "event", "body" ]
723+
}]
724+
},
725+
694726
"RunInTerminalRequest": {
695727
"allOf": [ { "$ref": "#/definitions/Request" }, {
696728
"type": "object",
@@ -839,6 +871,10 @@
839871
"supportsInvalidatedEvent": {
840872
"type": "boolean",
841873
"description": "Client supports the invalidated event."
874+
},
875+
"supportsMemoryEvent": {
876+
"type": "boolean",
877+
"description": "Client supports the memory event."
842878
}
843879
},
844880
"required": [ "adapterID" ]

protocol/src/debugProtocol.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,23 @@ export module DebugProtocol {
399399
};
400400
}
401401

402+
/** Event message for 'memory' event type.
403+
This event indicates that some memory range has been updated. It should only be sent if the debug adapter has received a value true for the `supportsMemoryEvent` capability of the `initialize` request.
404+
Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap.
405+
Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other DAP request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events.
406+
*/
407+
export interface MemoryEvent extends Event {
408+
// event: 'memory';
409+
body: {
410+
/** Memory reference of a memory range that has been updated. */
411+
memoryReference: string;
412+
/** Starting offset in bytes where memory has been updated. Can be negative. */
413+
offset: number;
414+
/** Number of bytes updated. */
415+
count: number;
416+
};
417+
}
418+
402419
/** RunInTerminal request; value of command field is 'runInTerminal'.
403420
This optional request is sent from the debug adapter to the client to run a command in a terminal.
404421
This is typically used to launch the debuggee in a terminal provided by the client.
@@ -475,6 +492,8 @@ export module DebugProtocol {
475492
supportsProgressReporting?: boolean;
476493
/** Client supports the invalidated event. */
477494
supportsInvalidatedEvent?: boolean;
495+
/** Client supports the memory event. */
496+
supportsMemoryEvent?: boolean;
478497
}
479498

480499
/** Response to 'initialize' request. */

0 commit comments

Comments
 (0)