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

linux: PE binaries need a different debug_name from name #164

Open
ishitatsuyuki opened this issue Apr 30, 2024 · 1 comment
Open

linux: PE binaries need a different debug_name from name #164

ishitatsuyuki opened this issue Apr 30, 2024 · 1 comment

Comments

@ishitatsuyuki
Copy link
Contributor

The Linux backend currently assumes that files have a debug_name equivalent to name (and likewise for name):

Some(LibraryInfo {
debug_id,
code_id: code_id.map(|ci| ci.to_string()),
path: path.to_owned(),
debug_path: path.to_owned(),
debug_name: name.to_owned(),
name: name.to_owned(),
arch: None,
symbol_table: None,
})

This assumption is valid for ELF, but not for PE (e.g. binaries running on Wine). PE binaries would get the wrong debug_name which will:

  • Hit load_symbol_map_for_pdb_corresponding_to_binary, which only looks for PdbFilename (debug_path), and does not resolve dirname(path) + debug_name. The former is usually a path on the build machine, so if the file is redistributed it does not resolve.
  • Fail to retrieve symbols from SymSrv, because debug_name needs to be the pdb's filename. The DebugId is correct because we use the debug_id_for_object helper.

We already have a helper in wholesym to determine the correct debug_ids, so we should probably extend the helper to the entire LibraryInfo.

@mstange
Copy link
Owner

mstange commented Apr 30, 2024

wholesym has library_info_for_binary_at_path, but it's async.

In 2bcbdf1 we're duplicating this code into the samply package (but with sync IO). Once that PR lands we can move it to samply/src/shared and use it in the Linux converter.

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

No branches or pull requests

2 participants