-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Use unique line count in swift_task_switch logic #6839
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
[lldb] Use unique line count in swift_task_switch logic #6839
Conversation
@swift-ci test |
Working on a test. |
@swift-ci test |
@swift-ci test |
@swift-ci test macOS |
95f90d8
to
5c3acb0
Compare
@swift-ci test |
@adrian-prantl this is ready |
target, _, thread, _ = lldbutil.run_to_source_breakpoint(self, "await f()", src) | ||
self.assertEqual(thread.frame[0].function.mangled, "$s1a5entryO4mainyyYaFZ") | ||
|
||
function = target.FindFunctions("$s1a5entryO4mainyyYaFZTQ0_")[0].function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you assert that function is non-null? Will be easier to debug that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When stepping into an async function, the compiler can emit two cases for the first async function split:
swift_task_switch
In the second case, step-in is done. In the second case, lldb does additional work to stop when the runtime dispatches to the async function (including setting a conditional internal breakpoint, and more).
lldb needs to distinguish between these two cases, in order to know which stepping logic to perform.
In the first case, the trampoline would ideally have no associated line table entries for the trampoline. However that's not been the case. Instead there has been a single (non-zero) line table entry for the trampoline. The logic lldb uses is to check the line table, and if there's only one line table entry, conclude that it's a trampoline. But, a recent update to the swift compiler has resulted in two line table entries for the trampoline, but both are for the same line – in other words there's still a single line referenced.
This changes the logic to use a set to track the line table entries. If only one unique line is found, conclude the function is a trampoline.
Ultimately, making swiftc emit no line table for these trampolines is the best fix.