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

SwiftUI names are not demangled #3914

Open
sindresorhus opened this issue Apr 27, 2024 · 5 comments
Open

SwiftUI names are not demangled #3914

sindresorhus opened this issue Apr 27, 2024 · 5 comments

Comments

@sindresorhus
Copy link

sindresorhus commented Apr 27, 2024

Platform

macOS

Environment

Production

Installed

Swift Package Manager

Version

8.24.0

Did it work on previous versions?

No

Steps to Reproduce

Look at this report: https://sindresorhus.sentry.io/share/issue/0e4faa9089734b2bbe498a1e876fb30e/

In the stack trace:

7SwiftUI4ViewRzlAA15ModifiedContentVyxAA16OnSubmitModifierVGAaBHPxAaBHD1__AfA0cH0HPyHCHCTm
7SwiftUI4ViewRzlAA15ModifiedContentVyxAA21_DefaultFocusModifierVGAaBHPxAaBHD1__AfA0cH0HPyHCHCTm

Expected Result

I expected them to be demangled.

Actual Result

They are not demangled.

Are you willing to submit a PR?

No

@philipphofmann
Copy link
Member

Thanks for opening this. It might be related to #3081.

@Swatinem
Copy link
Member

I dug into this a little bit, and it turns out that when you use Verbose Function Names, both of these are prefixed with get_witness_table , which is being generated right here:

https://github.com/apple/swift/blob/3caef440583aa16ff0164395899b6e87e234f427/lib/IRGen/GenReflection.cpp#L519-L522

Swifts own demangler does not recognize that, as is it does not start with a proper swift mangling prefix.
(Admittedly, our demangler is based on Swift 5.5.1 which is a bit out of date)

However, if I replace that with the proper prefix ($s), I get the following:

  • <A>concrete protocol conformance ModifiedContent<A, OnSubmitModifier>protocol conformance ref (type's module) Viewdependent root protocol conformance #0 AViewconcrete protocol conformance OnSubmitModifierprotocol conformance ref (type's module) ViewModifier
  • <A>concrete protocol conformance ModifiedContent<A, _DefaultFocusModifier>protocol conformance ref (type's module) Viewdependent root protocol conformance #0 AViewconcrete protocol conformance _DefaultFocusModifierprotocol conformance ref (type's module) ViewModifier

That is quite a mouthful, and TBH I have no idea what any of that means.

Long story short, the compiler has to output a proper swift symbol with the proper prefix for it to be demangled properly.

@Swatinem
Copy link
Member

But it might also be related to #3081 as @philipphofmann mentioned, as its quite possible that we just end up trying to demangle the name of some static data table because we lack access to proper debug symbols.

@philipphofmann
Copy link
Member

If I got it right @Swatinem, except from doing #3081 there isn't much we can do right now, except to wait for Apple to provide proper dSYMs for SwiftUI?

@Swatinem
Copy link
Member

Indeed, we need to have a proper dSYM, otherwise its hard to move forward on any of this.

@kahest kahest moved this from Needs Discussion to Blocked in Mobile & Cross Platform SDK May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Blocked
Development

No branches or pull requests

3 participants