Skip to content

Commit 119bbc2

Browse files
committed
Auto merge of rust-lang#61007 - michaelwoerister:limited-debuginfo, r=alexcrichton
debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1 rust-lang@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 rust-lang#60020 for more info. r? @cuviper cc @jrmuizel & @froydnj
2 parents 50a0def + 46e3d04 commit 119bbc2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/librustc_codegen_llvm/debuginfo/metadata.rs

+21-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
3131
use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf,
3232
PrimitiveExt, Size, TyLayout, VariantIdx};
3333
use rustc::ty::subst::UnpackedKind;
34-
use rustc::session::config;
34+
use rustc::session::config::{self, DebugInfo};
3535
use rustc::util::nodemap::FxHashMap;
3636
use rustc_fs_util::path_to_c_string;
3737
use rustc_data_structures::small_c_str::SmallCStr;
@@ -925,7 +925,26 @@ pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>,
925925
let producer = CString::new(producer).unwrap();
926926
let flags = "\0";
927927
let split_name = "\0";
928-
let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
928+
929+
// FIXME(#60020):
930+
//
931+
// This should actually be
932+
//
933+
// ```
934+
// let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
935+
// ```
936+
//
937+
// that is, we should set LLVM's emission kind to `LineTablesOnly` if
938+
// we are compiling with "limited" debuginfo. However, some of the
939+
// existing tools relied on slightly more debuginfo being generated than
940+
// would be the case with `LineTablesOnly`, and we did not want to break
941+
// these tools in a "drive-by fix", without a good idea or plan about
942+
// what limited debuginfo should exactly look like. So for now we keep
943+
// the emission kind as `FullDebug`.
944+
//
945+
// See https://github.com/rust-lang/rust/issues/60020 for details.
946+
let kind = DebugEmissionKind::FullDebug;
947+
assert!(tcx.sess.opts.debuginfo != DebugInfo::None);
929948

930949
unsafe {
931950
let file_metadata = llvm::LLVMRustDIBuilderCreateFile(

0 commit comments

Comments
 (0)