Skip to content

Commit 89775d6

Browse files
committed
add "from" and "to" to "-var-list-children"
1 parent d840528 commit 89775d6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/backend/mi2/mi2.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,12 @@ export class MI2 extends EventEmitter implements IBackend {
936936
return this.sendCommand(`var-evaluate-expression ${this.quote(name)}`);
937937
}
938938

939-
async varListChildren(name: string): Promise<VariableObject[]> {
939+
async varListChildren(name: string, start?: number, count?: number): Promise<VariableObject[]> {
940940
if (trace)
941941
this.log("stderr", "varListChildren");
942-
//TODO: add `from` and `to` arguments
943-
const res = await this.sendCommand(`var-list-children --all-values ${this.quote(name)}`);
942+
start ??= 0;
943+
const range = count ? ` ${start} ${start + count}` : "";
944+
const res = await this.sendCommand(`var-list-children --all-values ${this.quote(name)}${range}`);
944945
const children = res.result("children") || [];
945946
const omg: VariableObject[] = children.map((child: any) => new VariableObject(child[1]));
946947
return omg;

src/mibase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export class MI2DebugSession extends DebugSession {
565565
// Variable members
566566
let children: VariableObject[];
567567
try {
568-
children = await this.miDebugger.varListChildren(id.name);
568+
children = await this.miDebugger.varListChildren(id.name, args.start, args.count);
569569
const vars = children.map(child => {
570570
const varId = findOrCreateVariable(child);
571571
child.id = varId;

0 commit comments

Comments
 (0)