Skip to content

Commit 4c51a66

Browse files
committed
1. fix std::unique_ptr and std::atomic<int> and std::deque<std::deque<int>> parse issue
1 parent d67b0ed commit 4c51a66

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/backend/gdb_expansion.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { VariableObject } from "./backend";
22
import { MINode } from "./mi_parse";
3-
4-
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:]*|\[\d+\])\s*=\s*/;
3+
const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-:\ \<\>\(\)]*|\[\d+\])\s*=\s*/;
54
const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/;
65
const errorRegex = /^\<.+?\>/;
76
const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
@@ -113,6 +112,9 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
113112
stack.push("[0]");
114113
let val = parseValue();
115114
stack.pop();
115+
if(typeof val == "string" && val.endsWith('>')){
116+
val = val.substring(0, val.length - 2);
117+
}
116118
values.push(createValue("[0]", val));
117119
const remaining = value;
118120
let i = 0;
@@ -201,13 +203,22 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
201203
};
202204

203205
parseResult = (pushToStack: boolean = false) => {
206+
if (value[0] == '<') {
207+
value = value.substring(1).trim();
208+
}
204209
value = value.trim();
205210
value = value.replace(/^static /, "");
206211
const variableMatch = resultRegex.exec(value);
207212
if (!variableMatch)
208213
return undefined;
209214
value = value.substring(variableMatch[0].length).trim();
210-
const name = variable = variableMatch[1];
215+
let name = variable = variableMatch[1].trim();
216+
217+
const tmpName = name.split(" ");
218+
if(tmpName.length > 1 && !name.includes("anonymous union")){
219+
name = tmpName[tmpName.length - 1];
220+
}
221+
211222
if (pushToStack)
212223
stack.push(variable);
213224
const val = parseValue();
@@ -236,6 +247,17 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
236247
ref = variableCreate(getNamespace(name));
237248
val = "...";
238249
}
250+
251+
value = value.trim();
252+
if (value[0] == ',')
253+
{
254+
let tmp = value;
255+
tmp = tmp.substring(1).trim();
256+
if(tmp.startsWith("<No data fields>")){
257+
value = tmp = tmp.substring("<No data fields>".length);
258+
}
259+
}
260+
239261
return {
240262
name: name,
241263
value: val,

0 commit comments

Comments
 (0)