Skip to content

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Oct 9, 2025

We should expose the demangle functionality; It's been widely used by calling into internal _swift_demangle and instead we should offer a real API. It's also already used in the Runtime module already when forming backtraces.

Previous discussions happened between 2019 and 2024, and just never materialized in a complete implementation and proposal.

Right now, even more tools are in need of this API, as we are building continious profiling solutions etc, so it is a good time to revisit this topic.

This PR is roughly based off @Azoy's
https://github.com/swiftlang/swift/pull/25314/files#diff-fd379a721cc9a1c9ef6486eae713e945da842b42170d4d069029a57334371eba from 2019, however it brings it over to the new Runtime module which is a great place to put this functionality - even Backtrace had to recently reinvent calling the demangling infra in this module.

Pending SE review, proposal here.

cc @Azoy @al45tair

@ktoso
Copy link
Contributor Author

ktoso commented Oct 9, 2025

@swift-ci please smoke test

@ktoso ktoso requested a review from Azoy October 9, 2025 11:49
char *outputBuffer,
size_t *outputBufferSize) {
size_t *outputBufferSize,
uint32_t flags) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

kinda future proofing... i learnt painfully that we "always" need flags in runtime funcs.

if (flags == 1) {
// simplified display options, for backtraces
options = DemangleOptions::SimplifiedUIDemangleOptions();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping the current behavior you did for backtracer @al45tair

We should finally expose the demangle functionality; It's been widely
used by calling into internal _swift_demangle and instead we should
offer a real API.

Previous discussions happened between 2019 and 2024, and just never
materialized in a complete implementation and proposal.

Right now, even more tools are in need of this API, as we are building
continious profiling solutions etc, so it is a good time to revisit
this topic.

This PR is roughly based off @Azoy's
https://github.com/swiftlang/swift/pull/25314/files#diff-fd379a721cc9a1c9ef6486eae713e945da842b42170d4d069029a57334371eba
from 2019, however it brings it over to the new Runtime module which is
a great place to put this functionality - even Backtrace had to recently
reinvent calling the demangling infra in this module.

Pending SE review.
@ktoso ktoso force-pushed the wip-demangle-string branch from 6402000 to 899d2e9 Compare October 10, 2025 01:08
@ktoso
Copy link
Contributor Author

ktoso commented Oct 10, 2025

@swift-ci please smoke test

Azoy and others added 2 commits October 10, 2025 11:41
We should finally expose the demangle functionality; It's been widely
used by calling into internal _swift_demangle and instead we should
offer a real API.

Previous discussions happened between 2019 and 2024, and just never
materialized in a complete implementation and proposal.

Right now, even more tools are in need of this API, as we are building
continious profiling solutions etc, so it is a good time to revisit
this topic.

This PR is roughly based off @Azoy's
https://github.com/swiftlang/swift/pull/25314/files#diff-fd379a721cc9a1c9ef6486eae713e945da842b42170d4d069029a57334371eba
from 2019, however it brings it over to the new Runtime module which is
a great place to put this functionality - even Backtrace had to recently
reinvent calling the demangling infra in this module.

Pending SE review.
@ktoso
Copy link
Contributor Author

ktoso commented Oct 10, 2025

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented Oct 10, 2025

@swift-ci please smoke test

@ktoso ktoso added swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review concurrency Feature: umbrella label for concurrency language features labels Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

concurrency Feature: umbrella label for concurrency language features swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants