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

Uclibc fixes #1

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
abf37f7
Removing functions non-existant in uclibc (#281)
plauche Jan 31, 2020
364a705
Touch up style
alexcrichton Jan 31, 2020
190b2f9
Remove backtrace header and bump version (#286)
yaahc Feb 11, 2020
4200442
Upgrade goblin to 0.2 (#295)
cuviper Feb 26, 2020
e2e23c8
don't let rustc-dep-of-std enable backtrace-sys (#297)
RalfJung Mar 2, 2020
c5f56d1
Build libbacktrace with mmapio.c instead of read.c (except on Windows…
Aaron1011 Mar 3, 2020
ac175e2
gimli: Implement symbol table searches on macOS (#300)
alexcrichton Mar 3, 2020
a9d6076
Bump version numbers
alexcrichton Mar 4, 2020
594ffa6
Don't use mmap on macOS (#302)
Aaron1011 Mar 10, 2020
6ffa2c3
Bump backtrace-sys to 0.1.34
alexcrichton Mar 10, 2020
704b55c
Support line-tables-only when using libbacktrace (#303)
Mar 17, 2020
d8951b7
Test line-tables-only with gimli too
alexcrichton Mar 17, 2020
703aeee
Update libbacktrace to latest master (#299)
t6 Mar 24, 2020
4c83b0c
Update submodule URL
alexcrichton Mar 24, 2020
f823290
Define HAVE_KERN_PROC on FreeBSD to fix rust-lang/rust#54434 (#294)
t6 Mar 24, 2020
b32b50e
Remove removed ios targets
alexcrichton Mar 24, 2020
4928ca6
Try stable toolchains for windows tests
alexcrichton Mar 24, 2020
1c70f2b
Removing more ios from CI
alexcrichton Mar 24, 2020
294ee13
Bump crate versions
alexcrichton Mar 24, 2020
e8404c8
Bump backtrace version
alexcrichton Mar 24, 2020
b53c52b
Fix an off-by-one error in backtrace-sys
alexcrichton Apr 20, 2020
a6eb60f
Only explicitly configure debuginfo in rustc-dep-of-std
alexcrichton Apr 20, 2020
c8067c6
Bump backtrace-sys to 0.1.36
alexcrichton Apr 20, 2020
611a766
Remove memmap dependency (#311)
alexcrichton Apr 20, 2020
0b2b800
Don't look for old RUSTC_DEBUGINFO vars (#313)
tmandry Apr 30, 2020
8af627d
Bump backtrace-sys to 0.1.37
alexcrichton Apr 30, 2020
688e20e
Remove dependency on `findshlibs` (#314)
alexcrichton May 1, 2020
df444be
Remove coresymbolication implementation (#316)
alexcrichton May 8, 2020
1ffdc8a
Remove dladdr fallback and implementation (#317)
alexcrichton May 12, 2020
301358d
Update `addr2line` dependency (#321)
alexcrichton May 12, 2020
7a95a02
Reorganize gimli internals slightly (#322)
alexcrichton May 12, 2020
40f3954
Migrate towards sunsetting features on this crate (#323)
alexcrichton May 12, 2020
3af3ec7
Tweak some CI testing
alexcrichton May 12, 2020
29af390
Automatically enable `std` feature with `gimli-symbolize`
alexcrichton May 12, 2020
67ccecb
Update comments in `Cargo.toml`
alexcrichton May 12, 2020
bb5aa64
Enable gimli on all platforms
alexcrichton May 12, 2020
5ad0b76
Switch to `gimli-symbolize` by default (#324)
alexcrichton May 12, 2020
fbcfd0e
Bump to 0.3.47
alexcrichton May 12, 2020
4578e94
Update readme/misc
alexcrichton May 12, 2020
c44e881
Fix a nightly warning
alexcrichton May 12, 2020
aa88e51
More warning fixes for `dyn Trait`
alexcrichton May 12, 2020
0a8a646
Prioritize libbacktrace of gimli in #[cfg]
alexcrichton May 12, 2020
6ff7f7c
Fix `dyn Trait` in noop modules
alexcrichton May 12, 2020
16682c7
dyn Trait fixes in libbacktrace
alexcrichton May 12, 2020
788e521
Avoid panicking on overflow due to bias wrapping (#330)
alexcrichton May 13, 2020
108472f
Bump to 0.3.48
alexcrichton May 13, 2020
1ca764e
Warn about 2018 idioms (#331)
alexcrichton May 13, 2020
02bc46f
Add a test that dynamically loaded libraries symbolicate (#332)
alexcrichton May 14, 2020
635e159
Add the `Frame::sp` method to get the frame's stack pointer (#341)
fitzgen Jun 9, 2020
17493e1
Update test images (#343)
alexcrichton Jun 9, 2020
d4f24b1
Fix anonymous lifetime warnings for libbacktrace
alexcrichton Jun 9, 2020
3cf8cbf
Fix some more nightly warnings about lifetimes
alexcrichton Jun 10, 2020
d471d23
Add support for MinGW dynamic libs (#345)
alexcrichton Jun 10, 2020
05319f4
Handle compressed debug sections in ELF files (#344)
benesch Jun 11, 2020
5fde985
Switch object dep to crates.io
alexcrichton Jun 15, 2020
00052ca
Bump to 0.3.49
alexcrichton Jun 15, 2020
b0f8502
Bump miniz-oxide version (#354)
alexcrichton Jun 29, 2020
6f14bec
Update some dependency versions (#358)
alexcrichton Jul 7, 2020
2ad451a
Bump to 0.3.50
alexcrichton Jul 7, 2020
c3c297a
Prepare for this crate to go into libstd (#349)
alexcrichton Jul 13, 2020
8f89434
Fix warnings generated on Fuchsia
alexcrichton Jul 17, 2020
5965cf5
use noop backends on Miri (#360)
RalfJung Jul 20, 2020
5930de7
Support Linkle's DWARF implementation for target_env = "devkita64" (#…
leo60228 Jul 20, 2020
a6b1478
Invert mmap implementation #[cfg]
alexcrichton Jul 20, 2020
de58889
devkitA64 -> libnx (#362)
leo60228 Jul 21, 2020
4083a90
Don't use gimli symbolizer for UWP targets. (#363)
jdm Jul 22, 2020
7938ddc
Disable libbacktrace on libnx (#364)
leo60228 Jul 28, 2020
4b8f2be
Include source column numbers, where available (#367)
eggyal Jul 30, 2020
70ad093
Feature: module base address added to the Frame (#368)
dmitry-zakablukov Aug 3, 2020
37ec940
Delegate, don't duplicate (#369)
tamird Aug 6, 2020
520c6a0
Fixing dynamic symbol loading
plauche Aug 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 25 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ jobs:
# on stable yet
- thing: windows-msvc64
os: windows-latest
rust: nightly-x86_64-msvc
rust: stable-x86_64-msvc
- thing: windows-msvc32
os: windows-latest
rust: nightly-i686-msvc
rust: stable-i686-msvc
- thing: windows-gnu64
os: windows-latest
rust: nightly-x86_64-gnu
rust: stable-x86_64-gnu
- thing: windows-gnu32
os: windows-latest
rust: nightly-i686-gnu
rust: stable-i686-gnu
steps:
- uses: actions/checkout@v1
with:
Expand All @@ -59,28 +59,30 @@ jobs:
- run: cargo build
- run: cargo test
- run: cargo test --features "gimli-symbolize"
- run: cargo test --features "libbacktrace"
- run: cargo test --features "libbacktrace gimli-symbolize"
- run: cargo test --features "serialize-rustc"
- run: cargo test --features "serialize-serde"
- run: cargo test --features "verify-winapi"
- run: cargo test --features "cpp_demangle"
- run: cargo test --no-default-features
- run: cargo test --no-default-features --features "libbacktrace"
- run: cargo test --no-default-features --features "gimli-symbolize"
- run: cargo test --no-default-features --features "gimli-symbolize libbacktrace"
- run: cargo test --no-default-features --features "libbacktrace std"
- run: cargo test --no-default-features --features "gimli-symbolize std"
- run: cargo test --no-default-features --features "std"
- run: cargo test --no-default-features --features "libunwind std"
- run: cargo test --no-default-features --features "libunwind dladdr std"
- run: cargo test --no-default-features --features "libunwind libbacktrace std"
- run: cargo test --no-default-features --features "libunwind libbacktrace dbghelp std"
- run: cargo test --no-default-features --features "libunwind coresymbolication dbghelp std"
- run: cargo test --no-default-features --features "libunwind coresymbolication dbghelp std libbacktrace"
- run: cargo test --no-default-features --features "unix-backtrace std"
- run: cargo test --no-default-features --features "unix-backtrace dladdr std"
- run: cargo test --no-default-features --features "unix-backtrace libbacktrace std"
- run: cargo test --no-default-features --features "unix-backtrace coresymbolication std"
- run: cargo test --no-default-features --features "serialize-serde std"
- run: cargo test --no-default-features --features "serialize-rustc std"
- run: cargo test --no-default-features --features "serialize-rustc serialize-serde std"
- run: cargo test --no-default-features --features "cpp_demangle std"
- run: cargo test --no-default-features --features "dbghelp std"
- run: cargo test --no-default-features --features "dbghelp std verify-winapi"
- run: cargo test --manifest-path crates/cpp_smoke_test/Cargo.toml
- run: cargo test --manifest-path crates/macos_frames_test/Cargo.toml
- run: cargo test --features libbacktrace --manifest-path crates/without_debuginfo/Cargo.toml
- run: cargo test --features "libbacktrace coresymbolication" --manifest-path crates/without_debuginfo/Cargo.toml
- run: cargo test --features "libbacktrace gimli-symbolize" --manifest-path crates/without_debuginfo/Cargo.toml
- run: cargo test --features gimli-symbolize --manifest-path crates/without_debuginfo/Cargo.toml
- run: cargo test --manifest-path crates/line-tables-only/Cargo.toml --features libbacktrace
- run: cargo test --manifest-path crates/line-tables-only/Cargo.toml --features gimli-symbolize
- run: RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib-gabi" cargo test --features gimli-symbolize
if: contains(matrix.os, 'ubuntu')
- run: RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib-gnu" cargo test --features gimli-symbolize
if: contains(matrix.os, 'ubuntu')
- run: cargo build --manifest-path crates/as-if-std/Cargo.toml

windows_arm64:
name: Windows AArch64
Expand All @@ -103,19 +105,10 @@ jobs:
matrix:
target:
- aarch64-apple-ios
- armv7-apple-ios
- armv7s-apple-ios
- i386-apple-ios
- x86_64-apple-ios
include:
- target: aarch64-apple-ios
sdk: iphoneos
- target: armv7-apple-ios
sdk: iphoneos
- target: armv7s-apple-ios
sdk: iphoneos
- target: i386-apple-ios
sdk: iphonesimulator
- target: x86_64-apple-ios
sdk: iphonesimulator
steps:
Expand Down Expand Up @@ -197,5 +190,5 @@ jobs:
with:
submodules: true
- name: Install Rust
run: rustup update 1.32.0 && rustup default 1.32.0
run: rustup update 1.40.0 && rustup default 1.40.0
- run: cargo build
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "backtrace-sys/src/libbacktrace"]
path = crates/backtrace-sys/src/libbacktrace
url = https://github.com/rust-lang-nursery/libbacktrace
url = https://github.com/rust-lang/libbacktrace
118 changes: 47 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "backtrace"
version = "0.3.43"
version = "0.3.50"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
Expand All @@ -15,89 +15,62 @@ autotests = true
edition = "2018"

[workspace]
members = ['crates/cpp_smoke_test']
exclude = ['crates/without_debuginfo']
members = ['crates/cpp_smoke_test', 'crates/as-if-std']
exclude = ['crates/without_debuginfo', 'crates/macos_frames_test', 'crates/line-tables-only']

[dependencies]
cfg-if = "0.1.10"
rustc-demangle = "0.1.4"
backtrace-sys = { path = "crates/backtrace-sys", version = "0.1.32", optional = true }
backtrace-sys = { path = "crates/backtrace-sys", version = "0.1.35", optional = true, default_features = false }
libc = { version = "0.2.45", default-features = false }
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
compiler_builtins = { version = '0.1.2', optional = true }

# Optionally enable the ability to serialize a `Backtrace`
# Optionally enable the ability to serialize a `Backtrace`, controlled through
# the `serialize-*` features below.
serde = { version = "1.0", optional = true, features = ['derive'] }
rustc-serialize = { version = "0.3", optional = true }

# Optionally demangle C++ frames' symbols in backtraces.
cpp_demangle = { default-features = false, version = "0.2.3", optional = true }
cpp_demangle = { default-features = false, version = "0.3.0", optional = true }

# Optional dependencies enabled through the `gimli-symbolize` feature
addr2line = { version = "0.11.0", optional = true, default-features = false, features = ['std'] }
findshlibs = { version = "0.5.0", optional = true }
memmap = { version = "0.7.0", optional = true }
goblin = { version = "0.1.3", optional = true, default-features = false, features = ['elf32', 'elf64', 'mach32', 'mach64', 'pe32', 'pe64', 'std'] }

# Optional dependencies enabled through the `gimli-symbolize` feature, do not
# use these features directly.
addr2line = { version = "0.13.0", optional = true, default-features = false }
miniz_oxide = { version = "0.4.0", optional = true, default-features = false }
[dependencies.object]
version = "0.20.0"
optional = true
default-features = false
features = ['read_core', 'elf', 'macho', 'pe', 'unaligned']

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.3", optional = true }

# Each feature controls the two phases of finding a backtrace: getting a
# backtrace and then resolving instruction pointers to symbols. The default
# feature enables all the necessary features for each platform this library
# supports, but it can be disabled to have finer grained control over the
# dependencies.
#
# Note that not all features are available on all platforms, so even though a
# feature is enabled some other feature may be used instead.
[dev-dependencies]
dylib-dep = { path = "crates/dylib-dep" }
libloading = "0.6"

[features]
default = ["std", "libunwind", "libbacktrace", "dladdr", "dbghelp"]
# By default libstd support and gimli-symbolize is used to symbolize addresses.
default = ["std", "gimli-symbolize"]

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

#=======================================
# Methods of acquiring a backtrace
#
# - libunwind: when using this the libgcc library is linked against to get
# the unwinding support. This is generally the most reliable method to get
# a backtrace on unix.
# - unix-backtrace: this uses the backtrace(3) function to acquire a
# backtrace, but is not as reliable as libunwind. It is, however,
# generally found in more locations.
# - dbghelp: on windows this enables usage of dbghelp.dll to find a
# backtrace at runtime
# - kernel32: on windows this enables using RtlCaptureStackBackTrace as the
# function to acquire a backtrace
libunwind = []
unix-backtrace = []
dbghelp = []
kernel32 = []

#=======================================
# Methods of resolving symbols
#
# - libbacktrace: this feature activates the `backtrace-sys` dependency,
# building the libbacktrace library found in gcc repos. This library
# parses the DWARF info of ELF executables to find symbol names, and it
# can also provide filename/line number information if debuginfo is
# compiled in. This library currently only primarily works on unixes that
# are not OSX, however.
# - dladdr: this feature uses the dladdr(3) function (a glibc extension) to
# resolve symbol names. This is fairly unreliable on linux, but works well
# enough on OSX.
# - coresymbolication: this feature uses the undocumented core symbolication
# framework on OS X to symbolize. Note that this is not turned on default due
# to various issues, you can see more in #202.
# - gimli-symbolize: use the `gimli-rs/addr2line` crate to symbolicate
# addresses into file, line, and name using DWARF debug information. At
# the moment, this is only possible when targetting Linux, since macOS
# splits DWARF out into a separate object file. Enabling this feature
# means one less C dependency.
libbacktrace = ["backtrace-sys"]
dladdr = []
coresymbolication = []
gimli-symbolize = ["addr2line", "findshlibs", "memmap", "goblin"]
# addresses into file, line, and name using DWARF debug information.
# - libbacktrace: this feature activates the `backtrace-sys` dependency,
# building the libbacktrace library found in gcc repos.
#
# Note that MSVC unconditionally uses the dbghelp library to symbolize and won't
# be affected by feature selection here. Also note that it's highly unlikely you
# want to configure this. If you're having trouble getting backtraces it's
# likely best to open an issue.
gimli-symbolize = ["addr2line", "miniz_oxide", "object"]
libbacktrace = ["backtrace-sys/backtrace-sys"]

#=======================================
# Methods of serialization
Expand All @@ -107,25 +80,28 @@ serialize-rustc = ["rustc-serialize"]
serialize-serde = ["serde"]

#=======================================
# Internal features for testing and such.
# Deprecated/internal features
#
# Only here for backwards compatibility purposes or for internal testing
# purposes. New code should use none of these features.
coresymbolication = []
dladdr = []
kernel32 = []
unix-backtrace = []
libunwind = []
dbghelp = []
verify-winapi = [
'winapi/dbghelp',
'winapi/handleapi',
'winapi/libloaderapi',
'winapi/memoryapi',
'winapi/minwindef',
'winapi/processthreadsapi',
'winapi/synchapi',
'winapi/tlhelp32',
'winapi/winbase',
'winapi/winnt',
]
rustc-dep-of-std = [
'backtrace-sys/rustc-dep-of-std',
'cfg-if/rustc-dep-of-std',
'core',
'compiler_builtins',
'libc/rustc-dep-of-std',
'rustc-demangle/rustc-dep-of-std',
]

[[example]]
name = "backtrace"
Expand All @@ -150,7 +126,7 @@ edition = '2018'

[[test]]
name = "accuracy"
required-features = ["std", "dbghelp", "libbacktrace", "libunwind"]
required-features = ["std", "gimli-symbolize"]
edition = '2018'

[[test]]
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ backtrace like libstd's panics.
backtrace = "0.3"
```

Note that this crate requires `cc` and `ar` to be present on Unix systems when
`libbacktrace` is used (which is the default). For configuring C compilers see
the [`cc` crate documentation](https://github.com/alexcrichton/cc-rs).

## Usage

To simply capture a backtrace and defer dealing with it until a later time,
you can use the top-level `Backtrace` type.

```rust
extern crate backtrace;

use backtrace::Backtrace;

fn main() {
Expand All @@ -41,8 +35,6 @@ If, however, you'd like more raw access to the actual tracing functionality, you
can use the `trace` and `resolve` functions directly.

```rust
extern crate backtrace;

fn main() {
backtrace::trace(|frame| {
let ip = frame.ip();
Expand Down
2 changes: 0 additions & 2 deletions benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

extern crate test;

extern crate backtrace;

#[cfg(feature = "std")]
use backtrace::Backtrace;

Expand Down
2 changes: 1 addition & 1 deletion ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
Expand Down
25 changes: 3 additions & 22 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
Expand All @@ -11,27 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

COPY android-ndk.sh /
RUN /android-ndk.sh arm
WORKDIR /android
COPY android-sdk.sh /android/sdk.sh
RUN ./sdk.sh arm
RUN mv /root/.android /tmp
RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
ENV PATH=$PATH:/android-toolchain/bin:/android/sdk/platform-tools
ENV PATH=$PATH:/android-toolchain/bin

# TODO: run tests in an emulator eventually
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
ENTRYPOINT [ \
"bash", \
"-c", \
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
"SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \
/rust/bin/rustc /tmp/runtest.rs -o /tmp/runtest && \
exec \"$@\"", \
"--" \
]
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=echo
2 changes: 1 addition & 1 deletion ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/armv7-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/i586-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-multilib \
libc6-dev \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
Expand Down
Loading