Skip to content

Commit

Permalink
If evaluate request fails, ignore variable
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-grant-work committed Nov 28, 2022
1 parent 32deea2 commit e110d8c
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,21 @@ export class CDTGDBMemoryProvider extends AbstractMemoryProvider {
expression: addrExp,
context: 'watch',
frameId: frame.raw.id,
});
}).catch(e => console.warn(`Failed to evaluate ${addrExp}. Corresponding variable will be omitted from Memory Inspector display.`, e));
if (!addrResp) { continue; }

const sizeResp = await session.sendRequest('evaluate', {
expression: sizeExp,
context: 'watch',
frameId: frame.raw.id,
});
}).catch(e => console.warn(`Failed to evaluate ${sizeExp}. Corresponding variable will be omitted from Memory Inspector display.`, e));
if (!sizeResp) { continue; }

// Make sure the address is in the format we expect.
const addressPart = /0x[0-9a-f]+/i.exec(addrResp.body.result);
if (!addressPart) {
continue;
}
if (!addressPart) { continue; }

if (!/^[0-9]+$/.test(sizeResp.body.result)) {
continue;
}
if (!/^[0-9]+$/.test(sizeResp.body.result)) { continue; }

const size = parseInt(sizeResp.body.result);
const address = hexStrToUnsignedLong(addressPart[0]);
Expand Down

0 comments on commit e110d8c

Please sign in to comment.