From dd96271a2f8f26ff257923a669821eb26c3680d7 Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Mon, 28 Nov 2022 14:34:34 -0700 Subject: [PATCH] If evaluate request fails, ignore variable --- .../memory-provider/cdt-gdb-memory-provider.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/memory-inspector/src/browser/memory-provider/cdt-gdb-memory-provider.ts b/packages/memory-inspector/src/browser/memory-provider/cdt-gdb-memory-provider.ts index ed0a91952117f..78daf63aa0ba1 100644 --- a/packages/memory-inspector/src/browser/memory-provider/cdt-gdb-memory-provider.ts +++ b/packages/memory-inspector/src/browser/memory-provider/cdt-gdb-memory-provider.ts @@ -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]);