Skip to content

Commit

Permalink
Auto merge of #61007 - michaelwoerister:limited-debuginfo, r=alexcric…
Browse files Browse the repository at this point in the history
…hton

debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1

rust-lang/rust@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/rust#60020 for more info.

r? @cuviper
cc @jrmuizel & @froydnj
  • Loading branch information
bors committed May 21, 2019
2 parents 50a0def + 46e3d04 commit 119bbc2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 119bbc2

Please sign in to comment.