Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array optimisation for variablesRequest #343

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 1 addition & 47 deletions src/gdb/GDBDebugSessionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2008,56 +2008,10 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {
// update the display name for array elements to have square brackets
name = `[${child.exp}]`;
}
if (isArrayParent || isArrayChild) {
// can't use a relative varname (eg. var1.a.b.c) to create/update a new var so fetch and track these
// vars by evaluating their path expression from GDB
const fullPath = await this.getFullPathExpression(
child.name
);
// create or update the var in GDB
let arrobj = this.gdb.varManager.getVar(
frame.frameId,
frame.threadId,
depth,
fullPath
);
if (!arrobj) {
const varCreateResponse = await mi.sendVarCreate(
this.gdb,
{
expression: fullPath,
frameId: frame.frameId,
threadId: frame.threadId,
}
);
arrobj = this.gdb.varManager.addVar(
frame.frameId,
frame.threadId,
depth,
fullPath,
true,
false,
varCreateResponse
);
} else {
arrobj = await this.gdb.varManager.updateVar(
frame.frameId,
frame.threadId,
depth,
arrobj
);
}
// if we have an array parent entry, we need to display the address.
if (isArrayParent) {
value = await this.getAddr(arrobj);
}
arrobj.isChild = true;
varobjName = arrobj.varname;
}
const variableName = isArrayChild ? name : child.exp;
const evaluateName =
isArrayParent || isArrayChild
? await this.getFullPathExpression(child.name)
? `${topLevelPathExpression}[${child.exp}]`
: `${topLevelPathExpression}.${child.exp}`;
variables.push({
name: variableName,
Expand Down
Loading