Skip to content

Commit 5fc4f79

Browse files
authored
Remove libbacktrace implementation (#423)
* Remove libbacktrace implementation This commit removes the `backtrace-sys` crate and the libbacktrace implementation of this crate. For quite some time now the `gimli-symbolize` feture has been on-by-default. While `libbacktrace` has been an option all relevant features should have been implemented in `gimli-symbolize` by now. The libbacktrace implementation has always been approached with wariness where it may segfault or cause worse behavior when fed bad debug information. Debug information is possible to change at runtime, so libbacktrace has always been a risk for Rust binaries. Additionally libbacktrace development was very quite for a very long time and our patches upstream were generally met with silence. Development seems to have picked back up upstream but with this crate now switched to gimli I'm not too personally motivated to check to see if all our fixes have landed. In general, though, libbacktrace upstream always worked best with Linux and other platforms were more "best-effort". Additionally gimli now has more features for supporting compressed and split-debuginfo as well. This commit comes about to reduce the maintenance burden on this crate. Recent changes in rust-lang/rust have actually broken libbacktrace testing. This appears fixed with sync'ing to the upstream repository of libbacktrace, but it seems like now's the right time to go ahead and remove the crate. * Fix MSVC test * Fix a macOS test
1 parent fbb9fc1 commit 5fc4f79

File tree

13 files changed

+30
-835
lines changed

13 files changed

+30
-835
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,39 +52,24 @@ jobs:
5252
shell: bash
5353
if: matrix.rust == 'stable-i686-msvc'
5454

55-
# Force packed debuginfo on macOS because libbacktrace only works with
56-
# packed debuginfo. We specifically test later that both packed and
57-
# unpacked work.
58-
- run: |
59-
echo CARGO_PROFILE_DEV_SPLIT_DEBUGINFO=packed >> $GITHUB_ENV
60-
echo CARGO_PROFILE_TEST_SPLIT_DEBUGINFO=packed >> $GITHUB_ENV
61-
if: matrix.os == 'macos-latest'
62-
63-
- run: cargo build --manifest-path crates/backtrace-sys/Cargo.toml
6455
- run: cargo build
6556
- run: cargo test
66-
- run: cargo test --features "gimli-symbolize"
67-
# run: cargo test --features "libbacktrace"
68-
- run: cargo check --features "libbacktrace gimli-symbolize"
6957
- run: cargo test --features "serialize-rustc"
7058
- run: cargo test --features "serialize-serde"
7159
- run: cargo test --features "verify-winapi"
7260
- run: cargo test --features "cpp_demangle"
7361
- run: cargo test --no-default-features
74-
- run: cargo test --no-default-features --features "libbacktrace"
75-
- run: cargo test --no-default-features --features "gimli-symbolize"
76-
- run: cargo test --no-default-features --features "gimli-symbolize libbacktrace"
77-
- run: cargo test --no-default-features --features "libbacktrace std"
78-
- run: cargo test --no-default-features --features "gimli-symbolize std"
7962
- run: cargo test --no-default-features --features "std"
8063
- run: cargo test --manifest-path crates/cpp_smoke_test/Cargo.toml
64+
# This test is specifically about packed debuginfo with `*.dSYM` files
8165
- run: cargo test --manifest-path crates/macos_frames_test/Cargo.toml
82-
- run: cargo test --features libbacktrace --manifest-path crates/without_debuginfo/Cargo.toml
66+
env:
67+
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: packed
68+
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: packed
8369
- run: cargo test --features gimli-symbolize --manifest-path crates/without_debuginfo/Cargo.toml
84-
- run: cargo test --manifest-path crates/line-tables-only/Cargo.toml --features libbacktrace
8570
- run: cargo test --manifest-path crates/line-tables-only/Cargo.toml --features gimli-symbolize
8671

87-
# Test that if debuginfo is compressed gimli still works
72+
# Test debuginfo compression still works
8873
- run: cargo test
8974
if: contains(matrix.os, 'ubuntu')
9075
env:

Cargo.toml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ exclude = ['crates/without_debuginfo', 'crates/macos_frames_test', 'crates/line-
2222
[dependencies]
2323
cfg-if = "1.0"
2424
rustc-demangle = "0.1.4"
25-
backtrace-sys = { path = "crates/backtrace-sys", version = "0.1.35", optional = true, default_features = false }
2625
libc = { version = "0.2.94", default-features = false }
2726

2827
# Optionally enable the ability to serialize a `Backtrace`, controlled through
@@ -36,11 +35,10 @@ cpp_demangle = { default-features = false, version = "0.3.0", optional = true }
3635

3736
# Optional dependencies enabled through the `gimli-symbolize` feature, do not
3837
# use these features directly.
39-
addr2line = { version = "0.15.1", optional = true, default-features = false }
40-
miniz_oxide = { version = "0.4.0", optional = true, default-features = false }
38+
addr2line = { version = "0.15.1", default-features = false }
39+
miniz_oxide = { version = "0.4.0", default-features = false }
4140
[dependencies.object]
4241
version = "0.24"
43-
optional = true
4442
default-features = false
4543
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
4644

@@ -58,26 +56,11 @@ libloading = "0.6"
5856

5957
[features]
6058
# By default libstd support and gimli-symbolize is used to symbolize addresses.
61-
default = ["std", "gimli-symbolize"]
59+
default = ["std"]
6260

6361
# Include std support. This enables types like `Backtrace`.
6462
std = []
6563

66-
#=======================================
67-
# Methods of resolving symbols
68-
#
69-
# - gimli-symbolize: use the `gimli-rs/addr2line` crate to symbolicate
70-
# addresses into file, line, and name using DWARF debug information.
71-
# - libbacktrace: this feature activates the `backtrace-sys` dependency,
72-
# building the libbacktrace library found in gcc repos.
73-
#
74-
# Note that MSVC unconditionally uses the dbghelp library to symbolize and won't
75-
# be affected by feature selection here. Also note that it's highly unlikely you
76-
# want to configure this. If you're having trouble getting backtraces it's
77-
# likely best to open an issue.
78-
gimli-symbolize = ["addr2line", "miniz_oxide", "object"]
79-
libbacktrace = ["backtrace-sys/backtrace-sys"]
80-
8164
#=======================================
8265
# Methods of serialization
8366
#
@@ -91,11 +74,13 @@ serialize-serde = ["serde"]
9174
# Only here for backwards compatibility purposes or for internal testing
9275
# purposes. New code should use none of these features.
9376
coresymbolication = []
77+
dbghelp = []
9478
dladdr = []
79+
gimli-symbolize = []
9580
kernel32 = []
96-
unix-backtrace = []
81+
libbacktrace = []
9782
libunwind = []
98-
dbghelp = []
83+
unix-backtrace = []
9984
verify-winapi = [
10085
'winapi/dbghelp',
10186
'winapi/handleapi',
@@ -132,7 +117,7 @@ edition = '2018'
132117

133118
[[test]]
134119
name = "accuracy"
135-
required-features = ["std", "gimli-symbolize"]
120+
required-features = ["std"]
136121
edition = '2018'
137122

138123
[[test]]

crates/backtrace-sys/Cargo.toml

Lines changed: 0 additions & 27 deletions
This file was deleted.

crates/backtrace-sys/LICENSE-APACHE

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/backtrace-sys/LICENSE-MIT

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/backtrace-sys/build.rs

Lines changed: 0 additions & 168 deletions
This file was deleted.

crates/backtrace-sys/src/android-api.c

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/backtrace-sys/src/lib.rs

Lines changed: 0 additions & 58 deletions
This file was deleted.

crates/backtrace-sys/src/libbacktrace

Submodule libbacktrace deleted from 5c88e09

0 commit comments

Comments
 (0)