diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml index a95a03a3f..804728a52 100644 --- a/ci/azure-test-all.yml +++ b/ci/azure-test-all.yml @@ -41,5 +41,7 @@ steps: displayName: "Test backtrace (-default + dbghelp + std + verify-winapi)" - bash: cd ./crates/cpp_smoke_test && cargo test displayName: "Test cpp_smoke_test" - - bash: cd ./crates/without_debuginfo && cargo test - displayName: "Test without debuginfo" + - bash: cd ./crates/without_debuginfo && cargo test --features libbacktrace + displayName: "Test without debuginfo (libbacktrace)" + - bash: cd ./crates/without_debuginfo && cargo test --features 'libbacktrace coresymbolication' + displayName: "Test without debuginfo (coresymbolication)" diff --git a/crates/without_debuginfo/Cargo.toml b/crates/without_debuginfo/Cargo.toml new file mode 100644 index 000000000..b38afbacb --- /dev/null +++ b/crates/without_debuginfo/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "without_debuginfo" +version = "0.1.0" +authors = ["Alex Crichton "] +edition = "2018" + +[dependencies.backtrace] +path = "../.." +default-features = false +features = [ + # make sure a trace can be acquired + 'libunwind', + 'dbghelp', + + # Allow fallback to dladdr + 'dladdr', + + # Yes, we have `std` + 'std', +] + +[profile.dev] +debug = false + +[profile.test] +debug = false + +[features] +libbacktrace = ['backtrace/libbacktrace'] +coresymbolication = ['backtrace/coresymbolication'] diff --git a/crates/without_debuginfo/src/lib.rs b/crates/without_debuginfo/src/lib.rs new file mode 100644 index 000000000..65e2cc340 --- /dev/null +++ b/crates/without_debuginfo/src/lib.rs @@ -0,0 +1 @@ +// intentionally blank diff --git a/crates/without_debuginfo/tests/smoke.rs b/crates/without_debuginfo/tests/smoke.rs new file mode 100644 index 000000000..85be656c2 --- /dev/null +++ b/crates/without_debuginfo/tests/smoke.rs @@ -0,0 +1,19 @@ +#[test] +fn all_frames_have_symbols() { + println!("{:?}", backtrace::Backtrace::new()); + + let mut all_have_symbols = true; + backtrace::trace(|frame| { + let mut any = false; + backtrace::resolve_frame(frame, |sym| { + if sym.name().is_some() { + any = true; + } + }); + if !any && !frame.ip().is_null() { + all_have_symbols = false; + } + true + }); + assert!(all_have_symbols); +}