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

cmd/link: Add DW_AT_decl_line for DW_TAG_subprogram in DWARF table #57308

Closed
hoeppi-google opened this issue Dec 14, 2022 · 6 comments
Closed
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@hoeppi-google
Copy link
Contributor

Currently, the DWARF table does not contain DW_AT_decl_line in the DW_TAG_subprogram entries, i.e. the source code line number of the function definition is not listed in the DWARF entry of said function. I propose to add this information to the DWARF table.

DW_AT_decl_line of functions is needed to convert absolute line numbers into relative line numbers w.r.t. to the first line of the function from DWARF information. Such information is useful in the context of PGO.

CC @aclements

@gopherbot gopherbot added this to the Proposal milestone Dec 14, 2022
@prattmic
Copy link
Member

cc @cherrymui @thanm

@prattmic
Copy link
Member

I am fairly certain that adding new DWARF data does not require the proposal process. Removing.

@prattmic prattmic changed the title proposal: cmd/link: Add DW_AT_decl_line for DW_TAG_subprogram in DWARF table cmd/link: Add DW_AT_decl_line for DW_TAG_subprogram in DWARF table Dec 14, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 14, 2022
@prattmic prattmic modified the milestones: Proposal, Go1.21 Dec 14, 2022
@prattmic prattmic self-assigned this Dec 14, 2022
@prattmic prattmic added NeedsFix The path to resolution is known, but the work has not been done. and removed Proposal labels Dec 14, 2022
@thanm
Copy link
Contributor

thanm commented Dec 14, 2022

@hoeppi-google is this attribute needed for subprogram corresponding to abstract functions? Or only regular DW_TAG_subprogram entries corresponding to vanilla functions?

@thanm
Copy link
Contributor

thanm commented Dec 14, 2022

discussed this offline with @prattmic , sounds like we need abstract function support as well.

@gopherbot
Copy link

Change https://go.dev/cl/457696 mentions this issue: cmd/link: set DW_AT_decl_line for function declarations

@gopherbot
Copy link

Change https://go.dev/cl/458195 mentions this issue: cmd/compile,cmd/link: set DW_AT_decl_line for function declarations

johanbrandhorst pushed a commit to Pryz/go that referenced this issue Feb 12, 2023
DW_AT_decl_line provides the line number of function declarations (the
line containing the func keyword). This is the equivalent to CL 429638,
but provided via DWARF.

Note that the file of declarations (DW_AT_decl_file) is already provided
for non-inlined functions. It is omitted for inlined functions because
those DWARF subprograms may be generated outside of their source
compilation unit, where referencing the file table is difficult.

Fixes golang#57308.

Change-Id: I3ad12e1f366c4465c2a588297988a5825ef7efec
Reviewed-on: https://go-review.googlesource.com/c/go/+/458195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants