Please sign in to comment.
std: Depend on `backtrace` crate from crates.io
This commit removes all in-tree support for generating backtraces in favor of depending on the `backtrace` crate on crates.io. This resolves a very longstanding piece of duplication where the standard library has long contained the ability to generate a backtrace on panics, but the code was later extracted and duplicated on crates.io with the `backtrace` crate. Since that fork each implementation has seen various improvements one way or another, but typically `backtrace`-the-crate has lagged behind libstd in one way or another. The goal here is to remove this duplication of a fairly critical piece of code and ensure that there's only one source of truth for generating backtraces between the standard library and the crate on crates.io. Recently I've been working to bring the `backtrace` crate on crates.io up to speed with the support in the standard library which includes: * Support for `StackWalkEx` on MSVC to recover inline frames with debuginfo. * Using `libbacktrace` by default on MinGW targets. * Supporting `libbacktrace` on OSX as an option. * Ensuring all the requisite support in `backtrace`-the-crate compiles with `#![no_std]`. * Updating the `libbacktrace` implementation in `backtrace`-the-crate to initialize the global state with the correct filename where necessary. After reviewing the code in libstd the `backtrace` crate should be at exact feature parity with libstd today. The backtraces generated should have the same symbols and same number of frames in general, and there's not known divergence from libstd currently. Note that one major difference between libstd's backtrace support and the `backtrace` crate is that on OSX the crates.io crate enables the `coresymbolication` feature by default. This feature, however, uses private internal APIs that aren't published for OSX. While they provide more accurate backtraces this isn't appropriate for libstd distributed as a binary, so libstd's dependency on the `backtrace` crate explicitly disables this feature and forces OSX to use `libbacktrace` as a symbolication strategy. The long-term goal of this refactoring is to eventually move us towards a world where we can drop `libbacktrace` entirely and simply use Gimli and the surrounding crates for backtrace support. That's still aways off but hopefully will much more easily enabled by having the source of truth for backtraces live in crates.io! Procedurally if we go forward with this I'd like to transfer the `backtrace-rs` crate to the rust-lang GitHub organization as well, but I figured I'd hold off on that until we get closer to merging.
- Loading branch information...
Showing with 207 additions and 2,162 deletions.
- +39 −28 Cargo.lock
- +12 −3 src/libstd/Cargo.toml
- +0 −116 src/libstd/sys/cloudabi/backtrace.rs
- +0 −2 src/libstd/sys/cloudabi/mod.rs
- +0 −32 src/libstd/sys/redox/backtrace/mod.rs
- +0 −1 src/libstd/sys/redox/backtrace/printing.rs
- +0 −99 src/libstd/sys/redox/backtrace/tracing.rs
- +0 −2 src/libstd/sys/redox/mod.rs
- +0 −98 src/libstd/sys/sgx/backtrace.rs
- +0 −2 src/libstd/sys/sgx/mod.rs
- +0 −110 src/libstd/sys/unix/backtrace/mod.rs
- +0 −34 src/libstd/sys/unix/backtrace/printing/dladdr.rs
- +0 −33 src/libstd/sys/unix/backtrace/printing/mod.rs
- +0 −39 src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs
- +0 −99 src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
- +0 −8 src/libstd/sys/unix/backtrace/tracing/mod.rs
- +0 −2 src/libstd/sys/unix/mod.rs
- +0 −27 src/libstd/sys/wasi/backtrace.rs
- +0 −2 src/libstd/sys/wasi/mod.rs
- +0 −27 src/libstd/sys/wasm/backtrace.rs
- +0 −2 src/libstd/sys/wasm/mod.rs
- +0 −53 src/libstd/sys/windows/backtrace/backtrace_gnu.rs
- +0 −355 src/libstd/sys/windows/backtrace/mod.rs
- +0 −24 src/libstd/sys/windows/backtrace/printing/mod.rs
- +0 −208 src/libstd/sys/windows/backtrace/printing/msvc.rs
- +0 −371 src/libstd/sys/windows/c.rs
- +0 −44 src/libstd/sys/windows/dynamic_lib.rs
- +0 −4 src/libstd/sys/windows/mod.rs
- +153 −151 src/libstd/sys_common/backtrace.rs
- +0 −175 src/libstd/sys_common/gnu/libbacktrace.rs
- +0 −5 src/libstd/sys_common/gnu/mod.rs
- +0 −6 src/libstd/sys_common/mod.rs
- +1 −0 src/tools/rustc-workspace-hack/Cargo.toml
- +1 −0 src/tools/tidy/src/deps.rs
- +1 −0 src/tools/tidy/src/pal.rs
Oops, something went wrong.