Skip to content

Commit 01104b5

Browse files
authored
Rollup merge of #82218 - rylev:copy-pdbs, r=Mark-Simulacrum
Make sure pdbs are copied along with exe and dlls when bootstrapping This makes it easier to find the pdbs when wanting to debug the compiler on Windows.
2 parents b3d3251 + 2a66685 commit 01104b5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/bootstrap/compile.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::config::TargetSelection;
2727
use crate::dist;
2828
use crate::native;
2929
use crate::tool::SourceType;
30-
use crate::util::{exe, is_dylib, symlink_dir};
30+
use crate::util::{exe, is_debug_info, is_dylib, symlink_dir};
3131
use crate::{Compiler, DependencyType, GitRepo, Mode};
3232

3333
#[derive(Debug, PartialOrd, Ord, Copy, Clone, PartialEq, Eq, Hash)]
@@ -1049,7 +1049,8 @@ impl Step for Assemble {
10491049
let src_libdir = builder.sysroot_libdir(build_compiler, host);
10501050
for f in builder.read_dir(&src_libdir) {
10511051
let filename = f.file_name().into_string().unwrap();
1052-
if is_dylib(&filename) && !proc_macros.contains(&filename) {
1052+
if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename)
1053+
{
10531054
builder.copy(&f.path(), &rustc_libdir.join(&filename));
10541055
}
10551056
}
@@ -1166,6 +1167,7 @@ pub fn run_cargo(
11661167
if !(filename.ends_with(".rlib")
11671168
|| filename.ends_with(".lib")
11681169
|| filename.ends_with(".a")
1170+
|| is_debug_info(&filename)
11691171
|| is_dylib(&filename)
11701172
|| (is_check && filename.ends_with(".rmeta")))
11711173
{

src/bootstrap/util.rs

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ pub fn is_dylib(name: &str) -> bool {
3232
name.ends_with(".dylib") || name.ends_with(".so") || name.ends_with(".dll")
3333
}
3434

35+
/// Returns `true` if the file name given looks like a debug info file
36+
pub fn is_debug_info(name: &str) -> bool {
37+
// FIXME: consider split debug info on other platforms (e.g., Linux, macOS)
38+
name.ends_with(".pdb")
39+
}
40+
3541
/// Returns the corresponding relative library directory that the compiler's
3642
/// dylibs will be found in.
3743
pub fn libdir(target: TargetSelection) -> &'static str {

0 commit comments

Comments
 (0)