about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/run-make/pdb-alt-path/Makefile6
-rw-r--r--tests/run-make/pdb-alt-path/main.rs23
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/run-make/pdb-alt-path/Makefile b/tests/run-make/pdb-alt-path/Makefile
index 5795dae97c2..7a0ae3bf2ef 100644
--- a/tests/run-make/pdb-alt-path/Makefile
+++ b/tests/run-make/pdb-alt-path/Makefile
@@ -10,9 +10,9 @@ all:
 
 	# Test that backtraces still can find debuginfo by checking that they contain symbol names and
 	# source locations.
-	RUST_BACKTRACE="full" $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt || exit 0
-	$(CGREP) "my_crate_name::main" < $(TMPDIR)/backtrace.txt
-	$(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt
+	$(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt
+	$(CGREP) "my_crate_name::fn_in_backtrace" < $(TMPDIR)/backtrace.txt
+	$(CGREP) "main.rs:15" < $(TMPDIR)/backtrace.txt
 
 	# Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
 	$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb -Cforce-frame-pointers
diff --git a/tests/run-make/pdb-alt-path/main.rs b/tests/run-make/pdb-alt-path/main.rs
index e95109fd08a..d38d540fbc2 100644
--- a/tests/run-make/pdb-alt-path/main.rs
+++ b/tests/run-make/pdb-alt-path/main.rs
@@ -1,3 +1,24 @@
+// The various #[inline(never)] annotations and std::hint::black_box calls are
+// an attempt to make unwinding as non-flaky as possible on i686-pc-windows-msvc.
+
+#[inline(never)]
+fn generate_backtrace(x: &u32) {
+    std::hint::black_box(x);
+    let bt = std::backtrace::Backtrace::force_capture();
+    println!("{}", bt);
+    std::hint::black_box(x);
+}
+
+#[inline(never)]
+fn fn_in_backtrace(x: &u32) {
+    std::hint::black_box(x);
+    generate_backtrace(x);
+    std::hint::black_box(x);
+}
+
 fn main() {
-    panic!("backtrace please");
+    let x = &41;
+    std::hint::black_box(x);
+    fn_in_backtrace(x);
+    std::hint::black_box(x);
 }