Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/gdb/GDBDebugSessionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Logger,
logger,
LoggingDebugSession,
MemoryEvent,
OutputEvent,
Scope,
Source,
Expand Down Expand Up @@ -3167,6 +3168,18 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {
case 'cmd-param-changed':
this.handleCmdParamChanged(notifyData);
break;
case 'memory-changed': {
Comment thread
omarArm marked this conversation as resolved.
let length = 0;
if (isNaN(notifyData.len)) {
logger.warn(
`GDB notify "memory-changed" has invalid length: ${notifyData.len}`
);
}
length = parseInt(notifyData.len);
const memoryEvent = new MemoryEvent(notifyData.addr, 0, length);
this.sendEvent(memoryEvent);
break;
}
default:
logger.warn(
`GDB unhandled notify: ${notifyClass}: ${JSON.stringify(
Expand Down
20 changes: 20 additions & 0 deletions src/integration-tests/mem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,26 @@ describe('Memory Test Suite', function () {
verifyReadMemoryResponse(memory, newValue, addrOfArray);
});

it('can write memory and handle memory notifications from gdb', async function () {
const addrOfArray = parseInt(
(
await dc.evaluateRequest({
expression: '&array[0]',
frameId: frame.id,
})
).body.result
);
const memoryEvent = dc.waitForEvent('memory');
await dc.evaluateRequest({
expression: '>set array[0] = 0xde',
frameId: frame.id,
context: 'repl',
});
const output = await memoryEvent;
expect(parseInt(output.body.memoryReference)).eq(addrOfArray);
expect(output.body.count).eq(1);
});

it('fails when trying to write to read-only memory', async function () {
const addrOfArray = parseInt(
(
Expand Down
Loading