Skip to content

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Sep 22, 2025

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

@mikeash mikeash marked this pull request as ready for review September 22, 2025 21:30
@mikeash mikeash requested review from a team, al45tair and compnerd as code owners September 22, 2025 21:30
if typeref == 0 { return nil }

let info = swift_reflection_infoForTypeRef(self, typeref)
let nameableTypes = [
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor

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…)

@mikeash mikeash force-pushed the swift-inspect-scan-search branch from f9204a3 to 6fd1452 Compare September 23, 2025 14:43
@mikeash mikeash requested a review from rjmccall as a code owner September 23, 2025 14:43
@mikeash
Copy link
Contributor Author

mikeash commented Sep 23, 2025

Updated to address comments.

@mikeash mikeash force-pushed the swift-inspect-scan-search branch from 6fd1452 to 069b4c8 Compare September 23, 2025 14:45
@mikeash
Copy link
Contributor Author

mikeash commented Sep 23, 2025

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Sep 25, 2025

@swift-ci please test macos platform

@mikeash mikeash enabled auto-merge September 25, 2025 17:06
…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
@mikeash mikeash force-pushed the swift-inspect-scan-search branch from 069b4c8 to 513f5fb Compare September 26, 2025 14:52
@mikeash
Copy link
Contributor Author

mikeash commented Sep 26, 2025

The new symbols need to be added to the ABI tests.

@mikeash
Copy link
Contributor Author

mikeash commented Sep 26, 2025

@swift-ci please test

@mikeash mikeash merged commit 3f610e9 into swiftlang:main Sep 26, 2025
5 checks passed
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.

3 participants