about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-18 16:57:38 +0100
committerGitHub <noreply@github.com>2021-02-18 16:57:38 +0100
commit01104b5c29fde36b7b55c8ba83c08c4dd97c4484 (patch)
treecea0ec1e93e31c111455709636c76747d0cd7414 /src
parentb3d325127143296de07269da7940a411526df022 (diff)
parent2a66685ebfdcd58a3c3fff0caeff6b13774543f5 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/compile.rs6
-rw-r--r--src/bootstrap/util.rs6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index dee0c154201..7d5e3d05b11 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -27,7 +27,7 @@ use crate::config::TargetSelection;
 use crate::dist;
 use crate::native;
 use crate::tool::SourceType;
-use crate::util::{exe, is_dylib, symlink_dir};
+use crate::util::{exe, is_debug_info, is_dylib, symlink_dir};
 use crate::{Compiler, DependencyType, GitRepo, Mode};
 
 #[derive(Debug, PartialOrd, Ord, Copy, Clone, PartialEq, Eq, Hash)]
@@ -1049,7 +1049,8 @@ impl Step for Assemble {
         let src_libdir = builder.sysroot_libdir(build_compiler, host);
         for f in builder.read_dir(&src_libdir) {
             let filename = f.file_name().into_string().unwrap();
-            if is_dylib(&filename) && !proc_macros.contains(&filename) {
+            if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename)
+            {
                 builder.copy(&f.path(), &rustc_libdir.join(&filename));
             }
         }
@@ -1166,6 +1167,7 @@ pub fn run_cargo(
             if !(filename.ends_with(".rlib")
                 || filename.ends_with(".lib")
                 || filename.ends_with(".a")
+                || is_debug_info(&filename)
                 || is_dylib(&filename)
                 || (is_check && filename.ends_with(".rmeta")))
             {
diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs
index b35d1b99fa5..b4421a82714 100644
--- a/src/bootstrap/util.rs
+++ b/src/bootstrap/util.rs
@@ -32,6 +32,12 @@ pub fn is_dylib(name: &str) -> bool {
     name.ends_with(".dylib") || name.ends_with(".so") || name.ends_with(".dll")
 }
 
+/// Returns `true` if the file name given looks like a debug info file
+pub fn is_debug_info(name: &str) -> bool {
+    // FIXME: consider split debug info on other platforms (e.g., Linux, macOS)
+    name.ends_with(".pdb")
+}
+
 /// Returns the corresponding relative library directory that the compiler's
 /// dylibs will be found in.
 pub fn libdir(target: TargetSelection) -> &'static str {