-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Repro
-
cargo new --bin static
-
cd static
-
add the following code to
main.rs
:#[no_mangle] pub static TEST: u64 = 0xdeadbeef; pub fn main() { println!("TEST: {}", TEST); }
-
cargo build
-
gdb target/debug/static
-
break static::main
-
r
-
whatis TEST
-
output:
type = <data variable, no debug info>
-
frown
When TEST
is a repr(C)
struct, etc., this makes debugging extraordinarily difficult and laborious.
Actual Use Case
I'm implementing the gdb debugger interface specified in /usr/include/link.h
, which requires a single symbol, _r_debug
to be present in the _DYNAMIC
array.
(The symbol is actually not exported either, roughly GLOBAL and in the _DYNAMIC
array, which I get around by using a --dynamic-list
flag to the linker.)
I don't get around the lack of debug symbols at all, which vexes me.
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.