From ce7e31dc9f03364cdc84aa7e6b6bbc27e9e5c897 Mon Sep 17 00:00:00 2001 From: xuhong Date: Fri, 28 Jun 2024 16:32:20 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=90=8D=E4=B8=ADstatic=EF=BC=9B=202=E3=80=81=E8=A7=A3?= =?UTF-8?q?=E5=86=B3static=E5=BC=95=E8=B5=B7=E7=9A=84=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E8=A7=A3=E6=9E=90=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/gdb_expansion.ts | 14 ++++++++++++++ src/mibase.ts | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/backend/gdb_expansion.ts b/src/backend/gdb_expansion.ts index e0c2fb2..b0485a9 100644 --- a/src/backend/gdb_expansion.ts +++ b/src/backend/gdb_expansion.ts @@ -282,6 +282,12 @@ export function expandValue(variableCreate: Function, value: string, root: strin if (name.charAt(name.length - 1) === ">") { name = name.slice(0, -1); } + + let tmpName = name.split(" "); + if(tmpName.length>1 && !name.includes("anonymous union")){ + name = tmpName[tmpName.length-1]; + } + //JSON.parse() if (pushToStack){ stack.push(variable); @@ -321,6 +327,14 @@ export function expandValue(variableCreate: Function, value: string, root: strin val = "..."; } else { evaluateName = getNamespace(name); + if(typeof evaluateName == "string" && evaluateName.includes("static ")) { + evaluateName = evaluateName.replace("static ", ""); + } + + let tmpName = evaluateName.split(' '); + if(tmpName.length>1){ + evaluateName = tmpName[tmpName.length-1]; + } } value = value.trim(); diff --git a/src/mibase.ts b/src/mibase.ts index ca04b3f..8a0b60c 100644 --- a/src/mibase.ts +++ b/src/mibase.ts @@ -505,7 +505,11 @@ export class MI2DebugSession extends DebugSession { protected async variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): Promise { const variables: DebugProtocol.Variable[] = []; - const id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference); + let id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference); + if(typeof id == "string" && id.includes("static ")) { + id = id.replace("static ", ""); + } + const createVariable = (arg: string | VariableObject, options?: any) => { if (options) return this.variableHandles.create(new ExtendedVariable(typeof arg === 'string' ? arg : arg.name, options));