Skip to content

Commit

Permalink
Add support for function breakpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Moran <[email protected]>
  • Loading branch information
thegecko committed Sep 26, 2019
1 parent 66550ae commit 7c9230e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/GDBDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class GDBDebugSession extends LoggingDebugSession {
response.body.supportsConfigurationDoneRequest = true;
response.body.supportsSetVariable = true;
response.body.supportsConditionalBreakpoints = true;
response.body.supportsFunctionBreakpoints = true;
// response.body.supportsSetExpression = true;
this.sendResponse(response);
}
Expand Down Expand Up @@ -303,6 +304,22 @@ export class GDBDebugSession extends LoggingDebugSession {
}
}

protected async setFunctionBreakPointsRequest(response: DebugProtocol.SetFunctionBreakpointsResponse,
args: DebugProtocol.SetFunctionBreakpointsArguments) {
try {
for (const fn of args.breakpoints) {
try {
await mi.sendBreakFunctionInsert(this.gdb, fn.name);
} catch (error) {
this.sendEvent(new OutputEvent(`Unable to set function breakpoint: ${error.message}`));
}
}
this.sendResponse(response);
} catch (err) {
this.sendErrorResponse(response, 1, err.message);
}
}

protected async configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse,
args: DebugProtocol.ConfigurationDoneArguments): Promise<void> {
try {
Expand Down
5 changes: 5 additions & 0 deletions src/mi/breakpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ export function sendBreakDelete(gdb: GDBBackend, request: {
export function sendBreakList(gdb: GDBBackend): Promise<MIBreakListResponse> {
return gdb.sendCommand('-break-list');
}

export function sendBreakFunctionInsert(gdb: GDBBackend, fn: string) {
const command = `-break-insert --function ${fn}`;
return gdb.sendCommand(command);
}

0 comments on commit 7c9230e

Please sign in to comment.