summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-21 21:37:41 +0000
committerbors <bors@rust-lang.org>2019-05-21 21:37:41 +0000
commit119bbc2056a60e8557d1e5f2e0a7ab46d479bcaf (patch)
tree59737667ef16e61733916da74e5fd01f13d56b03 /src/librustc_codegen_llvm
parent50a0defd5a93523067ef239936cc2e0755220904 (diff)
parent46e3d04b2baab130be52dc2b3a26085b3582f8ba (diff)
downloadrust-119bbc2056a60e8557d1e5f2e0a7ab46d479bcaf.tar.gz
rust-119bbc2056a60e8557d1e5f2e0a7ab46d479bcaf.zip
Auto merge of #61007 - michaelwoerister:limited-debuginfo, r=alexcrichton
debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1

https://github.com/rust-lang/rust/commit/cff075009 made LLVM emit less debuginfo when compiling with "line-tables-only". The change was essentially correct but the reduced amount of debuginfo broke
a number of tools.

This commit reverts the change so we get back the old behavior, until we figure out how to do this properly and give external tools to adapt to the new format.

See https://github.com/rust-lang/rust/issues/60020 for more info.

r? @cuviper
cc @jrmuizel & @froydnj
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/metadata.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 9bdce37b8ba..13590faa123 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -31,7 +31,7 @@ use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
 use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf,
                         PrimitiveExt, Size, TyLayout, VariantIdx};
 use rustc::ty::subst::UnpackedKind;
-use rustc::session::config;
+use rustc::session::config::{self, DebugInfo};
 use rustc::util::nodemap::FxHashMap;
 use rustc_fs_util::path_to_c_string;
 use rustc_data_structures::small_c_str::SmallCStr;
@@ -925,7 +925,26 @@ pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>,
     let producer = CString::new(producer).unwrap();
     let flags = "\0";
     let split_name = "\0";
-    let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
+
+    // FIXME(#60020):
+    //
+    //    This should actually be
+    //
+    //    ```
+    //      let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
+    //    ```
+    //
+    //    that is, we should set LLVM's emission kind to `LineTablesOnly` if
+    //    we are compiling with "limited" debuginfo. However, some of the
+    //    existing tools relied on slightly more debuginfo being generated than
+    //    would be the case with `LineTablesOnly`, and we did not want to break
+    //    these tools in a "drive-by fix", without a good idea or plan about
+    //    what limited debuginfo should exactly look like. So for now we keep
+    //    the emission kind as `FullDebug`.
+    //
+    //    See https://github.com/rust-lang/rust/issues/60020 for details.
+    let kind = DebugEmissionKind::FullDebug;
+    assert!(tcx.sess.opts.debuginfo != DebugInfo::None);
 
     unsafe {
         let file_metadata = llvm::LLVMRustDIBuilderCreateFile(