Use var-assign to set variables values
This commit is contained in:
parent
2551dba725
commit
d498b381bf
2 changed files with 19 additions and 5 deletions
|
|
@ -690,6 +690,12 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
return this.sendCommand(`var-update --all-values ${name}`)
|
return this.sendCommand(`var-update --all-values ${name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async varAssign(name: string, rawValue: string): Promise<MINode> {
|
||||||
|
if (trace)
|
||||||
|
this.log("stderr", "varAssign");
|
||||||
|
return this.sendCommand(`var-assign ${name} ${rawValue}`);
|
||||||
|
}
|
||||||
|
|
||||||
logNoNewLine(type: string, msg: string) {
|
logNoNewLine(type: string, msg: string) {
|
||||||
this.emit("msg", type, msg);
|
this.emit("msg", type, msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,15 +130,23 @@ export class MI2DebugSession extends DebugSession {
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): void {
|
protected async setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): Promise<void> {
|
||||||
this.miDebugger.changeVariable(args.name, args.value).then(() => {
|
try {
|
||||||
|
let name = args.name;
|
||||||
|
if (args.variablesReference >= VAR_HANDLES_START) {
|
||||||
|
const parent = this.variableHandles.get(args.variablesReference) as VariableObject;
|
||||||
|
name = `${parent.name}.${name}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = await this.miDebugger.varAssign(name, args.value);
|
||||||
response.body = {
|
response.body = {
|
||||||
value: args.value
|
value: res.result("value")
|
||||||
};
|
};
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
}, err => {
|
}
|
||||||
|
catch (err) {
|
||||||
this.sendErrorResponse(response, 11, `Could not continue: ${err}`);
|
this.sendErrorResponse(response, 11, `Could not continue: ${err}`);
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse, args: DebugProtocol.SetFunctionBreakpointsArguments): void {
|
protected setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse, args: DebugProtocol.SetFunctionBreakpointsArguments): void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue