DWARF does not describe closure type
I wrote a simple test case that makes a closure. The closure is just:
let f2 = || println!("lambda f2");
The resulting DWARF doesn't describe the closure type at all:
<7><11e>: Abbrev Number: 6 (DW_TAG_variable)
<11f> DW_AT_location : 2 byte block: 91 78 (DW_OP_fbreg: -8)
<122> DW_AT_name : (indirect string, offset: 0x92): f2
<126> DW_AT_decl_file : 2
<127> DW_AT_decl_line : 28
<128> DW_AT_type : <0x636>
...
<1><636>: Abbrev Number: 19 (DW_TAG_structure_type)
<637> DW_AT_name : (indirect string, offset: 0x4c5): closure
<63b> DW_AT_byte_size : 0
I was planning to make it so the user can invoke a closure from gdb, but I think this bug prevents that.
Triage: not sure if anything has changed here, but I don't think so.
Steve Klabnik at 2019-12-25 16:34:31
Visited during wg-debugging triage. We're not aware of any changes here. @michaelwoerister pointed to some potentially related discussion about the way we namespace closure definitions in DWARF here. From an implementation POV, I think the above is correct but incomplete since closures are structs that implement
Fn,FnMutorFnOncetraits. The correct solution is probably to include some kind of DWARF which indicates those traits are implemented and points to the correct subprograms for the appropriate trait methods.Wesley Wiser at 2023-02-20 16:04:25