Skip to content

Commit

Permalink
add "from" and "to" to "-var-list-children"
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm committed Sep 14, 2024
1 parent d840528 commit 89775d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 89775d6

Please sign in to comment.