Skip to content

Commit 0f7946f

Browse files
committed
Add a test that without debuginfo symbols still resolve
Almost all platforms should still have some degree of symbolication without debug symbols being present (aka the dynamic symbol table and such), so add a test asserting that symbols do indeed come out in these scenarios. This test will likely need to be blacklisted for platforms over time, but that's ok.
1 parent f15a3e9 commit 0f7946f

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

ci/azure-test-all.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ steps:
33
submodules: true
44
- template: azure-install-rust.yml
55

6-
- bash: cargo build --manifest-path backtrace-sys/Cargo.toml
6+
- bash: cargo build --manifest-path crates/backtrace-sys/Cargo.toml
77
displayName: "Build backtrace-sys"
88
- bash: cargo build
99
displayName: "Build backtrace"

crates/without_debuginfo/Cargo.toml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "without_debuginfo"
3+
version = "0.1.0"
4+
authors = ["Alex Crichton <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
backtrace = { path = "../.." }
9+
10+
[profile.dev]
11+
debug = false
12+
13+
[profile.test]
14+
debug = false

crates/without_debuginfo/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// intentionally blank
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[test]
2+
fn all_frames_have_symbols() {
3+
println!("{:?}", backtrace::Backtrace::new());
4+
5+
let mut all_have_symbols = true;
6+
backtrace::trace(|frame| {
7+
let mut any = false;
8+
backtrace::resolve_frame(frame, |sym| {
9+
if sym.name().is_some() {
10+
any = true;
11+
}
12+
});
13+
if !any && !frame.ip().is_null() {
14+
all_have_symbols = false;
15+
}
16+
true
17+
});
18+
assert!(all_have_symbols);
19+
}

0 commit comments

Comments
 (0)