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

Wrong symbols for Rust binary #37

Closed
zecakeh opened this issue Mar 24, 2023 · 2 comments · Fixed by #38
Closed

Wrong symbols for Rust binary #37

zecakeh opened this issue Mar 24, 2023 · 2 comments · Fixed by #38

Comments

@zecakeh
Copy link
Contributor

zecakeh commented Mar 24, 2023

When profiling a Rust binary, it seems the symbols are not correct. Instead of the function names for all my binary I get fun_XXXX where XXXX is an hexadecimal number. However function names for C libraries we depend on are properly displayed.

I know that the symbols are available because using e.g. flamegraph, the proper function names show up.

I would like to help debug this but the only error I'm seeing is this in the web console:

17:38:33,589 SymbolsNotFoundError: Could not obtain symbols for [vdso]/000000000000000000000000000000000.
 - Error: The symbol server does not have symbols for [vdso]/000000000000000000000000000000000.
 - Error: No connection to the browser, cannot run querySymbolicationApi
 - Error: No connection to the browser, cannot obtain symbol tables
    Fi errors.js:16
    _getSymbolTablesFromBrowser symbol-store.js:504
symbolication.js:915:14
@mstange
Copy link
Owner

mstange commented Mar 24, 2023

Is this on Linux or macOS? Can you share the binary and the profile.json file with me (e.g. by email)? Does this also reproduce with a samply compiled manually from the main branch of this repo?

@zecakeh
Copy link
Contributor Author

zecakeh commented Mar 25, 2023

This is on Linux, this is an open source project called Fractal. The problem still happens on the main branch.

I have investigated further, getting the symbols works fine if they are included in the binary. However as part of our release process, the debuginfo is split into a fractal.debug file with eu-strip from elfutils. The command is:

eu-strip --remove-comment --reloc-debug-sections -f fractal.debug

It's after this point that the symbols seem to not be found. The binary is in /app/bin/fractal and the debug file is in /usr/lib/debug/app/bin/fractal.debug so according to GDB's guide for separate debug files it should be found.

I have also tried placing fractal.debug alongside fractal, and in a .debug subfolder with the same result.

Finally, after some investigating, the culprit seems to be this function:

fn get_candidate_paths_for_gnu_debug_link_dest(
&self,
debug_link_name: &str,
) -> FileAndPathHelperResult<Vec<WholesymFileLocation>> {
// https://www-zeuthen.desy.de/unix/unixguide/infohtml/gdb/Separate-Debug-Files.html
Ok(vec![
WholesymFileLocation::LocalFile(PathBuf::from(format!(
"/usr/bin/{}.debug",
&debug_link_name
))),
WholesymFileLocation::LocalFile(PathBuf::from(format!(
"/usr/bin/.debug/{}.debug",
&debug_link_name
))),
WholesymFileLocation::LocalFile(PathBuf::from(format!(
"/usr/lib/debug/usr/bin/{}.debug",
&debug_link_name
))),
])
}

The binary's location is hardcoded as /usr/bin, but it shouldn't be.

I might have time to open a PR about that later today and to test it to make sure that's the only issue.

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 a pull request may close this issue.

2 participants