vtable symbols are not marked artificial in DWARF
Open
Nobody has claimed this yet.
A-debuginfo
A-LLVM
C-bug
S-blocked
S-waiting-on-LLVM
T-compiler
WG-debugging
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code, from the gdb testsuite:
fn empty () {
}
fn main () {
let array = [1,2,3,4];
let slice = &array[1..2];
let hello = "hello";
empty(); // STOP
}
I compiled with -g.
Examining the resulting DWARF, I see:
<1><2a>: Abbrev Number: 2 (DW_TAG_variable)
<2b> DW_AT_name : (indirect string, offset: 0xf3): <std::rt::lang_start::{closure_env#0}<()> as core::ops::function::Fn<()>>::{vtable}
<2f> DW_AT_type : <0x3d>
<33> DW_AT_location : 9 byte block: 3 80 24 5 0 0 0 0 0 (DW_OP_addr: 52480)
I think this should be marked with DW_AT_artificial, as it does not correspond to any user-written code in the CU. This will let gdb filter out these variables when displaying globals from a CU.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Rust snippet and -g, then inspect the emitted DWARF entry for the vtable variable and compare it with the gdb testsuite's expectations. Done means compiler-generated vtable symbols are marked with DW_AT_artificial so gdb can filter them from user-visible globals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100