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

add support for start and count to the "variables" request #443

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions src/backend/mi2/mi2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,12 @@ export class MI2 extends EventEmitter implements IBackend {
return this.sendCommand(`var-evaluate-expression ${this.quote(name)}`);
}

async varListChildren(name: string): Promise<VariableObject[]> {
async varListChildren(name: string, start?: number, count?: number): Promise<VariableObject[]> {
if (trace)
this.log("stderr", "varListChildren");
//TODO: add `from` and `to` arguments
const res = await this.sendCommand(`var-list-children --all-values ${this.quote(name)}`);
start ??= 0;
const range = count ? ` ${start} ${start + count}` : "";
const res = await this.sendCommand(`var-list-children --all-values ${this.quote(name)}${range}`);
const children = res.result("children") || [];
const omg: VariableObject[] = children.map((child: any) => new VariableObject(child[1]));
return omg;
Expand Down
2 changes: 1 addition & 1 deletion src/mibase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export class MI2DebugSession extends DebugSession {
// Variable members
let children: VariableObject[];
try {
children = await this.miDebugger.varListChildren(id.name);
children = await this.miDebugger.varListChildren(id.name, args.start, args.count);
const vars = children.map(child => {
const varId = findOrCreateVariable(child);
child.id = varId;
Expand Down
Loading