Use async/await in getStackVariables
This commit is contained in:
parent
907fbd5004
commit
6713545970
1 changed files with 17 additions and 19 deletions
|
|
@ -617,27 +617,25 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getStackVariables(thread: number, frame: number): Thenable<Variable[]> {
|
async getStackVariables(thread: number, frame: number): Promise<Variable[]> {
|
||||||
if (trace)
|
if (trace)
|
||||||
this.log("stderr", "getStackVariables");
|
this.log("stderr", "getStackVariables");
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.sendCommand("stack-list-variables --thread " + thread + " --frame " + frame + " --simple-values").then((result) => {
|
const result = await this.sendCommand(`stack-list-variables --thread ${thread} --frame ${frame} --simple-values`);
|
||||||
let variables = result.result("variables");
|
const variables = result.result("variables");
|
||||||
let ret: Variable[] = [];
|
let ret: Variable[] = [];
|
||||||
variables.forEach(element => {
|
for (const element of variables) {
|
||||||
const key = MINode.valueOf(element, "name");
|
const key = MINode.valueOf(element, "name");
|
||||||
const value = MINode.valueOf(element, "value");
|
const value = MINode.valueOf(element, "value");
|
||||||
const type = MINode.valueOf(element, "type");
|
const type = MINode.valueOf(element, "type");
|
||||||
ret.push({
|
ret.push({
|
||||||
name: key,
|
name: key,
|
||||||
valueStr: value,
|
valueStr: value,
|
||||||
type: type,
|
type: type,
|
||||||
raw: element
|
raw: element
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
resolve(ret);
|
return ret;
|
||||||
}, reject);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
examineMemory(from: number, length: number): Thenable<any> {
|
examineMemory(from: number, length: number): Thenable<any> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue