Change:
the following code to : : When is a struct, etc., this makes debugging extraordinarily difficult and laborious. I'm implementing the gdb debugger interface specified in , which requires a single symbol, to be present in the array. (The symbol is actually not exported either, roughly GLOBAL and in the array, which I get around by using a flag to the linker.) I don't get around the lack of debug symbols at all, which vexes me.
This is issue . Note that gdb supports a second, improved interface to detecting shared library events. I don't remember exactly when this went in but here's one of the series; if you're interested this should help find the final patches: There's a Rust crate for making stap-style probes.
I'm going to close in favor of . Thanks for the issue, though.
I believe that we should re-open this issue in light of
Doesn't already cover the problem listed here? Or is it different? If it's different I'm happy to reopen.
I think that this is actually an extra bug, in that the seems to be ignored and it is given , whereas it shouldn't receive any at all. Even if is fixed, I believe this issue will persist, because it would still be given a mangled which will reference a symbol that won't ever exist, since the name isn't mangled in the symbol table, and hence it shouldn't be given one at all. Does that make sense?
To illustrate, here is the rust static version: and the C++ unmangled static: Iiuc, everything is perfectly correct, except we just have to not emit the in cases.
I believe that a "principled" fix for would also automatically solve this issue. There's already code in the compiler that computes the real symbol name of all the functions and statics we emit. Using that code for the DWARF linkagename would give the right linkagename to all symbols, nomangle ones included. That would set a linkagename identical to the DWARF name, which would differ from C++, but I can't imagine that would cause harm?
It should be fine, but in cases where the two are equal, it is fine to omit the linkage name, and this uses less space. This is what C compilers do.
Regardless, that's just a small . The important part is unifying the symbol/linkage name computation.
Visited during the wg-debugging triage meeting and this seems to have been resolved. is going to add a regression test.

Discussion:
<ins> // compile-flags:-g // min-gdb-version: 10.1 // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:p TEST // gdb-check:$1 = 3735928559 // gdb-command:p no_mangle_info::namespace::OTHER_TEST // gdb-check:$2 = 42 // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:p TEST // lldb-check: (unsigned long) $0 = 3735928559 // lldb-command:p OTHER_TEST // lldb-check: (unsigned long) $1 = 42 // === CDB TESTS ================================================================================== // cdb-command: g // Note: LLDB and GDB allow referring to items that are in the same namespace of the symbol // we currently have a breakpoint on in an unqualified way. CDB does not, and thus we need to // refer to it in a fully qualified way. // cdb-command: dx a!no_mangle_info::TEST // cdb-check: a!no_mangle_info::TEST : 0xdeadbeef [Type: unsigned __int64] // cdb-command: dx a!no_mangle_info::namespace::OTHER_TEST // cdb-check: a!no_mangle_info::namespace::OTHER_TEST : 0x2a [Type: unsigned __int64] #[no_mangle] pub static TEST: u64 = 0xdeadbeef; // FIXME(rylev, wesleywiser): uncommenting this item breaks the test, and we're not sure why // pub static OTHER_TEST: u64 = 43; pub mod namespace { pub static OTHER_TEST: u64 = 42; } pub fn main() { println!("TEST: {}", TEST); println!("OTHER TEST: {}", namespace::OTHER_TEST); // #break } </ins>