Skip to content

Commit b34d7e9

Browse files
ntoskrnl7WebFreak001
authored andcommitted
add goto request & response
1 parent dd1c936 commit b34d7e9

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/backend/mi2/mi2.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,19 @@ export class MI2 extends EventEmitter implements IBackend {
478478
});
479479
}
480480

481+
goto(filename: string, line: number): Thenable<Boolean> {
482+
if (trace)
483+
this.log("stderr", "goto");
484+
return new Promise((resolve, reject) => {
485+
const target: string = (filename ? filename + ":" : "") + line;
486+
this.sendCommand("break-insert -t " + target).then(() => {
487+
this.sendCommand("exec-jump " + target).then((info) => {
488+
resolve(info.resultRecords.resultClass == "running");
489+
}, reject);
490+
}, reject);
491+
});
492+
}
493+
481494
changeVariable(name: string, rawValue: string): Thenable<any> {
482495
if (trace)
483496
this.log("stderr", "changeVariable");

src/gdb.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface AttachRequestArguments extends DebugProtocol.AttachRequestArgum
3636

3737
class GDBDebugSession extends MI2DebugSession {
3838
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
39+
response.body.supportsGotoTargetsRequest = true;
3940
response.body.supportsHitConditionalBreakpoints = true;
4041
response.body.supportsConfigurationDoneRequest = true;
4142
response.body.supportsConditionalBreakpoints = true;

src/mibase.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,27 @@ export class MI2DebugSession extends DebugSession {
653653
});
654654
}
655655
}
656+
657+
protected gotoTargetsRequest(response: DebugProtocol.GotoTargetsResponse, args: DebugProtocol.GotoTargetsArguments): void {
658+
this.miDebugger.goto(args.source.path, args.line).then(done => {
659+
response.body = {
660+
targets : [{
661+
id : 1,
662+
label : args.source.name,
663+
column: args.column,
664+
line : args.line
665+
}]
666+
};
667+
this.sendResponse(response);
668+
}, msg => {
669+
this.sendErrorResponse(response, 6, `Could not step over: ${msg}`);
670+
});
671+
}
672+
673+
protected gotoRequest(response: DebugProtocol.GotoResponse, args: DebugProtocol.GotoArguments): void {
674+
this.sendResponse(response);
675+
}
676+
656677
}
657678

658679
function prettyStringArray(strings) {

0 commit comments

Comments
 (0)