Skip to content

gimli should support supplementary object files #410

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

Closed
2 of 3 tasks
philipc opened this issue Feb 19, 2021 · 2 comments · Fixed by #427
Closed
2 of 3 tasks

gimli should support supplementary object files #410

philipc opened this issue Feb 19, 2021 · 2 comments · Fixed by #427

Comments

@philipc
Copy link
Contributor

philipc commented Feb 19, 2021

Fixing the gimli-symbolize feature to handle supplementary object files shouldn't be a lot of effort:

Also, backtrace-rs doesn't currently follow .gnu_debuglink or NT_GNU_BUILD_ID with the gimli-symbolize feature. I assume that one or both of those are needed too.

@philipc
Copy link
Contributor Author

philipc commented May 5, 2021

@cuviper Since libbacktrace support in this crate is being removed (#423), we'll need to fix this issue rather than #409. I've started looking at what is required, but I'm not familiar with Fedora, so maybe you can help me out with some information.

I'm using Fedora 34 in a container. My initial goal is to write some Rust code that does a backtrace that relies on correct parsing of Fedora's supplementary object files. Unless you have a better suggestion, I think I need to find a C library that I can pass a Rust callback to, and for which Fedora has packaged the debuginfo using dwz with the -m option. Can you suggest something for that?

I was hoping libc would work, but it doesn't appear to use a .gnu_debugaltlink. And kind of related, the build id for libc doesn't make sense to me. Why does the debug link point back to the library instead of to /usr/lib/debug/lib64/libc-2.33.so.debug? I realize I can use .gnu_debuglink instead, so not a problem for me, just something I don't understand.

$ readelf -n /usr/lib64/libc-2.33.so
Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 6e3c087aca9b39549e4ba92c451f1e399b586e28

$ readlink -f /usr/lib/debug/.build-id/6e/3c087aca9b39549e4ba92c451f1e399b586e28
/usr/lib64/libc-2.33.so

@cuviper
Copy link
Member

cuviper commented May 5, 2021

I was hoping libc would work, but it doesn't appear to use a .gnu_debugaltlink.

Some builds don't use dwz for some heuristic reasons -- often due to size, ironically -- but I think glibc has customized their entire debuginfo flow. You could use libdnf as an example for a relatively small library that does have .gnu_debugaltlink.

Why does the debug link point back to the library instead of to /usr/lib/debug/lib64/libc-2.33.so.debug?

$ readlink -f /usr/lib/debug/.build-id/6e/3c087aca9b39549e4ba92c451f1e399b586e28
/usr/lib64/libc-2.33.so

There is a second link $ID.debug for the split debuginfo file.

$ readlink -vf /usr/lib/debug/.build-id/6e/3c087aca9b39549e4ba92c451f1e399b586e28.debug
/usr/lib/debug/usr/lib64/libc-2.33.so.debug

Tangentially, while we're talking about Fedora features, it would be really nice to see support for .gnu_debugdata, which contains compressed symbol tables. For example, the elfutils command eu-readelf --elf-section -s file... can read this.
https://fedoraproject.org/wiki/Features/MiniDebugInfo
https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html

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