You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb][swift] Filter unnecessary funclets when setting line breakpoints
Prior to this commit, line breakpoints that match multiple funclets were
being filtered out to remove "Q" funclets from them. This generally
works for simple "await foo()" expressions, but it is not a
comprehensive solution, as it does not address the patterns emerging
from `async let` and `await <async_let_variable>` statements.
This commit generalizes the filtering algorithm:
1. Locations are bundled together based on the async function that
generated them.
2. For each bundle, choose the funclet with the smallest "number" as per
its mangling.
To see why this is helpful, consider an `async let` statement like:
`async let timestamp3 = getTimestamp(i: 44)`
It creates 4 funclets:
```
2.1:
function = (3) suspend resume partial function for test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFTY2_
2.2:
function = implicit closure swiftlang#1@sendable () async -> Swift.Int in test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFSiyYaYbcfu_
2.3:
function = (1) await resume partial function for implicit closure swiftlang#1@sendable () async -> Swift.Int in test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFSiyYaYbcfu_TQ0_
2.4:
function = (2) suspend resume partial function for implicit closure swiftlang#1@sendable () async -> Swift.Int in test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFSiyYaYbcfu_TY1_
```
The first is for the LHS, the others are for the RHS expression and are
only executed by the new Task. Only 2.1 and 2.2 should receive
breakpoints.
Likewise, a breakpoint on an `await <async_let_variable>` line would
create 3 funclets:
```
3.1:
function = (3) suspend resume partial function for test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFTY2_
3.2:
function = (4) suspend resume partial function for test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFTY3_
3.3:
function = (5) suspend resume partial function for test.some_other_async() async -> ()
mangled function = $s4test16some_other_asyncyyYaFTY4_
```
The first is for "before" the await, the other two for "after". Only the
first should receive a breakpoint.
0 commit comments