Skip to content

Commit 8f5c763

Browse files
committed
1. fix std::unique_ptr and std::atomic<int> and std::deque<std::deque<int>> parse issue
1 parent ece8d98 commit 8f5c763

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,12 +203,21 @@ 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
const variableMatch = resultRegex.exec(value);
206211
if (!variableMatch)
207212
return undefined;
208213
value = value.substring(variableMatch[0].length).trim();
209-
const name = variable = variableMatch[1];
214+
let name = variable = variableMatch[1].trim();
215+
216+
const tmpName = name.split(" ");
217+
if(tmpName.length > 1 && !name.includes("anonymous union")){
218+
name = tmpName[tmpName.length - 1];
219+
}
220+
210221
if (pushToStack)
211222
stack.push(variable);
212223
const val = parseValue();
@@ -235,6 +246,17 @@ export function expandValue(variableCreate: (arg: VariableObject | string, optio
235246
ref = variableCreate(getNamespace(name));
236247
val = "...";
237248
}
249+
250+
value = value.trim();
251+
if (value[0] == ',')
252+
{
253+
let tmp = value;
254+
tmp = tmp.substring(1).trim();
255+
if(tmp.startsWith("<No data fields>")){
256+
value = tmp = tmp.substring("<No data fields>".length);
257+
}
258+
}
259+
238260
return {
239261
name: name,
240262
value: val,

0 commit comments

Comments
 (0)