-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Runtime: expose demangle() in Runtime module #84788
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please smoke test |
stdlib/public/runtime/Backtrace.cpp
Outdated
char *outputBuffer, | ||
size_t *outputBufferSize) { | ||
size_t *outputBufferSize, | ||
uint32_t flags) { |
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.
kinda future proofing... i learnt painfully that we "always" need flags in runtime funcs.
stdlib/public/runtime/Backtrace.cpp
Outdated
if (flags == 1) { | ||
// simplified display options, for backtraces | ||
options = DemangleOptions::SimplifiedUIDemangleOptions(); | ||
} |
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.
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.
6402000
to
899d2e9
Compare
@swift-ci please smoke test |
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.
@swift-ci please smoke test |
@swift-ci please smoke test |
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