Skip to content

Conversation

@amanthatdoescares
Copy link

@amanthatdoescares amanthatdoescares commented Dec 6, 2025

Description

LLDB-DAP sometimes fails to mark breakpoints as verified in the setBreakpoints response, even though the breakpoint is hit during debugging. This leads to the VS Code UI showing the breakpoint as “unverified” while execution actually stops there.

This PR adds a safe fallback that marks breakpoints as verified when we detect them being hit via:

  • a stopped event with reason: "breakpoint", or
  • a breakpoint event containing a valid source and line.

This improves consistency between actual debugger behavior and the UI, especially for Swift executables and swift test.

Issue: #1871

Tasks

  • Required tests have been written
  • [ ] Documentation has been updated
  • Added an entry to CHANGELOG.md if applicable

Copy link
Contributor

@award999 award999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amanthatdoescares thanks so much for the PR 🙏 I have some initial comments here to get you started. @matthewbastien is more familiar with the debugging codebase so let's have him take a look to.

Also the open todo for updating changelog in the PR template, you just need to do something like 85d5132, but this being a bug fix, you'd put it under the ### Fixed section for the latest release.

Copy link
Member

@matthewbastien matthewbastien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this! I just have some minor comments to make the code easier to read.

const normalizePath = (p: string): string => {
try {
// If adapter sends a URI-like path, parse it
if (p.startsWith("file://") || p.includes("://")) {
Copy link
Member

@matthewbastien matthewbastien Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: You can use vscode.URI.parse() with strict mode enabled here. That way we don't have to do any manual parsing of the string. Using parse() with strict mode set to true will throw an error when the string is not a valid URI. We can fall back on vscode.Uri.file() like you have below if an error is thrown.


const bpLine0 = line - 1; // VS Code uses 0-based lines

const breakpoints = vscode.debug.breakpoints.filter(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is there anything stopping us from using .filter(b => b instanceof vscode.SourceBreakpoint) here instead of type casting? Would make this code a lot easier to read.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We avoid instanceof vscode.SourceBreakpoint here because it’s unreliable in VS Code tests. Breakpoints can be created in a different JS context, causing instanceof checks to fail even though the object behaves like a SourceBreakpoint. Checking for the presence of location avoids that cross-context issue and is more robust


for (const bp of breakpoints) {
const loc = bp.location;
if (!loc) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This check is unnecessary as it should be handled by the filter above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, that check is redundant given the filter above. I’ve removed it.

}

// Force a UI refresh so the breakpoint shows as installed.
vscode.debug.removeBreakpoints([bp]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Will this also trigger when the breakpoint is already resolved? It's probably not a huge issue, but I think we should be only doing this when the breakpoint that's being hit isn't marked as resolved.


### Fixed

- Fix breakpoint filtering fallback in debugger logging ([#1989](https://github.com/swiftlang/vscode-swift/pull/1989))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: You'll have to rebase this since the CHANGELOG was recently updated for version 2.14.2. This may require moving this bullet to a new ### Fixed section.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do — I’ll rebase and move the entry to the current unreleased ### Fixed section.

amanthatdoescares and others added 5 commits December 10, 2025 05:17
Co-authored-by: Matthew Bastien <[email protected]>
Removed version 2.14.2 entry and its fixed items from the changelog.
Added a note about using the JSON schema for editing config.json and fixed breakpoint filtering in debugger logging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants