Code change:
As of the 2021-09-23 nightly, rustc has stopped producing debug output for variables in a specific combination of circumstances: The variable is It is defined in a lib crate. The lib crate is included in a bin crate. The bin crate is built with . We noticed this after bumping past 09-23 to the 2021-10-27 nightly, when our debugger broke. The static is still being included in the ELF output (both allocated space, and represented correctly in the symtab), but is missing from DWARF. Bisecting indicates 2021-09-23 as the culprit (09-22 works). Here is a repro case that I've reduced that works on linux x86-64, at least, and probably other DWARF platforms. modify labels: +regression-from-stable-to-nightly -regression-untriaged
Bumping to regression-stable-to-beta, because 2021-09-23 is a 1.57 nightly. But would be good to confirm this reproduces on beta.
points at (). That being a rollup, looks the most relevant.
Assigning priority as discussed in the of the Prioritization Working Group. label -I-prioritize +P-high
I think this may be a duplicate of . Please test on a current nightly, and when goes out it should have the backport via . It's still possible that introduced its own problem, but maybe it just exacerbated the LLVM issue.
It looks to me like the problem still reoccurs on the current nightly: <details<summaryFor completeness, here is a transcript showing the behavior that is expected, from nightly-2021-09-22</summary</details
This appears to still be reproducing as of ; we're stuck on because basically anything newer breaks our debugger.
So, after working out how to build a toolchain that includes our cross target and rust-lld and whatnot locally, I've tested today's mainline with a revert for PR , commit -- which had previously identified as the likely culprit. I can confirm that DWARF output for our statics on thumbv7em and kin is restored after that commit is reverted. Shall I prepare a PR?

Related discussion:
text: <ins> // Caveat - gdb doesn't know about UTF-32 character encoding and will print a // rust char as only its numerical value. // min-lldb-version: 310 // min-gdb-version: 8.0 // no-prefer-dynamic // compile-flags:-g -C lto // gdb-command:run // gdbg-command:print 'basic_types_globals::B' // gdbr-command:print B // gdb-check:$1 = false // gdbg-command:print 'basic_types_globals::I' // gdbr-command:print I // gdb-check:$2 = -1 // gdbg-command:print 'basic_types_globals::C' // gdbr-command:print C // gdbg-check:$3 = 97 // gdbr-check:$3 = 97 // gdbg-command:print/d 'basic_types_globals::I8' // gdbr-command:print I8 // gdb-check:$4 = 68 // gdbg-command:print 'basic_types_globals::I16' // gdbr-command:print I16 // gdb-check:$5 = -16 // gdbg-command:print 'basic_types_globals::I32' // gdbr-command:print I32 // gdb-check:$6 = -32 // gdbg-command:print 'basic_types_globals::I64' // gdbr-command:print I64 // gdb-check:$7 = -64 // gdbg-command:print 'basic_types_globals::U' // gdbr-command:print U // gdb-check:$8 = 1 // gdbg-command:print/d 'basic_types_globals::U8' // gdbr-command:print U8 // gdb-check:$9 = 100 // gdbg-command:print 'basic_types_globals::U16' // gdbr-command:print U16 // gdb-check:$10 = 16 // gdbg-command:print 'basic_types_globals::U32' // gdbr-command:print U32 // gdb-check:$11 = 32 // gdbg-command:print 'basic_types_globals::U64' // gdbr-command:print U64 // gdb-check:$12 = 64 // gdbg-command:print 'basic_types_globals::F32' // gdbr-command:print F32 // gdb-check:$13 = 2.5 // gdbg-command:print 'basic_types_globals::F64' // gdbr-command:print F64 // gdb-check:$14 = 3.5 // gdb-command:continue #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] // N.B. These are `mut` only so they don't constant fold away. static mut B: bool = false; static mut I: isize = -1; static mut C: char = 'a'; static mut I8: i8 = 68; static mut I16: i16 = -16; static mut I32: i32 = -32; static mut I64: i64 = -64; static mut U: usize = 1; static mut U8: u8 = 100; static mut U16: u16 = 16; static mut U32: u32 = 32; static mut U64: u64 = 64; static mut F32: f32 = 2.5; static mut F64: f64 = 3.5; fn main() { _zzz(); // #break let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) }; } fn _zzz() {()} </ins>