Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWARF does not describe closure type #33121

Open
tromey opened this issue Apr 21, 2016 · 2 comments
Open

DWARF does not describe closure type #33121

tromey opened this issue Apr 21, 2016 · 2 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tromey
Copy link
Contributor

tromey commented Apr 21, 2016

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.

@sanxiyn sanxiyn added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Apr 21, 2016
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 25, 2017
@steveklabnik
Copy link
Member

Triage: not sure if anything has changed here, but I don't think so.

@wesleywiser
Copy link
Member

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, FnMut or FnOnce traits. 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.

@wesleywiser wesleywiser added the P-medium Medium priority label Feb 20, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants