Skip to content

Commit 0a094ba

Browse files
Make pdb-alt-path test more unwind-friendly for i686-pc-windows-msvc
1 parent e1c3a5a commit 0a094ba

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

tests/run-make/pdb-alt-path/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ all:
1010

1111
# Test that backtraces still can find debuginfo by checking that they contain symbol names and
1212
# source locations.
13-
RUST_BACKTRACE="full" $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt || exit 0
14-
$(CGREP) "my_crate_name::main" < $(TMPDIR)/backtrace.txt
15-
$(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt
13+
$(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt
14+
$(CGREP) "my_crate_name::fn_in_backtrace" < $(TMPDIR)/backtrace.txt
15+
$(CGREP) "main.rs:15" < $(TMPDIR)/backtrace.txt
1616

1717
# Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
1818
$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers

tests/run-make/pdb-alt-path/main.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
// The various #[inline(never)] annotations and std::hint::black_box calls are
2+
// an attempt to make unwinding as non-flaky as possible on i686-pc-windows-msvc.
3+
4+
#[inline(never)]
5+
fn generate_backtrace(x: &u32) {
6+
std::hint::black_box(x);
7+
let bt = std::backtrace::Backtrace::force_capture();
8+
println!("{}", bt);
9+
std::hint::black_box(x);
10+
}
11+
12+
#[inline(never)]
13+
fn fn_in_backtrace(x: &u32) {
14+
std::hint::black_box(x);
15+
generate_backtrace(x);
16+
std::hint::black_box(x);
17+
}
18+
119
fn main() {
2-
panic!("backtrace please");
20+
let x = &41;
21+
std::hint::black_box(x);
22+
fn_in_backtrace(x);
23+
std::hint::black_box(x);
324
}

0 commit comments

Comments
 (0)