-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.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
I tried this code:
#[collapse_debuginfo(yes)]
macro_rules! decl_foo {
() => {
#[no_mangle]
static FOO: u32 = 0; // line 5
};
}
decl_foo!(); // line 9
fn main() {
println!("Hello, {}!", &FOO as *const u32 as usize);
}
then
cargo build
llvm-dwarfdump target/debug/collapse
shows
0x0000057e: DW_TAG_variable
DW_AT_name ("FOO")
DW_AT_type (0x00000602 "u32")
DW_AT_external (true)
DW_AT_decl_file ("/home/dirbaio/collapse/src/main.rs")
DW_AT_decl_line (5)
DW_AT_alignment (4)
DW_AT_location (DW_OP_addr 0x530c)
I'd expect DW_AT_decl_line to be 9 (the line where the macro is called), not 5 (the line where the static is defined inside the macro).
Meta
rustc --version --verbose
:
rustc 1.81.0-nightly (d0227c6a1 2024-06-11)
binary: rustc
commit-hash: d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04
commit-date: 2024-06-11
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.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.