Utilize GDB/MI Variable Objects for local variables

Replace own value parser with GDB's variable objects interface.
See https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html
This commit is contained in:
gentoo90 2017-05-20 19:19:15 +03:00
commit f171d9f4ac
2 changed files with 61 additions and 42 deletions

View file

@ -196,6 +196,9 @@ export class MI2 extends EventEmitter implements IBackend {
];
if (!attach)
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\""));
// TODO: add extension parameter for enabling/disabling pretty printers
cmds.push(this.sendCommand("enable-pretty-printing"));
return cmds;
}
@ -658,6 +661,19 @@ export class MI2 extends EventEmitter implements IBackend {
});
}
async varCreate(expression: string): Promise<MINode> {
if (trace)
this.log("stderr", "varCreate");
return this.sendCommand(`var-create - * "${expression}"`);
}
async varListChildren(name: string): Promise<MINode> {
if (trace)
this.log("stderr", "varListChildren");
//TODO: add `from` and `to` arguments
return this.sendCommand(`var-list-children --simple-values ${name}`);
}
logNoNewLine(type: string, msg: string) {
this.emit("msg", type, msg);
}