Skip to content

RemoteInspection: Handle ObjC typerefs in computeUnalignedFieldStartOffset #76678

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

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Sep 24, 2024

This change is part of a fix for a regression that wasn't noticed because lldb has a fallback to using ASTContexts when type metadata resolution fails.

For any Swift class that directly or indirectly inherits from an ObjC class (such as NSObject, NSView, etc), the function computeUnalignedFieldStartOffset will fail to compute the start offset. To compute the start offset, it traverses the parent classes and uses their sizes. Once the traversal reaches an ObjC class, the RemoteInspection does not know the size. The fix here is to get the size from the TypeInfo returned by the external TypeInfoProvider (which in LLDB is LLDBTypeInforProvider).

Depended on by swiftlang/llvm-project#9320

@kastiglione kastiglione marked this pull request as ready for review September 26, 2024 17:17
@kastiglione
Copy link
Contributor Author

@swift-ci smoke test

@kastiglione
Copy link
Contributor Author

swiftlang/llvm-project#9320

@swift-ci smoke test macOS

kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Sep 27, 2024
Extend `LLDBTypeInfoProvider` to support ObjC class names (such as "NSObject", 
"NSView") in addition to mangled Swift names.

This is to support `ObjCClassTypeRefs`, which contain the class name, but not the 
mangled name. Note that `ObjCClassTypeRefs` are typerefs for classes in the ObjC 
(`__C`) module.

Depends on swiftlang/swift#76678
@kastiglione kastiglione merged commit b8f1876 into main Sep 27, 2024
3 checks passed
@kastiglione kastiglione deleted the dl/main/RemoteInspection-Handle-ObjC-typerefs-in-computeUnalignedFieldStartOffset branch September 27, 2024 18:12
adrian-prantl pushed a commit to adrian-prantl/llvm-project that referenced this pull request Sep 27, 2024
Extend `LLDBTypeInfoProvider` to support ObjC class names (such as "NSObject",
"NSView") in addition to mangled Swift names.

This is to support `ObjCClassTypeRefs`, which contain the class name, but not the
mangled name. Note that `ObjCClassTypeRefs` are typerefs for classes in the ObjC
(`__C`) module.

Depends on swiftlang/swift#76678

(cherry picked from commit 4a1abae)
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Sep 30, 2024
Extend `LLDBTypeInfoProvider` to support ObjC class names (such as "NSObject",
"NSView") in addition to mangled Swift names.

This is to support `ObjCClassTypeRefs`, which contain the class name, but not the
mangled name. Note that `ObjCClassTypeRefs` are typerefs for classes in the ObjC
(`__C`) module.

Depends on swiftlang/swift#76678

(cherry picked from commit 4a1abae)
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Sep 30, 2024
Extend `LLDBTypeInfoProvider` to support ObjC class names (such as "NSObject", 
"NSView") in addition to mangled Swift names.

This is to support `ObjCClassTypeRefs`, which contain the class name, but not the 
mangled name. Note that `ObjCClassTypeRefs` are typerefs for classes in the ObjC 
(`__C`) module.

Depends on swiftlang/swift#76678

(cherry picked from commit 4a1abae)
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