Skip to content

[lldb] Read swift metadata from symbol rich binary #3960

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

Merged

Conversation

augusto2112
Copy link

In cases where Swift metadata is present in the symbol rich binary, read
swift metadata from it instead of from the main binary or the process.
This patch essentially re-uses the functionality implemented to read
metadata from the file-cache to achieve this.

@augusto2112
Copy link
Author

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

I think this looks great!

@@ -10,6 +10,9 @@ let Definition = "target_experimental" in {
def SwiftUseReflectionSymbols : Property<"swift-use-reflection-symbols", "Boolean">,
Global, DefaultTrue,
Desc<"if true, optimize the loading of Swift reflection metadata by making use of available symbols.">;
def SwiftReadMetadataFromDSYM: Property<"swift-read-metadata-from-dsym", "Boolean">,

Choose a reason for hiding this comment

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

It's great that you made this switchable, but dsymutil only copies reflection metadata if the linker has stripped it, so there's little risk in pessimizing existing workflows with this feature.

@@ -77,6 +87,10 @@ class LLDBMemoryReader : public swift::remote::MemoryReader {
/// module's virtual address space.
std::vector<std::pair<uint64_t, lldb::ModuleSP>> m_range_module_map;

/// The set of modules where we should read memory from the symbol file's
/// object file instead of the main object file.
std::unordered_set<lldb::ModuleSP> m_modules_with_metadata_in_symbol_obj_file;

Choose a reason for hiding this comment

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

I would use an llvm::DenseSet<> but that's more out of habit.

@augusto2112
Copy link
Author

swiftlang/swift#41454
@swift-ci test

@augusto2112 augusto2112 force-pushed the read-from-dsym-obj-file branch 3 times, most recently from 7ad05b5 to c41767a Compare February 18, 2022 19:06
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

swiftlang/swift#41454
@swift-ci test

@augusto2112 augusto2112 force-pushed the read-from-dsym-obj-file branch from c41767a to fd3b104 Compare February 19, 2022 15:59
@augusto2112
Copy link
Author

swiftlang/swift#41454
@swift-ci test

In cases where Swift metadata is present in the symbol rich binary, read
swift metadata from it instead of from the main binary or the process.
This patch essentially re-uses the functionality implemented to read
metadata from the file-cache to achieve this.
@augusto2112 augusto2112 force-pushed the read-from-dsym-obj-file branch from fd3b104 to 983632d Compare February 19, 2022 18:33
@augusto2112
Copy link
Author

swiftlang/swift#41454
@swift-ci test

@augusto2112 augusto2112 merged commit 6cd2a78 into swiftlang:stable/20211026 Feb 19, 2022
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