Skip to content

[lldb][swift] Disable breakpoint filtering by default #10826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: swift/release/6.2
Choose a base branch
from

Conversation

felipepiovezan
Copy link

A previous patch had introduced the notion of Language breakpoint filtering when setting line breakpoints. While this is generally a good idea, the swift implementation was motivated by statements like this:

async let x = ...
await foo()
await x

All of these lines have many different breakpoint locations associated with them, creating many pauses while stepping; the intent behind the filtering was to provide a smoother stepping experience.

The implementation filters breakpoints by "funclet" numbers, disabling all but the lowest such funclet. Unfortunately, this fails when the CFG of an async funclet needs to be cloned in non-trivial ways. For example:

func foo(_ argument: Int) async {
  do {
    switch argument {
    case 1:
      try await willthrow(1)
    case 2:
      try await willthrow(2)
    default:
      return
    }
  } catch {
    print("breakhere")
  }
}

The breakpoint in "breakhere" has two funclets associated with it, one when we throw from case 1, one from case 2. Filtering is incorrect in this situation.

This patch disables filtering until we can solve this at a compiler level. While we are disabling this through the TargetProperties setting, which could affect other languages, Swift is the only such language using that setting.

@felipepiovezan felipepiovezan requested a review from a team as a code owner June 11, 2025 17:49
@felipepiovezan
Copy link
Author

@swift-ci test

A previous patch had introduced the notion of Language breakpoint
filtering when setting line breakpoints. While this is generally a good
idea, the swift implementation was motivated by statements like this:

```
async let x = ...
await foo()
await x
```

All of these lines have many different breakpoint locations associated
with them, creating many pauses while stepping; the intent behind the
filtering was to provide a smoother stepping experience.

The implementation filters breakpoints by "funclet" numbers,
disabling all but the lowest such funclet. Unfortunately, this fails
when the CFG of an async funclet needs to be cloned in non-trivial ways.
For example:

```
func foo(_ argument: Int) async {
  do {
    switch argument {
    case 1:
      try await willthrow(1)
    case 2:
      try await willthrow(2)
    default:
      return
    }
  } catch {
    print("breakhere")
  }
}
```

The breakpoint in "breakhere" has two funclets associated with it, one
when we throw from case 1, one from case 2. Filtering is incorrect in
this situation.

This patch disables filtering until we can solve this at a compiler
level. While we are disabling this through the TargetProperties setting,
which could affect other languages, Swift is the only such language
using that setting.
@felipepiovezan felipepiovezan force-pushed the felipe/disable_bp_filtering_release branch from 59a5697 to 77290cc Compare June 11, 2025 19:51
@felipepiovezan
Copy link
Author

@swift-ci test

@felipepiovezan
Copy link
Author

15:13:42  [5368/5486][ 97%][407.955s] Linking CXX static library lib/libbenchmark_main.a
04:14:55  Cancelling nested steps due to timeout

That's a timeout

@felipepiovezan
Copy link
Author

@swift-ci test macos platform

@felipepiovezan
Copy link
Author

09:02:22  Timed Out Tests (1):
09:02:22    lldb-api :: lang/swift/private_generic_type/TestSwiftPrivateGenericType.py

Now this timed out... I tested it locally both with and without debug info and it passed.
Trying again.

@felipepiovezan
Copy link
Author

@swift-ci test macos platform

1 similar comment
@felipepiovezan
Copy link
Author

@swift-ci test macos platform

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.

2 participants