| 1247 | } |
| 1248 | |
| 1249 | protected writeMemoryRequest(response: DebugProtocol.WriteMemoryResponse, args: DebugProtocol.WriteMemoryArguments, request?: DebugProtocol.Request): void { |
| 1250 | if (this.isBusy()) { |
| 1251 | this.busyError(response, args); |
| 1252 | return; |
| 1253 | } |
| 1254 | const startAddress = parseInt(args.memoryReference); |
| 1255 | const useAddr = hexFormat(startAddress + (args.offset || 0)); |
| 1256 | const buf = Buffer.from(args.data, 'base64'); |
| 1257 | const data = buf.toString('hex'); |
| 1258 | |
| 1259 | // Note: We don't do partials |
| 1260 | this.miDebugger.sendCommand(`data-write-memory-bytes ${useAddr} ${data}`).then((node) => { |
| 1261 | response.body = { |
| 1262 | bytesWritten: buf.length |
| 1263 | }; |
| 1264 | this.sendResponse(response); |
| 1265 | }, (error) => { |
| 1266 | (response as DebugProtocol.Response).body = { error: error }; |
| 1267 | this.sendErrorResponse(response, 114, `Write memory error: ${error.toString()}`); |
| 1268 | this.sendEvent(new TelemetryEvent('Error', 'Writing Memory', `${startAddress.toString(16)}-${data.length.toString(16)}`)); |
| 1269 | }); |
| 1270 | } |
| 1271 | |
| 1272 | protected readMemoryRequestCustom(response: DebugProtocol.Response, startAddress: string, length: number) { |
| 1273 | this.miDebugger.sendCommand(`data-read-memory-bytes "${startAddress}" ${length}`).then((node) => { |