Skip to content

Commit

Permalink
Send proper unverified exception breakpoints when not supported on th…
Browse files Browse the repository at this point in the history
…e device
  • Loading branch information
TwitchBronBron committed Nov 25, 2024
1 parent 5e8f77f commit 6ad38aa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
7 changes: 7 additions & 0 deletions src/adapters/DebugProtocolAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ export class DebugProtocolAdapter {
}, 0);
}

/**
* Does the current client support exception breakpoints? This value will be undefined if the client has not yet connected
*/
public get supportsExceptionBreakpoints(): boolean | undefined {
return this.client?.supportsExceptionBreakpoints;
}

/**
* The debugger needs to tell us when to be active (i.e. when the package was deployed)
*/
Expand Down
2 changes: 2 additions & 0 deletions src/adapters/TelnetAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export class TelnetAdapter {
*/
public supportsExecute = true;

public supportsExceptionBreakpoints = false;

public once(eventName: 'app-ready'): Promise<void>;
public once(eventName: 'connected'): Promise<boolean>;
public once(eventName: string) {
Expand Down
7 changes: 3 additions & 4 deletions src/debugProtocol/client/DebugProtocolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class DebugProtocolClient {
this.emit('data', data);
//queue up processing the new data, chunk by chunk
void this.bufferQueue.run(async () => {
this.buffer = Buffer.concat([this.buffer, data]);
this.buffer = Buffer.concat([this.buffer, data] as any[]);
while (this.buffer.length > 0 && await this.process()) {
//the loop condition is the actual work
}
Expand Down Expand Up @@ -995,9 +995,8 @@ export class DebugProtocolClient {
return response;
case UpdateType.ExceptionBreakpointError:
//we do nothing with exception breakpoint errors at this time.
const update = ExceptionBreakpointErrorUpdate.fromBuffer(buffer);
this.logger.error('Exception breakpoint error occurred', update);
return update;
const exceptionBreakpointErrorUpdate = ExceptionBreakpointErrorUpdate.fromBuffer(buffer);
return exceptionBreakpointErrorUpdate;
default:
return undefined;
}
Expand Down
21 changes: 14 additions & 7 deletions src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,26 @@ export class BrightScriptDebugSession extends BaseDebugSession {
//ensure the rokuAdapter is loaded
await this.getRokuAdapter();

await this.rokuAdapter.setExceptionBreakpoints(filterOptions);
//if success
response.body.breakpoints = [
{ verified: true },
{ verified: true }
];
if (this.rokuAdapter.supportsExceptionBreakpoints) {
await this.rokuAdapter.setExceptionBreakpoints(filterOptions);
//if success
response.body.breakpoints = [
{ verified: true },
{ verified: true }
];
} else {
response.body.breakpoints = [
{ verified: false },
{ verified: false }
];
}
} catch (e) {
//if error (or not supported)
response.body.breakpoints = [
{ verified: false },
{ verified: false }
];
console.error(e);
this.logger.error('Failed to set exception breakpoints', e);
} finally {
this.sendResponse(response);
}
Expand Down

0 comments on commit 6ad38aa

Please sign in to comment.