Skip to content
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

Fix IRGen debug info for swift_task_alloc'ed variables. #62542

Merged
merged 1 commit into from Dec 13, 2022

Conversation

adrian-prantl
Copy link
Member

The old code attempted to load the variable despite not knowing its size. Fixed by describing the variable's address on the task heap.

The old code attempted to load the variable despite not knowing its size. Fixed
by describing the variable's address on the task heap.
@adrian-prantl
Copy link
Member Author

@swift-ci test

@adrian-prantl
Copy link
Member Author

Matching LLDB test can be found in apple/llvm-project#5768

@adrian-prantl
Copy link
Member Author

Discovered via #62499

Copy link
Member

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@adrian-prantl adrian-prantl merged commit 2dc7585 into apple:main Dec 13, 2022
@JetForMe
Copy link

JetForMe commented Feb 1, 2023

This does seem to improve inspecting variable values in async code, but doesn't seem to improve stepping into async code (in Xcode, at least, but I've got some compiler/lldb mismatch warnings).

@adrian-prantl
Copy link
Member Author

Good to hear the confirmation. It is expected that this change would not have any effect on stepping.

@JetForMe
Copy link

JetForMe commented Feb 2, 2023

I wasn't sure but also didn't think so. Just trying to be thorough. I may know the words and grammar, but reading that code is like Darmok & Jalad at Tanagra.

@JetForMe
Copy link

JetForMe commented Feb 5, 2023

Hmm, I'm still experiencing the symptom of the Xcode debugger not seeing some local variables that are clearly in scope and accessible, in this case running in a Task { } block (via function call) on macOS. Happy to provide this project.

@adrian-prantl
Copy link
Member Author

Happy to provide this project.

That would be great. Either bugs.swift.org or feedback.apple.com work.

@JetForMe
Copy link

JetForMe commented Feb 7, 2023

Set a breakpoint in DaemonCollector.swift:153 and run it. It should stop there almost immediately. Try to inspect the variables lower in the list in the Xcode variables pane (interestingly, it seems there's a line on the list above which variables are inspectable, below which they are not, and I feel like this has always been the case).

See the screenshot for examples (I context-clicked on label and executablePath and chose “Print description of”):

Screenshot 2023-02-06 at 16 57 03

Exorcist.zip

@adrian-prantl
Copy link
Member Author

adrian-prantl commented Feb 17, 2023

Thanks! Here's an even shorter reproducer:

func f(_ l: [Int]) async {
    for item in l {
        var label : String?
        label = "test"
        print("break here")
    }
}

await f([1, 2])

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.

None yet

3 participants