From ece8d98a9be5f3c5ddb0e2aeb05560d924f89714 Mon Sep 17 00:00:00 2001 From: xuhong Date: Fri, 23 Aug 2024 18:22:16 +0800 Subject: [PATCH] 1. solve the problem of failed parsing of containers --- CHANGELOG.md | 1 + src/backend/gdb_expansion.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b41a3c0b..cba0d5a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Versioning]. ### Added +- solve the problem of failed parsing of containers ([@henryriley0]) - fix gdb check error when debug beginning ([@henryriley0]) - fix implicitly type error in log message when build vsix ([@henryriley0]) - check for configured debugger before start to provide a nicer error message diff --git a/src/backend/gdb_expansion.ts b/src/backend/gdb_expansion.ts index 250a0d03..303c0dc4 100644 --- a/src/backend/gdb_expansion.ts +++ b/src/backend/gdb_expansion.ts @@ -1,7 +1,7 @@ import { VariableObject } from "./backend"; import { MINode } from "./mi_parse"; -const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-]*|\[\d+\])\s*=\s*/; +const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:]*|\[\d+\])\s*=\s*/; const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/; const errorRegex = /^\<.+?\>/; const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/; @@ -108,7 +108,7 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio let newValPos = newValPos1; if (newValPos2 != -1 && newValPos2 < newValPos1) newValPos = newValPos2; - if (newValPos != -1 && eqPos > newValPos || eqPos == -1) { // is value list + if (newValPos != -1 && eqPos > newValPos || eqPos == -1 || value.startsWith("std::")) { // is value list const values = []; stack.push("[0]"); let val = parseValue(); @@ -191,6 +191,11 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio return parseCString(); else if (value[0] == '{') return parseTupleOrList(); + else if(value.startsWith("std::")){ + const eqPos = value.indexOf("="); + value = value.substring(eqPos + 2); + return parseValue(); + } else return parsePrimitive(); };