Preserve, clarify, and extend debug information
`-Cdebuginfo=1` was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for line tables only was added. Additionally an option for line info directives only was added, which is well needed for some targets. The debug info options should now behave the same as clang's debug info options.
This commit is contained in:
@@ -830,24 +830,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
|
||||
}
|
||||
.unwrap_or_default();
|
||||
let split_name = split_name.to_str().unwrap();
|
||||
|
||||
// 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);
|
||||
let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
|
||||
|
||||
unsafe {
|
||||
let compile_unit_file = llvm::LLVMRustDIBuilderCreateFile(
|
||||
|
||||
@@ -402,7 +402,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
cx: &CodegenCx<'ll, 'tcx>,
|
||||
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
) -> &'ll DIArray {
|
||||
if cx.sess().opts.debuginfo == DebugInfo::Limited {
|
||||
if cx.sess().opts.debuginfo != DebugInfo::Full {
|
||||
return create_DIArray(DIB(cx), &[]);
|
||||
}
|
||||
|
||||
|
||||
@@ -946,6 +946,7 @@ pub mod debuginfo {
|
||||
NoDebug,
|
||||
FullDebug,
|
||||
LineTablesOnly,
|
||||
DebugDirectivesOnly,
|
||||
}
|
||||
|
||||
impl DebugEmissionKind {
|
||||
@@ -953,8 +954,9 @@ pub mod debuginfo {
|
||||
use rustc_session::config::DebugInfo;
|
||||
match kind {
|
||||
DebugInfo::None => DebugEmissionKind::NoDebug,
|
||||
DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
|
||||
DebugInfo::Full => DebugEmissionKind::FullDebug,
|
||||
DebugInfo::LineDirectivesOnly => DebugEmissionKind::DebugDirectivesOnly,
|
||||
DebugInfo::LineTablesOnly => DebugEmissionKind::LineTablesOnly,
|
||||
DebugInfo::Limited | DebugInfo::Full => DebugEmissionKind::FullDebug,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user