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

Symbol demangling #74

Merged
merged 7 commits into from
Aug 6, 2020
Merged

Symbol demangling #74

merged 7 commits into from
Aug 6, 2020

Conversation

Stupremee
Copy link
Contributor

I'm not sure if this is the approach you wanted, but I think this should work.

Resolves #71

@Stupremee
Copy link
Contributor Author

There's definitely something not working. Please dont merge

@nbaksalyar
Copy link
Member

Thanks, this is great! I think we can also change the list of expected names in tests/unwind_stack.rs to verify the demangling routines work correctly. Do you want to do this as a part of this pull request?

@Stupremee
Copy link
Contributor Author

Yes that's how I saw that my code is broken

@bjorn3
Copy link
Contributor

bjorn3 commented Aug 5, 2020

I just remembered that addr2line already has demangling support. This also handles inlined functions. https://docs.rs/addr2line/0.13.0/addr2line/struct.FunctionName.html#method.demangle

Directly using rustc-demangle is useful for when there is no DWARF debuginfo though.

"_ZN3std2rt19lang_start_internal17h",
"hello::main::",
"std::rt::lang_start::{{closure}}::",
"std::rt::lang_start_internal::",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think get_address_symbol_name should not demangle the name. Instead there could be an extra method get_address_demangled_name.

@nbaksalyar
Copy link
Member

addr2line already has demangling support

Yeah, it also seems to be automatically choosing between the C++ & Rust mangling schemes depending on DWARF lang param, which is a nice feature if we want to support more langs in the future. So we can probably use addr2line as the default demangling function and resort to the direct rustc-demangle when there's no DWARF available?

@Stupremee
Copy link
Contributor Author

I just remembered that addr2line already has demangling support.

That sounds good. Should I wait for #54 or add it here as well?

@bjorn3
Copy link
Contributor

bjorn3 commented Aug 5, 2020

Please wait, it conflicts with #54.

@nbaksalyar
Copy link
Member

#54 is merged now 👍

src/symbol/sym.rs Outdated Show resolved Hide resolved
Copy link
Member

@nbaksalyar nbaksalyar left a comment

Choose a reason for hiding this comment

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

Thank you!

src/symbol/sym.rs Outdated Show resolved Hide resolved
@bjorn3
Copy link
Contributor

bjorn3 commented Aug 5, 2020

Can you change

.get_address_symbol_name(func)
to use the demangled name?

@nbaksalyar nbaksalyar merged commit c0ce589 into headcrab-rs:master Aug 6, 2020
@nbaksalyar
Copy link
Member

Thank you!

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.

Demangle symbol names
3 participants