MCPcopy Index your code
hub / github.com/Marus/cortex-debug / readMemoryRequestCustom

Method readMemoryRequestCustom

src/gdb.ts:1272–1294  ·  view source on GitHub ↗
(response: DebugProtocol.Response, startAddress: string, length: number)

Source from the content-addressed store, hash-verified

1270 }
1271
1272 protected readMemoryRequestCustom(response: DebugProtocol.Response, startAddress: string, length: number) {
1273 this.miDebugger.sendCommand(`data-read-memory-bytes "${startAddress}" ${length}`).then((node) => {
1274 const results = parseReadMemResults(node);
1275 // const bytes = results.data.match(/[0-9a-f]{2}/g).map((b) => parseInt(b, 16));
1276 const bytes = [];
1277 const numBytes = results.data.length / 2;
1278 const data = results.data;
1279 for (let ix = 0, dx = 0; ix < numBytes; ix++, dx += 2) {
1280 const tmp = data[dx] + data[dx + 1];
1281 bytes.push(twoCharsToIntMap[tmp]);
1282 }
1283 response.body = {
1284 startAddress: results.startAddress,
1285 endAddress: results.endAddress,
1286 bytes: bytes
1287 };
1288 this.sendResponse(response);
1289 }, (error) => {
1290 response.body = { error: error };
1291 this.sendErrorResponse(response, 114, `Read memory error: ${error.toString()}`);
1292 this.sendEvent(new TelemetryEvent('Error', 'Reading Memory', `${startAddress}-${length.toString(16)}`));
1293 });
1294 }
1295
1296 protected writeMemoryRequestCustom(response: DebugProtocol.Response, startAddress: number, data: string) {
1297 const address = hexFormat(startAddress, 8);

Callers 1

customRequestMethod · 0.95

Calls 4

sendEventMethod · 0.95
parseReadMemResultsFunction · 0.90
sendCommandMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected