Skip to content
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

[WIP] Add more mangling information to demangling API. #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdamBrouwersHarries
Copy link

Overview:
This patch adds a field to FrameDebugInfo to store the (original) mangled name that has been retrieved during symbolication, and extends demangle_any to return the demangling scheme used, as well as the demangled name. This allows users of the demangle_any interface and FrameDebugInfo to access (respectively) the scheme by which a given name was mangled, as well as the original mangled name.

Rationale:
I'm currently working on a tool that needs to be able to symbolicise in precisely the same way that samply-symbols/wholesym provides, with one cavaet: I need to be able to access the original mangled names.

Given an address (e.g. from a firefox profile), this is currently quite difficult, as there is no "built-in" way to retrieve an address. Users would instead have to retrieve a de-mangled name from a symbolication source and then manually mangle it themselves. Given the difficulties of mangling, combined with the various sources of mangling (e.g. finding a name from code compiled with MSVC, but re-mangling into an Itanium form), this approach is extremely difficult.

The specific case that I'm interested in is transforming processed Firefox profiles into Clang PGO (profile guided optimisation) compatible profiles. Clang's PGO optimisations are compatibile with sampling based profilers, but require mangled names.

…demangle_any to return the kind of mangling in addition to the name
@mstange
Copy link
Owner

mstange commented May 5, 2023

Interesting, so this gives the mangled names both for the outer function and for any functions that were inlined at the sampled code addresses. Do you know what clang expects for inlined functions? Does it want to know if an inlined function call is hit, or is it ok to just tell it about the outer functions?

@fire
Copy link

fire commented Nov 25, 2023

Is there any reason this isn't merged other than time and effort to review etc.

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.

4 participants