Skip to content

Commit 790c238

Browse files
committed
rewrite pdb-alt-path to rmake
1 parent 5ced3da commit 790c238

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ run-make/pass-linker-flags-flavor/Makefile
131131
run-make/pass-linker-flags-from-dep/Makefile
132132
run-make/pass-linker-flags/Makefile
133133
run-make/pass-non-c-like-enum-to-c/Makefile
134-
run-make/pdb-alt-path/Makefile
135134
run-make/pdb-buildinfo-cl-cmd/Makefile
136135
run-make/pgo-gen-lto/Makefile
137136
run-make/pgo-gen-no-imp-symbols/Makefile

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

-20
This file was deleted.

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

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// The information inside a .exe file contains a string of the PDB file name.
2+
// This could be a security concern if the full path was exposed, as it could
3+
// reveal information about the filesystem where the bin was first compiled.
4+
// This should only be overridden by `-Clink-arg=/PDBALTPATH:...` - this test
5+
// checks that no full file paths are exposed and that the override flag is respected.
6+
// See https://github.com/rust-lang/rust/pull/121297
7+
8+
//@ only-windows-msvc
9+
10+
fn main() {
11+
// Test that we don't have the full path to the PDB file in the binary
12+
rustc()
13+
.input("main.rs")
14+
.arg("-g")
15+
.crate_name("my_crate_name")
16+
.crate_type("bin")
17+
.arg("-Cforce-frame-pointers")
18+
.run();
19+
invalid_utf8_contains(bin_name("my_crate_name"), "my_crate_name.pdb");
20+
invalid_utf8_not_contains(bin_name("my_crate_name"), r#"\my_crate_name.pdb"#);
21+
// Test that backtraces still can find debuginfo by checking that they contain symbol names and
22+
// source locations.
23+
let out = run(bin_name(my_crate_name));
24+
out.assert_stdout_contains("my_crate_name::fn_in_backtrace");
25+
out.assert_stdout_contains("main.rs:15");
26+
// Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
27+
rustc()
28+
.input("main.rs")
29+
.arg("-g")
30+
.crate_name("my_crate_name")
31+
.crate_type("bin")
32+
.link_arg("/PDBALTPATH:abcdefg.pdb")
33+
.arg("-Cforce-frame-pointers")
34+
.run();
35+
invalid_utf8_contains(bin_name("my_crate_name"), "abcdefg.pdb");
36+
invalid_utf8_not_contains(bin_name("my_crate_name"), "my_crate_name.pdb");
37+
}

0 commit comments

Comments
 (0)