Skip to content

Commit 90c7b76

Browse files
committed
Add "var_" prefix to var object names
The name of var object should begin with a letter, so names like "_id" caused errors.
1 parent c313af8 commit 90c7b76

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/mibase.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,23 @@ export class MI2DebugSession extends DebugSession {
335335
for (const variable of stack) {
336336
if (this.useVarObjects) {
337337
try {
338+
let varObjName = `var_${variable.name}`;
338339
let varObj: VariableObject;
339340
try {
340-
const changes = await this.miDebugger.varUpdate(variable.name);
341+
const changes = await this.miDebugger.varUpdate(varObjName);
341342
const changelist = changes.result("changelist");
342343
changelist.forEach((change) => {
343344
const name = MINode.valueOf(change, "name");
344-
const vId = this.variableHandlesReverse[variable.name];
345+
const vId = this.variableHandlesReverse[varObjName];
345346
const v = this.variableHandles.get(vId) as any;
346347
v.applyChanges(change);
347348
});
348-
const varId = this.variableHandlesReverse[variable.name];
349+
const varId = this.variableHandlesReverse[varObjName];
349350
varObj = this.variableHandles.get(varId) as any;
350351
}
351352
catch (err) {
352353
if (err instanceof MIError && err.message == "Variable object not found") {
353-
varObj = await this.miDebugger.varCreate(variable.name, variable.name);
354+
varObj = await this.miDebugger.varCreate(variable.name, varObjName);
354355
const varId = findOrCreateVariable(varObj);
355356
varObj.exp = variable.name;
356357
varObj.id = varId;

0 commit comments

Comments
 (0)