(response: DebugProtocol.ReadMemoryResponse, args: DebugProtocol.ReadMemoryArguments, request?: DebugProtocol.Request)
| 1209 | } |
| 1210 | |
| 1211 | protected readMemoryRequest(response: DebugProtocol.ReadMemoryResponse, args: DebugProtocol.ReadMemoryArguments, request?: DebugProtocol.Request): void { |
| 1212 | if (this.isBusy()) { |
| 1213 | this.busyError(response, args); |
| 1214 | return; |
| 1215 | } |
| 1216 | const startAddress = parseInt(args.memoryReference); |
| 1217 | const length = args.count; |
| 1218 | const useAddr = hexFormat(startAddress + (args.offset || 0)); |
| 1219 | response.body = { |
| 1220 | address: useAddr, |
| 1221 | data: '' |
| 1222 | }; |
| 1223 | if (length === 0) { |
| 1224 | this.sendResponse(response); |
| 1225 | return; |
| 1226 | } |
| 1227 | // const offset = args.offset ? `-o ${args.offset}` : ''; |
| 1228 | const command = `data-read-memory-bytes "${useAddr}" ${length}`; |
| 1229 | this.miDebugger.sendCommand(command).then((node) => { |
| 1230 | const results = parseReadMemResults(node); |
| 1231 | const numBytes = results.data.length / 2; |
| 1232 | const intAry = new Uint8Array(numBytes); |
| 1233 | const data = results.data; |
| 1234 | for (let ix = 0, dx = 0; ix < numBytes; ix++, dx += 2) { |
| 1235 | // const tmp = results.data.substring(ix * 2, 2); |
| 1236 | const tmp = data[dx] + data[dx + 1]; |
| 1237 | intAry[ix] = twoCharsToIntMap[tmp]; |
| 1238 | } |
| 1239 | const buf = Buffer.from(intAry); |
| 1240 | const b64Data = buf.toString('base64'); |
| 1241 | response.body.data = b64Data; |
| 1242 | this.sendResponse(response); |
| 1243 | }, (error) => { |
| 1244 | this.sendErrorResponse(response, 114, `Read memory error: ${error.toString()}`); |
| 1245 | this.sendEvent(new TelemetryEvent('Error', 'Reading Memory', command)); |
| 1246 | }); |
| 1247 | } |
| 1248 | |
| 1249 | protected writeMemoryRequest(response: DebugProtocol.WriteMemoryResponse, args: DebugProtocol.WriteMemoryArguments, request?: DebugProtocol.Request): void { |
| 1250 | if (this.isBusy()) { |
nothing calls this directly
no test coverage detected