Skip to content

cmd/compile: DWARF duplicated DW_TAG_formal_parameter for some functions #61357

Open
@dev747368

Description

@dev747368

What version of Go are you using (go version)?

$ go version
go version go1.20.4 linux/amd64

I can duplicate this starting with 1.18. Binary produced with go 1.17 doesn't seem to show this issue.

Cross compiling to arm64 (instead of amd64) also shows the same issue.

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="linux"

What did you do?

package main

import "fmt"

func main() {
	fmt.Println("Hello")
}
readelf -wi hello | less
search for the "internal/poll.(*FD).Write" DW_TAG_subprogram entry

What did you expect to see?

Expected to see a subprogram entry with 4 DW_TAG_formal_parameter params (fd, p, ~r0, ~r1)

What did you see instead?

Th ~r0 and ~r1 formal params elements were duplicated:

 <1>: Abbrev Number: 3 (DW_TAG_subprogram)
       DW_AT_name        : internal/poll.(*FD).Write
       DW_AT_low_pc      : 0x4783e0
       DW_AT_high_pc     : 0x4788e9
       DW_AT_frame_base  : 1 byte block: 9c       (DW_OP_call_frame_cfa)
       DW_AT_decl_file   : 0x5
       DW_AT_external    : 1
 <2>: Abbrev Number: 18 (DW_TAG_formal_parameter)
       DW_AT_name        : fd
       DW_AT_variable_parameter: 0
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x7da43>
       DW_AT_location    : 0x1492a (location list)
 <2>: Abbrev Number: 18 (DW_TAG_formal_parameter)
       DW_AT_name        : p
       DW_AT_variable_parameter: 0
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x6af98>
       DW_AT_location    : 0x14970 (location list)
 <2>: Abbrev Number: 17 (DW_TAG_formal_parameter)     ***1st ~r0***
       DW_AT_name        : ~r0
       DW_AT_variable_parameter: 1
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x698f1>
       DW_AT_location    : 0 byte block:  ()
 <2>: Abbrev Number: 17 (DW_TAG_formal_parameter)     ***2nd ~r0***
       DW_AT_name        : ~r0
       DW_AT_variable_parameter: 1
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x698f1>
       DW_AT_location    : 0 byte block:  ()
 <2>: Abbrev Number: 17 (DW_TAG_formal_parameter)    ***1st ~r1***
       DW_AT_name        : ~r1
       DW_AT_variable_parameter: 1
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x740bc>
       DW_AT_location    : 0 byte block:  ()
 <2>: Abbrev Number: 17 (DW_TAG_formal_parameter)    ***2nd ~r1***
       DW_AT_name        : ~r1
       DW_AT_variable_parameter: 1
       DW_AT_decl_line   : 369
       DW_AT_type        : <0x740bc>
       DW_AT_location    : 0 byte block:  ()
.....

Metadata

Metadata

Assignees

Labels

DebuggingNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions