-
Notifications
You must be signed in to change notification settings - Fork 253
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
gimli-symbolize fails with compressed debug info #342
Comments
Thanks for the report! I learned today that libbacktrace embedded a zlib inflater. That's something I never knew before, and is quite surprising to me! In any case given that this is supported by libbacktrace this definitely seems worthwhile to support with gimli too. |
libbacktrace is a pretty wild piece of software, isn't it? :) It's amazing how much software you have to vendor to get reliable backtraces across the various platforms/compiler toolchains that it supports. I'm happy to take a stab at this, @alexcrichton. Let me pop over to gimli and have a look around—unless you're already working on this? |
Nah feel free! I'll warn you though that this crate is semi-nonstandard in that I've been trying to keep the dependencies super slim for eventual inclusion of gimli into libstd. In that sense the implementation may duplicate a bit what's already in the |
Heh, that was actually what motivated me to file this issue! It's easy enough for us to opt-into the old implementation at Materialize when using the library from crates.io, but we'll be in trouble if this winds up in libstd, where we can't twiddle the knobs.
👍 thanks for the heads up! |
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header (nor can I find a source documenting any alignment requirements), so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests (with the BFD linker, lld, and gold) these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header, so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests (with the BFD linker, lld, and gold) these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header, so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix rust-lang#342.
ELF files allow debug info sections to be compressed. The libbacktrace backed supported these compressed sections, but the Gimli backend did not. This commit adds that support to the Gimli backend. In my tests (with the BFD linker, lld, and gold) these debug info sections do not obey the alignment requirements that the object crate expects for the gABI compression header, so this commit additionally enables the "unaligned" feature in the upcoming version of the object crate. There is a bit of unsafe to ensure the lifetime of the decompressed sections matches the lifetime of the mmap'd file. I don't think there is a way around this unsafe code, unless we are willing to ditch Gimli's EndianSlice for an (apparently slower) EndianReader backed by a Cow<[u8]>. Fix #342.
Switch over to the new Gimli-based backtrace symbolicator. Gimli is a pure-Rust reimplementation of libbacktrace that will soon be the default backtrace implementation in the Rust standard library [0]. Switching to it now means we can help shake out problems, like [1], before it ships in the standard library, where fixing problems will require a full six week release cycle. This switch has the side effect of fixing backtraces on macOS, which seem to be broken at the moment because the backtrace crate is picking libbacktrace over coresymbolication. There isn't a good way of fixing that because Cargo doesn't support per-platform features [2]; using neither libbacktrace or coresymbolicator is a kind of stupid but effective way of sidestepping the problem. [0]: rust-lang/rust#73441 [1]: rust-lang/backtrace-rs#342 [2]: rust-lang/cargo#1197
I've put together a full reproduction, with commentary, here: https://github.com/benesch/rust-zdebuginfo
The gist is that Rust generates an absolutely massive amount of debug info by default. (For a deep dive into why, see MaterializeInc/materialize#2691.) One easy workaround is to compress the debug info sections, which you can accomplish on Linux with a
.cargo/config
like the following:Unfortunately, with the new
gimli-symbolizer
feature, backtraces produced by such a binary fail to symbolicate, though the libbacktrace-based implementation handles them fine.The text was updated successfully, but these errors were encountered: