Implemented stepping back & changing variables
This commit is contained in:
parent
81f8e6fcf1
commit
d704af2501
5 changed files with 39 additions and 14 deletions
11
package.json
11
package.json
|
|
@ -6,7 +6,7 @@
|
|||
"publisher": "webfreak",
|
||||
"icon": "images/icon-plain.svg",
|
||||
"engines": {
|
||||
"vscode": "^0.10.8"
|
||||
"vscode": "^1.3.0"
|
||||
},
|
||||
"categories": [
|
||||
"Debuggers"
|
||||
|
|
@ -463,12 +463,11 @@
|
|||
"test": "node ./node_modules/vscode/bin/test"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-debugadapter": "^1.7.0-pre.1",
|
||||
"vscode-debugprotocol": "^1.7.0-pre.1",
|
||||
"ssh2": "^0.4.13"
|
||||
"vscode-debugadapter": "^1.10.0",
|
||||
"vscode-debugprotocol": "^1.10.0",
|
||||
"ssh2": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^1.7.5",
|
||||
"vscode": "0.11.x"
|
||||
"typescript": "^1.8.10"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,4 +49,5 @@ export interface IBackend {
|
|||
getStackVariables(thread: number, frame: number): Thenable<[string, string][]>;
|
||||
evalExpression(name: string): Thenable<any>;
|
||||
isReady(): boolean;
|
||||
changeVariable(name: string, rawValue: string): Thenable<any>;
|
||||
}
|
||||
|
|
@ -387,38 +387,42 @@ export class MI2 extends EventEmitter implements IBackend {
|
|||
});
|
||||
}
|
||||
|
||||
continue(): Thenable<boolean> {
|
||||
continue(reverse: boolean = false): Thenable<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.sendCommand("exec-continue").then((info) => {
|
||||
this.sendCommand("exec-continue" + (reverse ? " --reverse" : "")).then((info) => {
|
||||
resolve(info.resultRecords.resultClass == "running");
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
next(): Thenable<boolean> {
|
||||
next(reverse: boolean = false): Thenable<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.sendCommand("exec-next").then((info) => {
|
||||
this.sendCommand("exec-next" + (reverse ? " --reverse" : "")).then((info) => {
|
||||
resolve(info.resultRecords.resultClass == "running");
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
step(): Thenable<boolean> {
|
||||
step(reverse: boolean = false): Thenable<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.sendCommand("exec-step").then((info) => {
|
||||
this.sendCommand("exec-step" + (reverse ? " --reverse" : "")).then((info) => {
|
||||
resolve(info.resultRecords.resultClass == "running");
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
stepOut(): Thenable<boolean> {
|
||||
stepOut(reverse: boolean = false): Thenable<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.sendCommand("exec-finish").then((info) => {
|
||||
this.sendCommand("exec-finish" + (reverse ? " --reverse" : "")).then((info) => {
|
||||
resolve(info.resultRecords.resultClass == "running");
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
changeVariable(name: string, rawValue: string): Thenable<any> {
|
||||
return this.sendCommand("gdb-set var " + name + "=" + rawValue);
|
||||
}
|
||||
|
||||
loadBreakPoints(breakpoints: Breakpoint[]): Thenable<[boolean, Breakpoint][]> {
|
||||
let promisses = [];
|
||||
breakpoints.forEach(breakpoint => {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ class GDBDebugSession extends MI2DebugSession {
|
|||
response.body.supportsConditionalBreakpoints = true;
|
||||
response.body.supportsFunctionBreakpoints = true;
|
||||
response.body.supportsEvaluateForHovers = true;
|
||||
response.body.supportsSetVariable = true;
|
||||
response.body.supportsStepBack = true;
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,17 @@ export class MI2DebugSession extends DebugSession {
|
|||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
protected setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): void {
|
||||
this.miDebugger.changeVariable(args.name, args.value).then(() => {
|
||||
response.body = {
|
||||
value: args.value
|
||||
};
|
||||
this.sendResponse(response);
|
||||
}, err => {
|
||||
this.sendErrorResponse(response, 11, `Could not continue: ${err}`);
|
||||
});
|
||||
}
|
||||
|
||||
protected setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse, args: DebugProtocol.SetFunctionBreakpointsArguments): void {
|
||||
let cb = (() => {
|
||||
this.debugReady = true;
|
||||
|
|
@ -290,6 +301,14 @@ export class MI2DebugSession extends DebugSession {
|
|||
});
|
||||
}
|
||||
|
||||
protected stepBackRequest(response: DebugProtocol.StepBackResponse, args: DebugProtocol.StepBackArguments): void {
|
||||
this.miDebugger.step(true).then(done => {
|
||||
this.sendResponse(response);
|
||||
}, msg => {
|
||||
this.sendErrorResponse(response, 4, `Could not step back: ${msg} - Try running 'target record-full' before stepping back`);
|
||||
});
|
||||
}
|
||||
|
||||
protected stepInRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments): void {
|
||||
this.miDebugger.step().then(done => {
|
||||
this.sendResponse(response);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue