-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[swift-inspect] Add a mode to search for and dump generic metadata without metadata iteration enabled. #84446
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
tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift
Outdated
Show resolved
Hide resolved
if typeref == 0 { return nil } | ||
|
||
let info = swift_reflection_infoForTypeRef(self, typeref) | ||
let nameableTypes = [ |
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.
nominalTypes
seems like a better name
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.
You'd think I would have absorbed something from all these years working with compiler engineers.
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.
To be fair, NASA thoroughly muddied the waters on the meaning of the word “nominal”… (at least, I assume it was them… maybe I'm blaming them unfairly and they got it from Boeing or somewhere…)
f9204a3
to
6fd1452
Compare
Updated to address comments. |
6fd1452
to
069b4c8
Compare
@swift-ci please test |
@swift-ci please test macos platform |
…thout metadata iteration enabled. We scan the target's initial allocation pool, and all 16kB heap allocations. We check each pointer-aligned offset within those areas, and try to read it as Swift metadata and get a name from it. If that fails, quietly move on. It's very unlikely for some random memory to look enough like Swift metadata for this to produce a name, so this works very well to print the generic metadata instantiated in the remote process without requiring `SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION`. rdar://161120936
069b4c8
to
513f5fb
Compare
The new symbols need to be added to the ABI tests. |
@swift-ci please test |
We scan the target's initial allocation pool, and all 16kB heap allocations. We check each pointer-aligned offset within those areas, and try to read it as Swift metadata and get a name from it. If that fails, quietly move on. It's very unlikely for some random memory to look enough like Swift metadata for this to produce a name, so this works very well to print the generic metadata instantiated in the remote process without requiring
SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION
.rdar://161120936